NavigateToScreen() public static method

public static NavigateToScreen ( Type screenType ) : void
screenType System.Type
return void
コード例 #1
0
        private async void ConnectToWifi(WiFiAvailableNetwork network, PasswordCredential credential, CoreDispatcher dispatcher)
        {
            var didConnect = credential == null?
                             networkPresenter.ConnectToNetwork(network, Automatic) :
                                 networkPresenter.ConnectToNetworkWithPassword(network, Automatic, credential);

            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                SwitchToItemState(network, WifiConnectingState);
            });

            if (await didConnect)
            {
                await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    NavigationUtils.NavigateToScreen(typeof(MainPage));
                });
            }
            else
            {
                await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    var item        = SwitchToItemState(network, WifiInitialState);
                    item.IsSelected = false;
                });
            }
        }
コード例 #2
0
        public static void NavigateToNextTutorialFrom(string docName)
        {
            var index = Array.FindIndex(Constants.TutorialDocNames, s => s.Equals(docName));

            if (index <= -1 || index >= (Constants.TutorialDocNames.Length - 1))
            {
                return;
            }
            ++index;
            var newDocName = Constants.TutorialDocNames[index];

            if (newDocName == "HelloBlinky")
            {
#if (!ALWAYS_SHOW_BLINKY)
                if (DeviceTypeInformation.IsRaspberryPi || DeviceTypeInformation.Type == DeviceTypes.DB410)
#endif
                {
                    NavigationUtils.NavigateToScreen(typeof(TutorialHelloBlinkyPage), newDocName);
                    return;
                }
// Disable unreachable code warning
#pragma warning disable 162
                newDocName = Constants.TutorialDocNames[++index];
#pragma warning restore 162
            }

            NavigationUtils.NavigateToScreen(typeof(TutorialContentPage), newDocName);
        }
コード例 #3
0
        private void TutorialList_ItemClick(object sender, ItemClickEventArgs e)
        {
            var item = e.ClickedItem as FrameworkElement;

            if (item == null)
            {
                return;
            }
            switch (item.Name)
            {
            case "S1":
                AppLaunch(new Uri("webonpi1:launch"), new Uri("http://seksenov.github.io/WebHelloBlinky/"));
                break;

            case "S2":
                AppLaunch(new Uri("webonpi2:launch"), new Uri("http://microsoftedge.github.io/JSBrowser/"));
                break;

            case "S3":
                NavigateToSample(new Uri("http://codepen.io/seksenov/pen/obpLmR?editors=1010"));
                break;

            case "S4":
                AppLaunch(new Uri("webonpi4:launch"), new Uri("http://windowstodo.meteor.com/"));
                break;

            case "S5":
                AppLaunch(new Uri("webonpi5:launch"), new Uri("http://aka.ms/meteor-tutorial/"));
                break;

            default:
                NavigationUtils.NavigateToScreen(typeof(TutorialContentPage), item.Name);
                break;
            }
        }
コード例 #4
0
        public static void NavigateToNextTutorialFrom(string docName)
        {
            var index = Array.FindIndex(Constants.TutorialDocNames, s => s.Equals(docName));

            if (index <= -1 || index >= (Constants.TutorialDocNames.Length - 1))
            {
                return;
            }
            ++index;
            var newDocName = Constants.TutorialDocNames[index];

            if (newDocName == "HelloBlinky")
            {
#if (!ALWAYS_SHOW_BLINKY)
                if (DeviceTypeInformation.Type == DeviceTypes.RPI2 || DeviceTypeInformation.Type == DeviceTypes.DB410)
#endif
                {
                    NavigationUtils.NavigateToScreen(typeof(TutorialHelloBlinkyPage), newDocName);
                    return;
                }
                newDocName = Constants.TutorialDocNames[++index];
            }

            NavigationUtils.NavigateToScreen(typeof(TutorialContentPage), newDocName);
        }
