Exemplo n.º 1
0
        public static Settings Load(DelegateManager delegateManager)
        {
            delegateManager.AddResult(Result.NewInfo("Loading Settings...."));

            Settings settings = null;

            if (System.IO.File.Exists(SettingsXmlFile))
            {
                try
                {
                    settings = System.IO.File.ReadAllText(SettingsXmlFile).FromXML<Settings>();
                }
                catch (Exception exc)
                {
                    var backUpFileName = string.Format(SettingsXmlFileBackup, Guid.NewGuid());

                    System.IO.File.Move(SettingsXmlFileBackup, backUpFileName);

                    delegateManager.AddResult(Result.NewCritical(string.Format("Error Loading Settings: {0}. Settings file was backed up to {0}.", exc.Message, backUpFileName)));
                }
            }

            if (settings == null)
            {
                delegateManager.AddResult(Result.NewInfo("Initializing new Settings."));

                settings = new Settings(true);
            }

            delegateManager.AddResult(Result.NewInfo("Loading Settings Completed!"));

            return settings;
        }
Exemplo n.º 2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            this.statusStripProgressList = new SortedList<Guid, StatusStripProgress>();
            this.delegateManager = new DelegateManager();
            this.uiManager = new UIManager(MainDockPanel, this.delegateManager);
            this.uiManager.InitUI();
            this.settings = Local.Settings.Load(this.delegateManager);
            this.uiManager.InitSettings(this.settings);

        }