コード例 #1
0
        private void NavigateFrame(string page)
        {
            switch (page)
            {
            default:
            case "General":
                SettingsFrame.Navigate(typeof(SettingsGeneral));
                SettingsNavView.SelectedItem = SettingsNavView.MenuItems[0];
                break;

            case "Appearance":
                SettingsFrame.Navigate(typeof(SettingsAppearance));
                break;

            case "Alerts":
                SettingsFrame.Navigate(typeof(SettingsAlerts));
                break;

            case "Changelog":
                SettingsFrame.Navigate(typeof(SettingsChangelog));
                break;

            case "Feedback":
                SettingsFrame.Navigate(typeof(SettingsFeedback));
                break;

            case "About":
                SettingsFrame.Navigate(typeof(SettingsAbout));
                break;

            case "Calculator":
                SettingsFrame.Navigate(typeof(SettingsCalculator));
                break;
            }
        }
コード例 #2
0
        private void SettingsNav_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
        {
            var    selectedItem = (NavigationViewItem)args.SelectedItem;
            string Tag          = (string)selectedItem.Tag;

            switch (Tag)
            {
            case "General":
                SettingsFrame.Navigate(typeof(SettingsPages.General));
                break;

            case "AutoBrightness":
                SettingsFrame.Navigate(typeof(SettingsPages.AutoBrightness));
                break;

            case "Appearance":
                SettingsFrame.Navigate(typeof(SettingsPages.Appearance));
                break;

            case "Hotkeys":
                SettingsFrame.Navigate(typeof(SettingsPages.Hotkeys));
                break;

            case "About":
                SettingsFrame.Navigate(typeof(SettingsPages.About));
                break;
            }
        }
コード例 #3
0
 public Shell()
 {
     this.InitializeComponent();
     mainFrame.Navigate(typeof(WritingView));
     InfoBarFrame.Navigate(typeof(InfoBarView));
     SettingsFrame.Navigate(typeof(SettingsView));
 }
コード例 #4
0
        private void InitControls()
        {
            ToolTipService.SetToolTip(ExitCompactOverlayButton, _resourceLoader.GetString("App_ExitCompactOverlayMode_Text"));
            RootSplitView.PaneOpening += delegate { SettingsFrame.Navigate(typeof(SettingsPage), null, new SuppressNavigationTransitionInfo()); };
            RootSplitView.PaneClosed  += delegate { NotepadsCore.FocusOnSelectedTextEditor(); };
            NewSetButton.Click        += delegate { NotepadsCore.OpenNewTextEditor(); };
            MainMenuButton.Click      += (sender, args) => FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);
            MenuCreateNewButton.Click += (sender, args) => NotepadsCore.OpenNewTextEditor();
            MenuOpenFileButton.Click  += async(sender, args) => await OpenNewFiles();

            MenuSaveButton.Click += async(sender, args) => await Save(NotepadsCore.GetSelectedTextEditor(), saveAs : false);

            MenuSaveAsButton.Click += async(sender, args) => await Save(NotepadsCore.GetSelectedTextEditor(), saveAs : true);

            MenuSaveAllButton.Click += async(sender, args) => { foreach (var textEditor in NotepadsCore.GetAllTextEditors())
                                                                {
                                                                    await Save(textEditor, saveAs : false, ignoreUnmodifiedDocument : true);
                                                                }
            };
            MenuFindButton.Click           += (sender, args) => NotepadsCore.GetSelectedTextEditor()?.ShowFindAndReplaceControl(showReplaceBar: false);
            MenuReplaceButton.Click        += (sender, args) => NotepadsCore.GetSelectedTextEditor()?.ShowFindAndReplaceControl(showReplaceBar: true);
            MenuFullScreenButton.Click     += (sender, args) => EnterExitFullScreenMode();
            MenuCompactOverlayButton.Click += (sender, args) => EnterExitCompactOverlayMode();
            MenuSettingsButton.Click       += (sender, args) => RootSplitView.IsPaneOpen = true;

            MainMenuButtonFlyout.Opening += (sender, o) =>
            {
                var selectedTextEditor = NotepadsCore.GetSelectedTextEditor();
                if (selectedTextEditor == null)
                {
                    MenuSaveButton.IsEnabled    = false;
                    MenuSaveAsButton.IsEnabled  = false;
                    MenuFindButton.IsEnabled    = false;
                    MenuReplaceButton.IsEnabled = false;
                    //MenuPrintButton.IsEnabled = false;
                }
                else if (selectedTextEditor.IsEditorEnabled() == false)
                {
                    MenuSaveButton.IsEnabled    = selectedTextEditor.IsModified;
                    MenuSaveAsButton.IsEnabled  = true;
                    MenuFindButton.IsEnabled    = false;
                    MenuReplaceButton.IsEnabled = false;
                    //MenuPrintButton.IsEnabled = true;
                }
                else
                {
                    MenuSaveButton.IsEnabled    = selectedTextEditor.IsModified;
                    MenuSaveAsButton.IsEnabled  = true;
                    MenuFindButton.IsEnabled    = true;
                    MenuReplaceButton.IsEnabled = true;
                    //MenuPrintButton.IsEnabled = true;
                }

                MenuFullScreenButton.Text = _resourceLoader.GetString(ApplicationView.GetForCurrentView().IsFullScreenMode ?
                                                                      "App_ExitFullScreenMode_Text" : "App_EnterFullScreenMode_Text");
                MenuCompactOverlayButton.Text = _resourceLoader.GetString(ApplicationView.GetForCurrentView().ViewMode == ApplicationViewMode.CompactOverlay ?
                                                                          "App_ExitCompactOverlayMode_Text" : "App_EnterCompactOverlayMode_Text");
                MenuSaveAllButton.IsEnabled = NotepadsCore.HaveUnsavedTextEditor();
            };
        }