コード例 #5
0
        public async Task <WiFiConnectionStatus> ConnectToNetwork(WifiListViewItemPresenter network, bool autoConnect)
        {
            Log.Enter();
            await AvailableNetworksLock.WaitAsync();

            if (network == null)
            {
                return(WiFiConnectionStatus.UnspecifiedFailure);
            }

            try
            {
                var result = await network.Adapter.ConnectAsync(network.AvailableNetwork, autoConnect?WiFiReconnectionKind.Automatic : WiFiReconnectionKind.Manual);

                //Call redirect only for Open Wifi
                if (IsNetworkOpen(network))
                {
                    //Navigate to http://www.msftconnecttest.com/redirect
                    NavigationUtils.NavigateToScreen(typeof(WebBrowserPage), Common.GetResourceText("MicrosoftWifiConnect"));
                }

                Log.Leave($"LEAVE {result.ConnectionStatus}");
                return(result.ConnectionStatus);
            }
            catch (Exception)
            {
                return(WiFiConnectionStatus.UnspecifiedFailure);
            }
        }
コード例 #6
0
        private async void NextButton_Clicked(object sender, RoutedEventArgs e)
        {
            var wifiAvailable = networkPresenter.WifiIsAvailable();

            SetPreferences();
            Type nextScreen;

            try
            {
                nextScreen = (await wifiAvailable) ? typeof(OOBENetwork) : typeof(MainPage);
            }
            catch (Exception)
            {
                nextScreen = typeof(MainPage);
            }

            await Window.Current.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                // If the next screen is the main-page, navigate there, but also launch Cortana to its Consent Page independently
                if (nextScreen == typeof(MainPage))
                {
                    await CortanaHelper.LaunchCortanaToConsentPageAsyncIfNeeded();
                }
                NavigationUtils.NavigateToScreen(nextScreen);
            });
        }
コード例 #7
0
        protected override void OnActivated(IActivatedEventArgs args)
        {
            // Spot if we are being activated due to inbound pairing request
            if (null != args && args.Kind == ActivationKind.DevicePairing)
            {
                // Ensure the main app loads first
                OnLaunched(null);

                // Get the arguments, which give information about the device which wants to pair with this app
                var devicePairingArgs = (DevicePairingActivatedEventArgs)args;
                var di = devicePairingArgs.DeviceInformation;

                // Automatically switch to Bluetooth Settings page
                NavigationUtils.NavigateToScreen(typeof(Settings), "BluetoothListViewItem");

                int      bluetoothSettingsIndex = 2;
                Frame    rootFrame        = Window.Current.Content as Frame;
                ListView settingsListView = null;
                settingsListView = (rootFrame.Content as FrameworkElement).FindName("SettingsChoice") as ListView;
                settingsListView.Focus(FocusState.Programmatic);
                bluetoothSettingsIndex         = Math.Min(bluetoothSettingsIndex, settingsListView.Items.Count - 1);
                settingsListView.SelectedIndex = bluetoothSettingsIndex;
                // Appropriate Bluetooth Listview grid content is forced by App_InboundPairingRequested call to SwitchToSelectedSettings

                // Fire the event letting subscribers know there's a new inbound request.
                // In this case Scenario should be subscribed.
                if (InboundPairingRequested != null)
                {
                    InboundPairingEventArgs inboundEventArgs = new InboundPairingEventArgs(di);
                    InboundPairingRequested(this, inboundEventArgs);
                }
            }
        }
コード例 #8
0
 private async void NetworkGrid_NetworkConnected(object sender, EventArgs e)
 {
     await OOBENetworkPageDispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
     {
         await CortanaHelper.LaunchCortanaToConsentPageAsyncIfNeeded();
         NavigationUtils.NavigateToScreen(typeof(MainPage));
     });
 }
