예제 #1
0
        private void Initialize()
        {
            // Show the window in normal state
            WindowState = WindowState.Normal;

            _coreViewModel = new CoreViewModel();
            DataContext = _coreViewModel;
            _coreViewModel.InitializeEnvironmentVariables();

            switch (_coreViewModel.InitResult)
            {
                case InitResultType.InitOk:
                    break;
                case InitResultType.AccessDenied:
                    MessageBox.Show("Cannot access Environment variables! Please restart NVM# as an Administrator.", "NVM#");
                    Application.Current.Shutdown();
                    break;
                case InitResultType.OtherError:
                    MessageBox.Show("NVM# encountered an error and needs to close!", "NVM#");
                    Application.Current.Shutdown();
                    break;
            }

            UserButton.IsChecked = true;

            SizeChanged += (o, a) =>
            {
                switch (WindowState)
                {
                    case WindowState.Maximized:
                        SplitViewMenu.Width = (int)SplitViewMenuWidth.Wide;
                        break;

                    case WindowState.Normal:
                        SplitViewMenu.Width = (int)SplitViewMenuWidth.Narrow;
                        break;
                }

                RootGrid.ColumnDefinitions[0] = new ColumnDefinition { Width = new GridLength(SplitViewMenu.Width) };
                RootGrid.InvalidateVisual();
            };

            // Enable the tooltip for SplitView menu buttons only if the SplitView width is narrow
            SplitViewMenu.SizeChanged += (o, a) =>
                                         {
                                             var isNarrowMenu = (int) SplitViewMenu.Width == (int) SplitViewMenuWidth.Narrow;
                                             ToolTipService.SetIsEnabled(UserButton, isNarrowMenu);
                                             ToolTipService.SetIsEnabled(SystemButton, isNarrowMenu);
                                             ToolTipService.SetIsEnabled(ImportButton, isNarrowMenu);
                                             ToolTipService.SetIsEnabled(ExportButton, isNarrowMenu);
                                             ToolTipService.SetIsEnabled(AboutButton, isNarrowMenu);
                                         };
        }
예제 #2
0
        private void Initialize()
        {
            // Show the Windows in maximized state
            WindowState = WindowState.Maximized;
            _coreViewModel = new CoreViewModel();
            DataContext = _coreViewModel;
            _coreViewModel.InitializeEnvironmentVariables();
            switch (_coreViewModel.InitResult)
            {
                case InitResultType.InitOk:
                    break;
                case InitResultType.AccessDenied:
                    MessageBox.Show("Cannot access Environment variables! Please restart NVM# as an Administrator.", "NVM#");
                    Application.Current.Shutdown();
                    break;
                case InitResultType.OtherError:
                    MessageBox.Show("NVM# encountered an error and needs to close!", "NVM#");
                    Application.Current.Shutdown();
                    break;
            }

            UserButton.IsChecked = true;
        }