コード例 #5
0
 private void InitializeControls()
 {
     ToolTipService.SetToolTip(ExitCompactOverlayButton, _resourceLoader.GetString("App_ExitCompactOverlayMode_Text"));
     RootSplitView.PaneOpening += delegate { SettingsFrame.Navigate(typeof(SettingsPage), null, new SuppressNavigationTransitionInfo()); };
     RootSplitView.PaneClosed  += delegate { NotepadsCore.FocusOnSelectedTextEditor(); };
     NewSetButton.Click        += delegate { NotepadsCore.OpenNewTextEditor(_defaultNewFileName); };
 }
コード例 #6
0
ファイル: ShellView.xaml.cs プロジェクト: colinkiama/dysprose
 protected async override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     MainFrame.Navigate(typeof(MainView));
     SettingsFrame.Navigate(typeof(SettingsView));
     SettingsFrame.Visibility = Visibility.Collapsed;
     await ReviewHelper.TryRequestReviewAsync();
 }
コード例 #7
0
        public SettingsNav()
        {
            this.InitializeComponent();

            SettingsFrame.Navigate(typeof(General), new SuppressNavigationTransitionInfo());

            App.Settings.PropertyChanged += SettingsOnPropertyChanged;
        }
コード例 #8
0
        private void SettingsControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox settingsListBox = sender as ListBox;
            var     s = settingsListBox.SelectedItem as ShutterinoSettingDefinition;

            if (s?.DeviceViewModel?.Available == true)
            {
                SettingsFrame.Navigate(s.ViewType);
                // TODO: this should be properly done with binding
                StatusBlock.Text = s.DeviceViewModel.Status ?? String.Empty;
            }
        }
