Bean Mail Windows Client (third party) development detailed

Source: Internet
Author: User

 

"Bean Mail", is a community site "watercress" a similar function of the private messages module. In the Watercress official website, "Bean Mail" was once changed to "private messages", but in many watercress users of the strong opposition and then changed back. However, on the Watercress Mobile client, it is still called "private messages."

Bean Mail Settings I would like to initially really as the form of e-mail to allow users to communicate, and with the popularity of mobile, bean mail by many users as an instant messaging software to use, can not stop.

"Can't you add a QQ or something like that?" ”

"No, that's not literary." ”

In order to this bad atmosphere, the amount, to carry forward, I decided to write a desktop software, so that many of the watercress literary youth, can work while chatting, no longer have to watch mobile phone frequently.

--------------The following is the text-------------

first, the watercress API    1. Use Fiddler analyze the requests made by the Android client.

  Brief steps: Open the Fiddler "Allow Remote Connection", set the port number, the phone and the computer need to be in the same WiFi network, set the mobile phone WiFi agent to the computer, at this time, the phone all HTTP requests can be heard in the fiddler. Then turn on HTTPS monitoring, set the host filter, only listen to the API address of the watercress.

Among them, the composer tab can clearly display the requested url,header,body and other information, and can be arbitrarily modified to debug the data, very convenient.

After that, we get a variety of API interface, including login and logout, access to user information, chat list, chat content, watchlist, message notification and so on.

2.OAUTH2.0 Certification Authorization

After you sign in with your user name and password, you will generate an access token and a refresh token. Access token will act as the unique credential for the user to log in and assign it to Authorization:bearer in the header request when used. After the first login, we save access token locally so that the user can log in directly next time without having to re-enter the user name and password.

OAuth2.0 the access token to be short-acting and expires within a certain amount of time. We can refresh the access token by using the refresh token as needed to form a new credential. The method is to change the value of the Grant_type in the request to Refresh_token.

Ii. using WPF for Interface drawing 1. The interface of the Windows client is highly imitated using XAML.

The interface effect is as follows:

2. Build a simple Chat window using the Web front end.

The chat window uses the WebBrowser control that comes with WPF, and the default kernel version is IE7 (which can be changed to a later version of IE by modifying the registry), which naturally does not support H5 and CSS3. Students who hate IE can use third-party browser kernel controls. Then write your own CSS style and JS interaction, simply test the compatibility problem is OK.

3. Suitable for high resolution screen

WPF native support High resolution, happy full.

Just the WebBrowser control is not scaled by default on a high-dpi screen. Fortunately, IE supports the Zoom property, we set the Zoom property of the Web page by a certain scale. So how do you determine this percentage? Generally speaking the 96DPI corresponds 100%,144dpi corresponds to 150%. OK, problem solved.

Iv. background logic 1. Multi-threaded separation ensures interface flow

Be sure to put the HTTP request service into the background and never allow the interface to wait. In this example, task is used primarily for processing.

2. "Instant" chat experience

The Watercress API has a separate interface to monitor the message alert, can return the number of unread messages and the reminder version number, we only need to poll the request, and compare the returned version number, we can do to the unread message to be reminded or display processing.

The 3.MVVM data-binding mode greatly improves the programming experience.

Used to say yes.

V. Features to be replenished

1. Send and display emoji emoticons.

2. Search for new users.

Vi. references and thanks 1. Inspired by the following articles:

"Fully open source" in the daily UWP Edition (previous): interface design, official API analysis

UWP Development controls: Use WebView to make chat boxes

2. Use the following open source components:

Json.NET

Vii. release of Open source

After the software is fully functional, it will open the installation package and source code, learn to communicate together.

Bean Mail Windows Client (third party) development detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.