Exemple #1
0
        internal static void SetOutputState(int state)
        {
            switch (state)
            {
            default:
            case 0:
                Form.SetOutputCurrentOperation("Current Operation", Theme.GetOutputOperationColor());
                Form.SetOutputProgressBarColor(Theme.GetOutputProgressBarColor());
                Form.SetOutputCurrentPercentage(100);
                Form.SetOutputTotalPercentage(100);
                break;

            case 1:
                Form.SetOutputCurrentOperation("ERROR!", System.Drawing.Color.Red);
                Form.SetOutputProgressBarColor(MetroFramework.MetroColorStyle.Red);
                Form.SetOutputCurrentPercentage(50);
                Form.SetOutputTotalPercentage(50);
                break;

            case 2:
                Form.SetOutputCurrentOperation("SUCCESS!", System.Drawing.Color.Green);
                Form.SetOutputProgressBarColor(MetroFramework.MetroColorStyle.Green);
                Form.SetOutputCurrentPercentage(100);
                Form.SetOutputTotalPercentage(100);
                break;
            }
        }
        internal static void SetStage(StageEnum stage
#if DEBUG
                                      , bool set_debug_index = true
#endif
                                      )
        {
            switch (stage)
            {
#if DEBUG
            case StageEnum.Debug:
                Debug.SetFormStage();
                goto select;
#endif

            case StageEnum.Main:
                mainForm.Settings_RefreshReleases.Enabled   = false;
                mainForm.Automated_Text.Visible             = true;
                mainForm.Automated_Text_Failure.Visible     = false;
                mainForm.Automated_Retry.Visible            = false;
                mainForm.Automated_Divider.Visible          = false;
                mainForm.Automated_Install.Visible          = false;
                mainForm.Automated_Uninstall.Visible        = false;
                mainForm.Automated_UnityGame_Text.Visible   = false;
                mainForm.Automated_UnityGame_Select.Visible = false;
#if DEBUG
                if (set_debug_index)
                {
                    mainForm.Debug_AutomatedState.SelectedIndex = 0;
                }
                goto default;
#else
                goto main;
#endif

            case StageEnum.Automated_Failure:
                mainForm.Settings_RefreshReleases.Enabled = true;
                mainForm.Automated_Text.Visible           = false;
                mainForm.Automated_Text_Failure.Visible   = true;
                mainForm.Automated_Retry.Visible          = true;
#if DEBUG
                if (set_debug_index)
                {
                    mainForm.Debug_AutomatedState.SelectedIndex = 1;
                }
#endif
                goto default;

            case StageEnum.Automated_Success:
                mainForm.Settings_RefreshReleases.Enabled   = true;
                mainForm.Automated_Text.Visible             = false;
                mainForm.Automated_Text_Failure.Visible     = false;
                mainForm.Automated_Retry.Visible            = false;
                mainForm.Automated_Divider.Visible          = true;
                mainForm.Automated_Install.Visible          = true;
                mainForm.Automated_Uninstall.Visible        = true;
                mainForm.Automated_UnityGame_Text.Visible   = true;
                mainForm.Automated_UnityGame_Select.Visible = true;
#if DEBUG
                if (set_debug_index)
                {
                    mainForm.Debug_AutomatedState.SelectedIndex = 2;
                }
#endif
                goto default;

            case StageEnum.Output:
                SetOutputCurrentOperation("Current Operation", Theme.GetOutputOperationColor());
                SetOutputProgressBarColor(Theme.GetOutputProgressBarColor());
                SetOutputCurrentPercentage(0);
                SetOutputTotalPercentage(0);
#if DEBUG
                if (set_debug_index)
                {
                    mainForm.Debug_OutputState.SelectedIndex = 0;
                }
#endif
                goto output;

            case StageEnum.Output_Failure:
                SetOutputCurrentOperation("ERROR!", Color.Red);
                SetOutputProgressBarColor(MetroFramework.MetroColorStyle.Red);
#if DEBUG
                if (set_debug_index)
                {
                    mainForm.Debug_OutputState.SelectedIndex = 1;
                }
#endif
                goto default;

            case StageEnum.Output_Success:
                SetOutputCurrentOperation("SUCCESS!", Color.Green);
                SetOutputProgressBarColor(MetroFramework.MetroColorStyle.Green);
                SetOutputCurrentPercentage(100);
                SetOutputTotalPercentage(100);
#if DEBUG
                if (set_debug_index)
                {
                    mainForm.Debug_OutputState.SelectedIndex = 2;
                }
#endif
                goto default;

            case StageEnum.SelfUpdate:
#if DEBUG
                goto default;
#else
                mainForm.PageManager.Controls.Clear();
                mainForm.PageManager.Controls.Add(mainForm.Tab_SelfUpdate);
                goto select;

main:
                mainForm.PageManager.Controls.Clear();
                mainForm.PageManager.Controls.Add(mainForm.Tab_Automated);
                mainForm.PageManager.Controls.Add(mainForm.Tab_ManualZip);
                mainForm.PageManager.Controls.Add(mainForm.Tab_Settings);
                goto select;
#endif

output:
                mainForm.PageManager.Controls.Clear();
                mainForm.PageManager.Controls.Add(mainForm.Tab_Output);
                goto select;

select:
                mainForm.PageManager.SelectedIndex = 0;
                goto default;

            default:
                break;
            }
        }