コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: Wolfteam/MiraiNotes
 public MainPage()
 {
     this.InitializeComponent();
     ContentFrame.Navigate(typeof(TasksPage));
     PaneFrame.Navigate(typeof(NewTaskPage));
     SettingsPageFrame.Navigate(typeof(SettingsPage));
     MainSplitView.RegisterPropertyChangedCallback(SplitView.IsPaneOpenProperty, IsPaneOpenPropertyChanged);
     MainSplitView.SizeChanged += (sender, e) => UpdatePaneWidth();
 }
コード例 #2
0
    public MainWindow()
    {
        InitializeComponent();

        var settingsService = ServiceContext.GetService <ISettingsService>();

        Loaded += (s, e) =>
        {
            var settings = settingsService.LoadGuiSettings();
            WindowPosition.ApplyToWindow(settings.WindowPositions, this);
            if (!settings.IsMainViewMenuExpanded)
            {
                MainSplitView.CollapseMenu(true);
            }
            Activate();
        };
        Closing += (s, e) =>
        {
            var settings = settingsService.LoadGuiSettings();
            WindowPosition.AddWindowToList(settings.WindowPositions, this);
            settings.IsMainViewMenuExpanded = MainSplitView.IsExpanded;
            settingsService.SaveGuiSettings(settings);
        };

        MainSplitView.UseAnimations = false;
        try
        {
            var settings = settingsService.LoadSettings();
            if (!Directory.Exists(settings.PrintsPath))
            {
                SettingsPage.IsSelected = true;
            }
            else
            {
                PrintProjectsPage.IsSelected = true;
            }
        }
        finally
        {
            MainSplitView.UseAnimations = true;
        }
    }