コード例 #9
0
        private async void countdown_Tick(object sender, object e)
        {
            var value = DefaultLanguageProgress.Value + DefaultLanguageProgress.SmallChange * 5;

            DefaultLanguageProgress.Value = value;
            if (value >= DefaultLanguageProgress.Maximum)
            {
                countdown.Stop();
                await Window.Current.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    NavigationUtils.NavigateToScreen(typeof(MainPage));
                });
            }
        }
コード例 #10
0
        private void TutorialList_ItemClick(object sender, ItemClickEventArgs e)
        {
            var item = e.ClickedItem as FrameworkElement;

            if (item == null)
            {
                return;
            }
            switch (item.Name)
            {
            case "HelloBlinky":
                NavigationUtils.NavigateToScreen(typeof(TutorialHelloBlinkyPage), item.Name);
                break;

            default:
                NavigationUtils.NavigateToScreen(typeof(TutorialContentPage), item.Name);
                break;
            }
        }
コード例 #11
0
        public async Task <bool> ConnectToNetwork(WiFiAvailableNetwork network, bool autoConnect)
        {
            try
            {
                await NetworkNameToInfoLock.WaitAsync();

                if (network == null)
                {
                    return(false);
                }

                // We need to use TryGetValue here.  If we are rescanning for Wifi networks
                // (ie. 'await'ing on ScanAsync() in UpdateInfo(), 'NetworkNameToInfo' may not
                // have an entry described by the key'network'.
                WiFiAdapter wifiAdapter;
                if (!NetworkNameToInfo.TryGetValue(network, out wifiAdapter))
                {
                    return(false);
                }

                try
                {
                    var result = await wifiAdapter.ConnectAsync(network, autoConnect?WiFiReconnectionKind.Automatic : WiFiReconnectionKind.Manual);

                    //Call redirect only for Open Wifi
                    if (IsNetworkOpen(network))
                    {
                        //Navigate to http://www.msftconnecttest.com/redirect
                        NavigationUtils.NavigateToScreen(typeof(WebBrowserPage), Common.GetLocalizedText("MicrosoftWifiConnect"));
                    }

                    return(result.ConnectionStatus == WiFiConnectionStatus.Success);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
            finally
            {
                NetworkNameToInfoLock.Release();
            }
        }
コード例 #12
0
        public static void NavigateToNextTutorialFrom(string docName)
        {
            var index = Array.FindIndex(Constants.TutorialDocNames, s => s.Equals(docName));

            if (index <= -1 || index >= (Constants.TutorialDocNames.Length - 1))
            {
                return;
            }
            ++index;
            var newDocName = Constants.TutorialDocNames[index];

            if (newDocName == "HelloBlinky")
            {
                NavigationUtils.NavigateToScreen(typeof(TutorialHelloBlinkyPage), newDocName);
            }
            else
            {
                NavigationUtils.NavigateToScreen(typeof(TutorialContentPage), newDocName);
            }
        }
コード例 #13
0
        private async void NextButton_Tapped(object sender, TappedRoutedEventArgs e)
        {
            var wifiAvailable = NetworkPresenter.WifiIsAvailable();

            SetPreferences();
            Type nextScreen;

            try
            {
                nextScreen = (await wifiAvailable) ? typeof(OOBENetwork) : typeof(MainPage);
            }
            catch (Exception)
            {
                nextScreen = typeof(MainPage);
            }

            await Window.Current.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                NavigationUtils.NavigateToScreen(nextScreen);
            });
        }
コード例 #14
0
 private void SettingsButton_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(Settings));
 }
コード例 #15
0
 private void LegoProject_Click(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(LegoProjectPage));
 }
コード例 #16
0
 private void AboutButton_Click(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(AboutPage));
 }
コード例 #17
0
ファイル: MainPage.xaml.cs プロジェクト: HydAu/MSIotSamples
 private void Tutorials_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(TutorialMainPage));
 }
コード例 #18
0
 private void CommandLineButton_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(CommandLinePage));
 }
コード例 #19
0
 private void WebBrowserButton_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(WebBrowserPage));
 }
