Esempio n. 1
0
        private void SetCustomWindowState(CustomWindowStates newWindowState, CustomWindowStates oldWindowState)
        {
            Debug.WriteLine("SetCustomWindowState: begin");

            this.customWindowStateChanging.Set();
            try
            {
                if (newWindowState == CustomWindowStates.FullScreen)
                {
                    // フルスクリーン
                    ChangeToFullScreen();
                }
                else
                {
                    if (oldWindowState == CustomWindowStates.FullScreen)
                    {
                        RestoreFromFullScreen();
                    }

                    if (newWindowState == CustomWindowStates.Normal)
                    {
                        // 通常ウィンドウ
                        this.WindowState = WindowState.Normal;
                        VisualStateManager.GoToElementState(this, "Normal", true);
                    }
                    else if (newWindowState == CustomWindowStates.Minimized)
                    {
                        // 最小化
                        this.WindowState = WindowState.Minimized;
                        VisualStateManager.GoToElementState(this, "Minimized", true);
                    }
                    else if (newWindowState == CustomWindowStates.Maximized)
                    {
                        // 最大化
                        this.WindowState = WindowState.Maximized;
                        VisualStateManager.GoToElementState(this, "Maximized", true);
                    }
                }
            }
            finally
            {
                this.customWindowStateChanging.Reset();
            }

            Debug.WriteLine("SetCustomWindowState: end");
        }
        private void ChangeMainWindowState(CustomWindowStates s)
        {
            if (s == CustomWindowStates.Syncing)
            {
                // show the cancel button
                _cancelSyncButton.IsEnabled  = true;
                _cancelSyncButton.Visibility = Visibility.Visible;

                // disable token related stuff just in case
                _accountComboBox.IsEnabled   = false;
                _refreshServerList.IsEnabled = false;

                // disable folder grid navigation
                _folderStackPanel.IsEnabled = false;
                _folderStackPanel.Opacity   = 0.5;
            }
            else if (s == CustomWindowStates.AfterSyncing)
            {
                // hide the cancel button
                _cancelSyncButton.IsEnabled  = false;
                _cancelSyncButton.Visibility = Visibility.Hidden;

                // re-enable token related stuff
                _accountComboBox.IsEnabled   = true;
                _refreshServerList.IsEnabled = true;

                // enable folder grid navigation again
                _folderStackPanel.IsEnabled = true;
                _folderStackPanel.Opacity   = 1;

                // fix stuff that syncing process changed
                myTray.tbi.ToolTipText = "Discord Image Sync";
                _progressBar.Value     = 0;
                _bgImage.Source        = null;
                _cancelFlag            = false;
                myTray.EnableSyncButtons();
            }
        }
 public CustomWindowStateEventArgs(CustomWindowStates newWindowState, CustomWindowStates oldWindowState)
 {
     this.NewWindowState = newWindowState;
     this.OldWindowState = oldWindowState;
 }