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

            ServiceInjector.InjectServices();

            _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);
            };
        }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();

            InitializeSprocketControls();

            _brushes = new Brush[] {
                new SolidColorBrush((Color)ColorConverter.ConvertFromString("#4cd964")),
                new SolidColorBrush((Color)ColorConverter.ConvertFromString("#007aff")),
                new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ff9600")),
                new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ff2d55")),
                new SolidColorBrush((Color)ColorConverter.ConvertFromString("#5856d6")),
                new SolidColorBrush((Color)ColorConverter.ConvertFromString("#ffcc00")),
                new SolidColorBrush((Color)ColorConverter.ConvertFromString("#8e8e93")),
            };

            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(SprocketButton, isNarrowMenu);
                ToolTipService.SetIsEnabled(ToggleSwitchButton, isNarrowMenu);
                ToolTipService.SetIsEnabled(FWPButton, isNarrowMenu);
                ToolTipService.SetIsEnabled(SparkWindowButton, isNarrowMenu);
                ToolTipService.SetIsEnabled(FPPButton, isNarrowMenu);
                ToolTipService.SetIsEnabled(FPBButton, isNarrowMenu);
                ToolTipService.SetIsEnabled(FSBButton, isNarrowMenu);
            };

            Loaded += (s, e) =>
            {
                DataContext = this;
                SprocketButton.IsChecked  = true;
                OrientationCB.ItemsSource = new List <string> {
                    "Horizontal", "Vertical"
                };
                OrientationCB.SelectedIndex = 0;
            };

            InitializeFluidPivotPanel();

            InitializeFluidProgressBars();
        }