Exemplo n.º 1
0
 private void NextButton_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToNextTutorialFrom(docName);
 }
Exemplo n.º 2
0
 private void BackButton_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.GoBack();
 }
Exemplo n.º 3
0
 private void DeviceInfo_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(MainPage));
 }
Exemplo n.º 4
0
 private void Tutorials_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(TutorialMainPage));
 }
Exemplo n.º 5
0
 private void SettingsButton_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(Settings));
 }
Exemplo n.º 6
0
 private void CommandLineButton_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(CommandLinePage));
 }
Exemplo n.º 7
0
 private void WebBrowserButton_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(WebBrowserPage));
 }
Exemplo n.º 8
0
        private async Task RunProcess()
        {
            if (string.IsNullOrWhiteSpace(CommandLine.Text))
            {
                return;
            }

            commandLineHistory.Add(CommandLine.Text);
            currentCommandLine = commandLineHistory.Count;

            bool isCmdAuthorized = true;
            Run  cmdLineRun      = new Run();

            cmdLineRun.Foreground = new SolidColorBrush(Windows.UI.Colors.LightGray);
            cmdLineRun.FontWeight = FontWeights.Bold;
            cmdLineRun.Text       = currentDirectory + "> " + CommandLine.Text + "\n";

            Run stdOutRun = new Run();
            Run stdErrRun = new Run();

            stdErrRun.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);

            var commandLineText = CommandLine.Text.Trim();

            if (commandLineText.Equals("cls", StringComparison.CurrentCultureIgnoreCase))
            {
                StdOutputText.Blocks.Clear();
                return;
            }
            else if (commandLineText.StartsWith("cd ", StringComparison.CurrentCultureIgnoreCase) || commandLineText.Equals("cd", StringComparison.CurrentCultureIgnoreCase))
            {
                stdErrRun.Text = resourceLoader.GetString("CdNotSupported");
            }
            else if (commandLineText.Equals("exit", StringComparison.CurrentCultureIgnoreCase))
            {
                NavigationUtils.GoBack();
            }
            else
            {
                var standardOutput = new InMemoryRandomAccessStream();
                var standardError  = new InMemoryRandomAccessStream();
                var options        = new ProcessLauncherOptions
                {
                    StandardOutput = standardOutput,
                    StandardError  = standardError
                };

                try
                {
                    var args   = "/C \"cd \"" + currentDirectory + "\" & " + commandLineText + "\"";
                    var result = await ProcessLauncher.RunToCompletionAsync(CommandLineProcesserExe, args, options);

                    // First write std out
                    using (var outStreamRedirect = standardOutput.GetInputStreamAt(0))
                    {
                        using (var dataReader = new DataReader(outStreamRedirect))
                        {
                            await ReadText(dataReader, stdOutRun);
                        }
                    }

                    // Then write std err
                    using (var errStreamRedirect = standardError.GetInputStreamAt(0))
                    {
                        using (var dataReader = new DataReader(errStreamRedirect))
                        {
                            await ReadText(dataReader, stdErrRun);
                        }
                    }
                }
                catch (UnauthorizedAccessException uex)
                {
                    isCmdAuthorized = false;
                    var errorMessage = uex.Message + "\n\n" + resourceLoader.GetString("CmdNotEnabled");
                    stdErrRun.Text = errorMessage;
                }
                catch (Exception ex)
                {
                    var errorMessage = ex.Message + "\n" + ex.StackTrace + "\n";
                    stdErrRun.Text = errorMessage;
                }
            }

            await CoreWindow.GetForCurrentThread().Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                Paragraph paragraph = new Paragraph();

                paragraph.Inlines.Add(cmdLineRun);
                paragraph.Inlines.Add(stdOutRun);
                paragraph.Inlines.Add(stdErrRun);

                if (!isCmdAuthorized)
                {
                    InlineUIContainer uiContainer = new InlineUIContainer();
                    Button cmdEnableButton        = new Button();
                    cmdEnableButton.Content       = resourceLoader.GetString("EnableCmdText");
                    cmdEnableButton.Click        += AccessButtonClicked;
                    uiContainer.Child             = cmdEnableButton;
                    paragraph.Inlines.Add(uiContainer);
                }

                StdOutputText.Blocks.Add(paragraph);
            });
        }
Exemplo n.º 9
0
 private void SkipButton_Clicked(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(MainPage));
 }
Exemplo n.º 10
0
 private void WindowsOnDevices_Click(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(WebBrowserPage), Constants.WODUrl);
 }
Exemplo n.º 11
0
 private void SecurityNoticeLearnMoreButton_Click(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(WebBrowserPage), Constants.IoTCoreManufacturingGuideUrl);
 }
Exemplo n.º 12
0
 private void BackButton_Tapped(object sender, TappedRoutedEventArgs e)
 {
     NavigationUtils.GoBack();
 }
Exemplo n.º 13
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);
                    }
                }
            }
        }
Exemplo n.º 14
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");
 }
Exemplo n.º 15
0
        private async void SkipButton_Clicked(object sender, RoutedEventArgs e)
        {
            await CortanaHelper.LaunchCortanaToConsentPageAsyncIfNeeded();

            NavigationUtils.NavigateToScreen(typeof(MainPage));
        }
Exemplo n.º 16
0
 private void AboutButton_Click(object sender, RoutedEventArgs e)
 {
     NavigationUtils.NavigateToScreen(typeof(AboutPage));
 }