protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); if (!Default.ParseArguments(e.Args, CmdOpt)) { MessageBox.Show(CmdOpt.GetUsage()); } var cfg = SettingsCfg.Load <SettingsCfg>(); if (cfg == null) { this.Shutdown(); return; } ; var view = new MainWindow(); var modl = new MainWindowVM(); view.DataContext = modl; if (!CmdOpt.StealthMode) { view.Show(); } _logr.Info("App started. (IsVisible={0})", view.IsVisible); }
//public string Label { get; } //public string FolderPath => Folder.FullName; public TargetFolderVM(SettingsCfg.Target target) { Target = target; _ui = SynchronizationContext.Current; Pending.CollectionChanged += Pending_CollectionChanged; ProcessExistingFiles(); WatchForNewFiles(); }
public void Restore() { try { string cfgPath = Path.Combine(ProgramTools.AppProductDataDir, CFG_FILE_NAME); if (File.Exists(cfgPath)) { Cfg = XmlHelper.RestoreFromXml <SettingsCfg>(cfgPath); logger.Info("Settings configuration restored."); } else { Cfg = GetDefault(); logger.Info("No settings file yet. Default Settings configuration restored."); } RegisterVariables(); } catch (Exception ex) { logger.Error("Unable to restore settings. Reason: " + ex.Message); } }