コード例 #9
0
        private void InitControls()
        {
            RootSplitView.PaneOpening += delegate { SettingsFrame.Navigate(typeof(SettingsPage), null, new SuppressNavigationTransitionInfo()); };
            RootSplitView.PaneClosed  += delegate { NotepadsCore.FocusOnSelectedTextEditor(); };
            NewSetButton.Click        += delegate { NotepadsCore.OpenNewTextEditor(); };
            MainMenuButton.Click      += (sender, args) => FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);
            MenuCreateNewButton.Click += (sender, args) => NotepadsCore.OpenNewTextEditor();
            MenuOpenFileButton.Click  += async(sender, args) => await OpenNewFiles();

            MenuSaveButton.Click += async(sender, args) => await Save(NotepadsCore.GetSelectedTextEditor(), saveAs : false);

            MenuSaveAsButton.Click += async(sender, args) => await Save(NotepadsCore.GetSelectedTextEditor(), saveAs : true);

            MenuSaveAllButton.Click += async(sender, args) => { foreach (var textEditor in NotepadsCore.GetAllTextEditors())
                                                                {
                                                                    await Save(textEditor, saveAs : false, ignoreUnmodifiedDocument : true);
                                                                }
            };
            MenuFindButton.Click     += (sender, args) => NotepadsCore.GetSelectedTextEditor()?.ShowFindAndReplaceControl(showReplaceBar: false);
            MenuReplaceButton.Click  += (sender, args) => NotepadsCore.GetSelectedTextEditor()?.ShowFindAndReplaceControl(showReplaceBar: true);
            MenuSettingsButton.Click += (sender, args) => RootSplitView.IsPaneOpen = true;

            MainMenuButtonFlyout.Closing += delegate { NotepadsCore.FocusOnSelectedTextEditor(); };
            MainMenuButtonFlyout.Opening += (sender, o) =>
            {
                var selectedTextEditor = NotepadsCore.GetSelectedTextEditor();
                if (selectedTextEditor == null)
                {
                    MenuSaveButton.IsEnabled    = false;
                    MenuSaveAsButton.IsEnabled  = false;
                    MenuFindButton.IsEnabled    = false;
                    MenuReplaceButton.IsEnabled = false;
                    //MenuPrintButton.IsEnabled = false;
                }
                else if (selectedTextEditor.IsEditorEnabled() == false)
                {
                    MenuSaveButton.IsEnabled    = selectedTextEditor.IsModified;
                    MenuSaveAsButton.IsEnabled  = true;
                    MenuFindButton.IsEnabled    = false;
                    MenuReplaceButton.IsEnabled = false;
                    //MenuPrintButton.IsEnabled = true;
                }
                else
                {
                    MenuSaveButton.IsEnabled    = selectedTextEditor.IsModified;
                    MenuSaveAsButton.IsEnabled  = true;
                    MenuFindButton.IsEnabled    = true;
                    MenuReplaceButton.IsEnabled = true;
                    //MenuPrintButton.IsEnabled = true;
                }
                MenuSaveAllButton.IsEnabled = NotepadsCore.HaveUnsavedTextEditor();
            };
        }
コード例 #10
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            HomePage         = new SettingsPages.HomePage();
            DisplaysPage     = new SettingsPages.DisplaysPage();
            ScreenSpacePage  = new SettingsPages.ScreenSpacePage();
            WindowsPage      = new SettingsPages.WindowsPage();
            AutomationPage   = new SettingsPages.AutomationPage();
            LogsPage         = new SettingsPages.LogsPage();
            ExperimentalPage = new SettingsPages.ExperimentalPage();

            NavService = SettingsFrame.NavigationService;
            SettingsFrame.Navigate(HomePage);
        }
