Kubernetes client UAP development and client uap

Source: Internet
Author: User

Kubernetes client UAP development and client uap
Preface

Page navigation is a basic skill in the App. For a general App, you only need to perform simple Navigate + Back, A complex App may require a mixture of navigation modes to achieve the best user experience.

SplashScreen startup Screen

Let's start with the initial SplashScreen. If you make the boot screen into a Page, it will be displayed first when you start the screen, and then pretend to be busy for almost two seconds, jump to the next homepage and start to enter the subject. This looks pretty good. However, when a user presses the Back key, the page is triggered. However, this bug may be a novel experience.

In MSDN, there is a section dedicated to how to add a SplashScreen. But to be honest, I tried it twice, but I didn't succeed. It's so stupid!

Forget it. You can find a solution! Will it be easier to add a switch to MainPage? Therefore, MainPage. xaml is modified as follows:

<Page x:Name="page"
… >    <Grid>        <Grid x:Name="grid_Splash">            <Image Height="100" Source="ms-appx:///Assets/Logo.100.White.png" />        </Grid>        <Grid x:Name="grid_Main" Visibility="Collapsed">
            ……content here……        </Grid>    </Grid></Page>

The unimportant code is deleted here. Just look at the dry goods: <Grid x: Name = "grid_Splash">. This item defines a Grid, which is prefixed with the main content, because the following <Grid x: Name = grid_Main Visibility = "Collapsed"> is hidden in the initial state, the Image in grid_Splash will be started after the application is started, first, let's see you.

When will it be removed from the user's eyes? There are two ways to choose from.

1) load your data in the MainPage constructor. For example, it may take several seconds to load the data from a remote location, considering the network conditions. Then you can put a ProgressRing in the Splash to let it turn, turn, and turn ...... When users get bored, your remote data is also taken back, and then write the following sentence:

this.grid_Splash.Visibility = Windows.UI.Xaml.Visibility.Collapsed;this.grid_Main.Visibility = Windows.UI.Xaml.Visibility.Visible;

In this way, the Splash is hidden. After the data comes, you have completed the makeup (bound). You can see your in-laws.

2) If you do not need to call data remotely, but retrieve data from the local database, the above process will flash and blind the user's kkingg eye, and the experience will be terrible. In this case, you can use the second method: Start a 2-second timer when starting the application:

ThreadPoolTimer.CreateTimer(SplashTimeOut, new TimeSpan(0, 0, 2));

The callback function (delegate) is defined. When two seconds are passed, in the SplashTimeOut function:

void SplashTimeOut(......){    this.grid_Splash.Visibility = Windows.UI.Xaml.Visibility.Collapsed;    this.grid_Main.Visibility = Windows.UI.Xaml.Visibility.Visible;}

This will be the same as the experience of the first method, but it is just pretending to be busy for a while and waiting for two seconds. The purpose is to give the user a sense of excitement that someone is working for him, in addition, you are deeply impressed by the beautiful startup page.

Basic page

In addition to MainPage, if you need to add other level 2 pages, select here in:

This. Frame. Navigate (typeof (NewsReadingPage), obj );

If you do page navigation in the Control, for example, you have customized the Control, and the upper-Layer Code is not easy to obtain the specific Control, we have to trigger the navigation action in the Control, although we do not recommend this:

Frame frame = Window.Current.Content as Frame;frame.Navigate(typeof(....),....);

The Frame here is very fuzzy and looks like a global one, but in the previous example, this. Frame is used again, that is, there is a Frame in the Page object. I have a document dedicated to this, but I didn't understand it. It's so stupid! If you understand this, you can give us an explanation. Thank you!

Parameter transfer

The obj in the basic page navigation can be passed as a parameter to the lower-level page. But sometimes some lower-level pages need to return some information to the caller. How can this problem be solved? Because there is no parameter in the GoBack () method of the page. There are three ways to solve this problem:

1) make good use of the obj and use it as [in] and [out]. assign values to the fields in obj on the lower-level page, the upper-level page parses the agreed fields in obj to obtain the parameters.

