Beispiel #1
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            // After the mainform has become visible, we do 3 things:
            // (1) Load UserSettings from disk.
            // (2) If (1) didn't succeed, then generate default UserSettings + open the Settings Edit box for folder review and/or customization.
            // (3) Scan project folders based on the UserSettings.

            UserSettings = JsonFileHelper.Load <UserSettings>(UserHomePath, UserSettingsFilename, reporter: this);
            if (UserSettings == null)
            {
                UserSettings = new UserSettings(GetDefaultFolders().ToArray());
                EditUserSettings("Default folder list was created, please review or customize", hideCancelButton: true); // This will call LoadProjectFolders() as a result of only being able to click OK
            }
            else
            {
                LoadProjectFolders();
            }

            // If we want to force the user to fix their folders until LoadProjectFolders() produces no more errors, then we can do this:
            //while (HasError())
            //{
            //    EditUserSettings("One or more folders are incorrect, please fix", hideCancel: true); // This will call LoadProjectFolders() as a result of only being able to click OK
            //}
        }