コード例 #11
0
ファイル: MainPage.xaml.cs プロジェクト: leoz-ms/Notepads
        private void InitControls()
        {
            RootSplitView.PaneOpening += delegate { SettingsFrame.Navigate(typeof(SettingsPage), null, new SuppressNavigationTransitionInfo()); };
            RootSplitView.PaneClosed  += delegate { NotepadsCore.FocusOnSelectedTextEditor(); };
            NewSetButton.Click        += delegate { NotepadsCore.OpenNewTextEditor(); };
            MainMenuButton.Click      += (sender, args) => FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);
            MenuCreateNewButton.Click += (sender, args) => NotepadsCore.OpenNewTextEditor();
            MenuOpenFileButton.Click  += async(sender, args) => await OpenNewFiles();

            MenuSaveButton.Click += async(sender, args) => await Save(NotepadsCore.GetSelectedTextEditor(), false);

            MenuSaveAsButton.Click += async(sender, args) => await Save(NotepadsCore.GetSelectedTextEditor(), true);

            MenuSaveAllButton.Click += async(sender, args) => { foreach (var textEditor in NotepadsCore.GetAllTextEditors())
                                                                {
                                                                    await Save(textEditor, false);
                                                                }
            };
            MenuFindButton.Click     += (sender, args) => ShowFindAndReplaceControl(false);
            MenuReplaceButton.Click  += (sender, args) => ShowFindAndReplaceControl(true);
            MenuSettingsButton.Click += (sender, args) => RootSplitView.IsPaneOpen = true;

            MainMenuButtonFlyout.Closing += delegate { NotepadsCore.FocusOnSelectedTextEditor(); };
            MainMenuButtonFlyout.Opening += (sender, o) =>
            {
                if (NotepadsCore.GetNumberOfOpenedTextEditors() == 0)
                {
                    MenuSaveButton.IsEnabled    = false;
                    MenuSaveAsButton.IsEnabled  = false;
                    MenuSaveAllButton.IsEnabled = false;
                    MenuFindButton.IsEnabled    = false;
                    MenuReplaceButton.IsEnabled = false;
                    //MenuPrintButton.IsEnabled = false;
                }
                else
                {
                    MenuSaveButton.IsEnabled    = true;
                    MenuSaveAsButton.IsEnabled  = true;
                    MenuSaveAllButton.IsEnabled = true;
                    MenuFindButton.IsEnabled    = true;
                    MenuReplaceButton.IsEnabled = true;
                    //MenuPrintButton.IsEnabled = true;
                }
            };
        }
コード例 #12
0
        private Type ShowTab(SettingsTabs settingsTab)
        {
            var pageType = settingsTab switch
            {
                SettingsTabs.General => typeof(General),
                SettingsTabs.Theme => typeof(Theme),
                SettingsTabs.Fonts => typeof(Font),
                SettingsTabs.Advanced => typeof(Advanced),
                SettingsTabs.About => typeof(About),
                _ => null
            };

            if (pageType != null)
            {
                SettingsFrame.Navigate(pageType, new SuppressNavigationTransitionInfo());
            }

            return(pageType);
        }
コード例 #13
0
 private void NavigationViewItem_Tapped(object sender, TappedRoutedEventArgs e)
 {
     SettingsFrame.Navigate(typeof(SettingsChildren.AboutPage), SettingsFrame);
 }
コード例 #14
0
 public SettingsWindow()
 {
     InitializeComponent();
     SettingsFrame.Navigate(new Home());
     MarketFrame.Navigate(new MarketplaceTestPage());
 }
コード例 #15
0
ファイル: MainPage.xaml.cs プロジェクト: randyammar/Notepads
 private void RootSplitView_OnPaneOpening(SplitView sender, object args)
 {
     SettingsFrame.Navigate(typeof(SettingsPage), null, new SuppressNavigationTransitionInfo());
 }
