English 中文(简体)
Twitterizer API Questions
原标题:

I ve recently been playing around with the awesome Twitterizer Twitter API using C# WPF in Visual Studio 2008. It s been working the most part, but I do have some questions about it.

1) How can I make it so that the login screen is a different windows that closes when you log in, unless there is a login failure?

2) How can I make it so that it tells the user that their login information is incorrect?

3) How can I make it save the user s login information so that they don t have to enter again?

4) How can I make a character countdown when a user is posting a status and not let it be posted if it is over 140 characters?

Sorry if these questions seem kind of noobish. i m not very good at C#, especially since this is my first time using the WPF framework.

最佳回答

This is several questions. You should ask them separately.

How to make Login a different window

Add a new Window to your project. Implement your login screen there. Show the new window when the app starts up (or whenever it is appropriate to do so).

How to display login error messages

When the "Log in" button is clicked in the window, execute the login. If it fails (you get an exception), display a dialog box, otherwise close the login window.

How to save the user s login information

You should save such information to the protected store instead of writing it to a file. Save it after a successful login. Load it when the application starts.

How to make a character countdown

Add a new "CharactersLeft" dependency property to your user control or window. Add a PropertyChangedCallback to your Text property (I assume you have one - it should be a DependencyProperty as well and your TextBox should be bound to it). In the PropetyChangedCallback, update the CharactersLeft value. Bind a TextBlock to the CharactersLeft value.

How to prevent posting if CharactersLeft is negative

If you are using an ICommand, implement CanExecute. If you are using a RoutedCommand, implement OnCanExecute. If you are directly handling the button click, consider using commands instead, or set a trigger on your button button so that it becomes disabled whenever CharactersLeft is less than zero. (You will need a IValueConverter for this, or you can just have a separate property.)

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签