コード例 #20
0
 private void SkipButton_Clicked(object sender, RoutedEventArgs e)
 {
     CortanaHelper.LaunchCortanaToConsentPageAsyncIfNeeded();
     NavigationUtils.NavigateToScreen(typeof(MainPage));
 }
コード例 #21
0
        private void SetPreferences()
        {
            if (null == LanguagesListView.SelectedItem)
            {
                NavigationUtils.NavigateToScreen(typeof(MainPage));
            }
            else
            {
                LangApplyStack.Visibility = Visibility.Collapsed;
                string selectedLanguage = LanguagesListView.SelectedItem as string;

                //Check existing lang Tuple
                var currentLangTuple = languageManager.GetLanguageTuple(languageManager.GetLanguageTagFromDisplayName(selectedLanguage));
                SpeechSupport.Text = currentLangTuple.Item2 ? languageManager["SpeechSupportText"] : languageManager["SpeechNotSupportText"];

                if (LanguageManager.GetCurrentLanguageDisplayName().Equals(selectedLanguage))
                {
                    //Do Nothing
                    return;
                }

                //Check if selected language is part of ffu
                var newLang = languageManager.CheckUpdateLanguage(selectedLanguage);

                if (LanguageManager.GetDisplayNameFromLanguageTag(newLang.Item4).Equals(selectedLanguage))
                {
                    //Update
                    var langReturned = languageManager.UpdateLanguage(selectedLanguage);

                    //ffu list, Show user to restart to use the System Languages
                    if (newLang.Item1)
                    {
                        Common.LangApplyRebootRequired = true;
                        LangApplyStack.Visibility      = Visibility.Visible;
                    }
                    //else
                    //skip providing option to restart app
                }
                else
                {
                    if (newLang.Item2)
                    {
                        //Stop Automatic counter to switch to next screen
                        timer.Stop();
                        countdown.Stop();
                        ChooseDefaultLanguage.Visibility = Visibility.Collapsed;
                        CancelButton.Visibility          = Visibility.Collapsed;

                        //If different, show the popup for confirmation
                        PopupText2.Text  = LanguageManager.GetDisplayNameFromLanguageTag(newLang.Item4);
                        PopupYes.Content = LanguageManager.GetDisplayNameFromLanguageTag(newLang.Item4);

                        PopupText1.Text = languageManager["LanguagePopupText1"];
                        PopupText3.Text = languageManager["LanguagePopupText3"];

                        PopupNo.Content = LanguagesListView.SelectedItem as string;

                        double hOffset = (Window.Current.Bounds.Width) / 4;
                        double vOffset = (Window.Current.Bounds.Height) / 2;

                        StandardPopup.VerticalOffset   = vOffset;
                        StandardPopup.HorizontalOffset = hOffset;

                        if (!StandardPopup.IsOpen)
                        {
                            StandardPopup.IsOpen = true;
                        }
                    }
                    else
                    {
                        //Just update silently in the background and dont ask for restart app
                        var langReturned = languageManager.UpdateLanguage(selectedLanguage);
                    }
                }
            }
        }
コード例 #22
0
 private void Samples_Clicked(object sender, RoutedEventArgs e)
 {
     showAllSamples();
     NavigationUtils.NavigateToScreen(typeof(TutorialMainPage));
 }
コード例 #23
0
 private void WindowsOnDevices_Click(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(WebBrowserPage), Constants.WODUrl);
 }
コード例 #24
0
 private void DeviceInfo_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(MainPage));
 }
コード例 #25
0
 private void SecurityNoticeLearnMoreButton_Click(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(WebBrowserPage), Constants.IoTCoreManufacturingGuideUrl);
 }
コード例 #26
0
 /// <summary>
 /// Invokes Settings->Network ListView Item
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnSettings_Click(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(Settings), "NetworkListViewItem");
 }
コード例 #27
0
 private void SkipButton_Tapped(object sender, TappedRoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(MainPage));
 }