コード例 #16
0
        private void InitControls()
        {
            ToolTipService.SetToolTip(ExitCompactOverlayButton, _resourceLoader.GetString("App_ExitCompactOverlayMode_Text"));
            RootSplitView.PaneOpening       += delegate { SettingsFrame.Navigate(typeof(SettingsPage), null, new SuppressNavigationTransitionInfo()); };
            RootSplitView.PaneClosed        += delegate { NotepadsCore.FocusOnSelectedTextEditor(); };
            NewSetButton.Click              += delegate { NotepadsCore.OpenNewTextEditor(_defaultNewFileName); };
            MainMenuButton.Click            += (sender, args) => FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);
            MenuCreateNewButton.Click       += (sender, args) => NotepadsCore.OpenNewTextEditor(_defaultNewFileName);
            MenuCreateNewWindowButton.Click += async(sender, args) => await OpenNewAppInstance();

            MenuOpenFileButton.Click += async(sender, args) => await OpenNewFiles();

            MenuSaveButton.Click += async(sender, args) => await Save(NotepadsCore.GetSelectedTextEditor(), saveAs : false);

            MenuSaveAsButton.Click += async(sender, args) => await Save(NotepadsCore.GetSelectedTextEditor(), saveAs : true);

            MenuSaveAllButton.Click += async(sender, args) =>
            {
                var success = false;
                foreach (var textEditor in NotepadsCore.GetAllTextEditors())
                {
                    if (await Save(textEditor, saveAs: false, ignoreUnmodifiedDocument: true, rebuildOpenRecentItems: false))
                    {
                        success = true;
                    }
                }
                if (success)
                {
                    await BuildOpenRecentButtonSubItems();
                }
            };
            MenuFindButton.Click           += (sender, args) => NotepadsCore.GetSelectedTextEditor()?.ShowFindAndReplaceControl(showReplaceBar: false);
            MenuReplaceButton.Click        += (sender, args) => NotepadsCore.GetSelectedTextEditor()?.ShowFindAndReplaceControl(showReplaceBar: true);
            MenuFullScreenButton.Click     += (sender, args) => EnterExitFullScreenMode();
            MenuCompactOverlayButton.Click += (sender, args) => EnterExitCompactOverlayMode();
            MenuPrintButton.Click          += async(sender, args) => await Print(NotepadsCore.GetSelectedTextEditor());

            MenuPrintAllButton.Click += async(sender, args) => await PrintAll(NotepadsCore.GetAllTextEditors());

            MenuSettingsButton.Click += (sender, args) => RootSplitView.IsPaneOpen = true;

            MainMenuButtonFlyout.Opening += (sender, o) =>
            {
                var selectedTextEditor = NotepadsCore.GetSelectedTextEditor();
                if (selectedTextEditor == null)
                {
                    MenuSaveButton.IsEnabled     = false;
                    MenuSaveAsButton.IsEnabled   = false;
                    MenuFindButton.IsEnabled     = false;
                    MenuReplaceButton.IsEnabled  = false;
                    MenuPrintButton.IsEnabled    = false;
                    MenuPrintAllButton.IsEnabled = false;
                }
                else if (selectedTextEditor.IsEditorEnabled() == false)
                {
                    MenuSaveButton.IsEnabled    = selectedTextEditor.IsModified;
                    MenuSaveAsButton.IsEnabled  = true;
                    MenuFindButton.IsEnabled    = false;
                    MenuReplaceButton.IsEnabled = false;
                }
                else
                {
                    MenuSaveButton.IsEnabled    = selectedTextEditor.IsModified;
                    MenuSaveAsButton.IsEnabled  = true;
                    MenuFindButton.IsEnabled    = true;
                    MenuReplaceButton.IsEnabled = true;

                    if (PrintManager.IsSupported())
                    {
                        MenuPrintButton.IsEnabled    = !string.IsNullOrEmpty(selectedTextEditor.GetText());
                        MenuPrintAllButton.IsEnabled = NotepadsCore.HaveNonemptyTextEditor();
                    }
                }

                MenuFullScreenButton.Text = _resourceLoader.GetString(ApplicationView.GetForCurrentView().IsFullScreenMode ?
                                                                      "App_ExitFullScreenMode_Text" : "App_EnterFullScreenMode_Text");
                MenuCompactOverlayButton.Text = _resourceLoader.GetString(ApplicationView.GetForCurrentView().ViewMode == ApplicationViewMode.CompactOverlay ?
                                                                          "App_ExitCompactOverlayMode_Text" : "App_EnterCompactOverlayMode_Text");
                MenuSaveAllButton.IsEnabled = NotepadsCore.HaveUnsavedTextEditor();
            };

            if (!App.IsFirstInstance)
            {
                MainMenuButton.Foreground    = new SolidColorBrush(ThemeSettingsService.AppAccentColor);
                MenuSettingsButton.IsEnabled = false;
            }

            if (App.IsGameBarWidget)
            {
                MenuFullScreenSeparator.Visibility = Visibility.Collapsed;
                MenuPrintSeparator.Visibility      = Visibility.Collapsed;
                MenuSettingsSeparator.Visibility   = Visibility.Collapsed;

                MenuCompactOverlayButton.Visibility = Visibility.Collapsed;
                MenuFullScreenButton.Visibility     = Visibility.Collapsed;
                MenuPrintButton.Visibility          = Visibility.Collapsed;
                MenuPrintAllButton.Visibility       = Visibility.Collapsed;
                MenuSettingsButton.Visibility       = Visibility.Collapsed;
            }
        }
コード例 #17
0
 private void RemoveGameButton_Click(object sender, RoutedEventArgs e)
 {
     SettingsFrame.Navigate(new DeleteGamePage());
 }