Exemplo n.º 1
0
        private void InitializeAppData()
        {
            //deserialize application data
            Servers = new BetterObservableCollection <Server>(ServerDataManager.LoadData());
            Backups = new BetterObservableCollection <Backup>(BackupDataManager.LoadData());

            //associate servers/backups with one another based on ID's
            AssociateCollections();

            //add event listeners to save each time server collection changes.
            Servers.CollectionChanged += PersistantData_Changed;
            Backups.CollectionChanged += PersistantData_Changed;
        }
Exemplo n.º 2
0
 private void OnFileChanged(object sender, System.IO.FileSystemEventArgs e)
 {
     if (e.FullPath == DataManager.ServersFilePath)
     {
         //update servers
         ModalMessage("resettings backup timers");
         List <Server> servers = ServerDataManager.LoadData();
         InitBackupTimers(servers);
     }
     else if (e.FullPath == DataManager.BackupsFilePath)
     {
         //update backups? probably not necessary
         ModalMessage("updating backups?");
     }
 }
Exemplo n.º 3
0
        protected override void OnStart(string[] args)
        {
            System.Diagnostics.Debugger.Launch();

            DataManager.InitializeSettings(); //init settings in case the service runs before the desktop app

            //load in current servers and backups
            List <Server> servers = ServerDataManager.LoadData();
            List <Backup> backups = BackupDataManager.LoadData();

            //Set up file watcher
            InitFileWatcher();

            //set up timers based on servers
            InitBackupTimers(servers);
        }