Beispiel #1
0
        private void RefreshStoresBT_Click(object sender, EventArgs e)
        {
            if (Refresh_Complete)
            {
                Refresh_Complete = false;

                string currStore = StoreLocationCB.SelectedItem.ToString();

                this.Cursor = Cursors.WaitCursor;

                MainStatusSSL.Text = "Refreshing ...";

                // Need to rescan the current store for any new repos
                if (ManagerData.Selected_Store != null || !(string.IsNullOrEmpty(StoreLocationCB.SelectedItem.ToString()) && string.IsNullOrWhiteSpace(StoreLocationCB.SelectedItem.ToString())))
                {
                    if (RepoHelpers.Detect_Changes(false))
                    {
                        Configuration.Helpers.Serialize_Condensed_All(Properties.Settings.Default.ConfigPath);
                        Refresh_Elements(false);
                        MainStatusSSL.Text = "Refresh Complete - Changes Were Applied";
                    }

                    else
                    {
                        // If a new repo was added, it needs to have an initial commit otherwise it will not be detected
                        MainStatusSSL.Text = "Refresh Complete - No Changes Detected";
                    }

                    this.Cursor = Cursors.Default;
                }

                Refresh_Complete = true;

                StoreLocationCB.SelectedIndex = StoreLocationCB.FindStringExact(currStore);
            }
        }
        private void InitializationViewFRM_Load(object sender, EventArgs e)
        {
            VerifyConfigCheckPB.Image = Properties.Resources.ConfigCheck_Default;
            ReadConfigPB.Image        = Properties.Resources.ConfigCheck_Default;
            ChangesPB.Image           = Properties.Resources.ConfigCheck_Default;

            bool retry = true;

            while (retry)
            {
                retry = false;

                if (Config_Is_Empty_Path())
                {
                    if (!CreateConfig_Empty_Path(false))
                    {
                        if (!CreateConfig_Empty_Path(true))
                        {
                            MessageBox.Show("A configuration file is required, closing GIT Manager.", "Empty Configuration File Path", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Application.ExitThread();
                            Application.Exit();
                            Environment.Exit(0);
                        }
                    }

                    retry = true;
                }

                if (!Config_Exists(Properties.Settings.Default.ConfigPath))
                {
                    if (!CreateConfig_File_DNE(false))
                    {
                        if (!CreateConfig_File_DNE(true))
                        {
                            MessageBox.Show("A configuration file is required, closing GIT Manager.", "Configuration File Does Not Exist", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Application.ExitThread();
                            Application.Exit();
                            Environment.Exit(0);
                        }
                    }

                    retry = true;
                }

                else if (!Config_Is_Valid_XML(Properties.Settings.Default.ConfigPath))
                {
                    // Config is not a valid xml file, ask for a new one
                    if (!CreateConfig_Invalid_XML(false))
                    {
                        if (!CreateConfig_Invalid_XML(true))
                        {
                            MessageBox.Show("A configuration file is required, closing GIT Manager.", "Invalid Configuration File", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Application.ExitThread();
                            Application.Exit();
                            Environment.Exit(0);
                        }
                    }

                    retry = true;
                }

                retry = false;
            }

            VerifyConfigCheckPB.BackgroundImage = Properties.Resources.ConfigCheck_Complete;

            Configuration.Helpers.Deserialize_Condensed(Properties.Settings.Default.ConfigPath);

            ReadConfigPB.BackgroundImage = Properties.Resources.ConfigCheck_Complete;

            if (RepoHelpers.Detect_Changes(true))
            {
                Configuration.Helpers.Serialize_Condensed_All(Properties.Settings.Default.ConfigPath);

                ChangesPB.BackgroundImage = Properties.Resources.ConfigCheck_Complete;
            }

            InitializationData.Initialized = true;
        }