2) use the static field in the lower-level page and assign a value to it before returning the result. Then, the upper-level page can be used.

3) Get an external class, such as a static class or a singleton class, and get a variable in it as a parameter. Note that you can put your fingerprints away with your gloves and set the variable to "zero" to hide the traces of your crimes, so as to avoid confusion about the current status during next use.

Navigation

This is not an example in the UAP of the z blog Park. Use Douban, another App we made. (By the way, we made an advertisement. Douban for WP has been launched, the name is "moment", link is here: moment ).

Let's look at the figure (note that the following logic is very difficult and you may not understand it if you are impatient ):

Private void Page_Loaded (object sender, RoutedEventArgs e) {if (! Settings. current. isLogin) {if (this. backFromLogonPage) {} else {this. frame. navigate (typeof (SettingsPage2), new DataModel. settingNavigationParameter () {targetparameter = target1_titemname. logonAndBack, targetCss = 0 });}}}

If you have logged on, you can leave nothing to the current Comment writing page. If you have not logged on, you can jump to the SettingsPage. Logon page with a parameter: LogonAndBack.

B) On the SettingsPage. Logon page, when a Successful Logon event is returned (because Logon is an asynchronous process), check whether the parameter is LogonAndBack:

void Current_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)        {            if (Settings.Current.IsLogin && this.logonAndBack)            {                Settings.Current.PropertyChanged -= Current_PropertyChanged;                this.Frame.GoBack();            }        }

For LogonAndBack, use this. Frame. GoBack () to return to the caller page, that is, the Comment page.

As a result, after a user has posted a comment, the user automatically reads the comment page and goes through the cloud. (I wanted to say that it was not so outrageous when I thought about it )!

Note that in CommentWritingPage, you must go to the other pages in the Page_Loaded event. If you call this in the OnNavigatedTo () event. frame. navigate (), nothing happened, useless, nothing happens.

Back-hop page navigation

Let's look at a more complex example. It is another App we have developed. It has not been completed yet. It features similar to a browser.

// Click events on the window management page

private void lv_ItemClick(object sender, ItemClickEventArgs e)        {            WebViewHelper wvh = e.ClickedItem as WebViewHelper;            this.pool.SetActiveWindow(wvh);            if (this.Frame.CanGoBack)            {                this.pool.BackFromStatusPage = true;                this.Frame.GoBack();            }        }

On this page, check whether the current active window is empty. Note that the Page_Loaded event must also be handled:

private void Page_Loaded(object sender, RoutedEventArgs e)        {            Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;            if (this.pool.BackFromStatusPage)            {                this.pool.BackFromStatusPage = false;                if (this.pool.GetActiveWindow().IsEmptyView)                {                    // back to main page to wait for input                    if (this.Frame.CanGoBack)                    {                        this.Frame.GoBack();                    }                }                else                {                    // stay at webview page to show current web content                }            }            else            {                this.ctrl_Input.Url = this.wvActive.Url;            }        }

If IsEmptyView = true, call GoBack to return to the master page (the third figure), instead of redirecting (forward) to the master page.

The basic idea of this solution, or the design concept, is that the window control page (the second figure) must be a leaf node and cannot be used as an intermediate navigation node.

Summary

I have talked to some bridge beginners many times: You have to think about each card. You cannot say, "I have never played the peach color. I will try it." Instead, I will analyze the Card Calling process, my companion has a big PEACH card. I want to help him and pass through the famous peach Q ". The same is true for programming. When there are multiple options, you must first determine a design concept and then determine the solution.

 

Share code and change the world!

Windows Phone Store App link:

Bytes

Windows Store App link:

Http://apps.microsoft.com/windows/zh-cn/app/c76b99a0-9abd-4a4e-86f0-b29bfcc51059

GitHub open source link:

Https://github.com/MS-UAP/cnblogs-UAP

MSDN Sample Code:

Https://code.msdn.microsoft.com/CNBlogs-Client-Universal-477943ab

 

MS-UAP

2015/2

Related Article

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.