private bool MoveEntities(string newPath) { DirectoryInfo newDir = new DirectoryInfo(newPath); if (!newDir.Exists) { ErrorLogger.Append(new Exception("Can't move Servers/Networks to not existing dir: " + newPath)); return(false); } foreach (EntityViewModel entityViewModel in Entities) { string currEntityPath = Path.Combine(App.ServerPath, entityViewModel.Entity.Name); string newEntityPath = Path.Combine(newPath, entityViewModel.Entity.Name); entityViewModel.StartImport(); new Thread(() => { //Directory.Move(currEntityPath,newEntityPath); FileImporter fileImporter = new FileImporter(); fileImporter.CopyProgressChanged += entityViewModel.CopyProgressChanged; fileImporter.DirectoryMove(currEntityPath, newEntityPath, true); Console.WriteLine("Finished moving entity files for entity " + entityViewModel.Name); entityViewModel.FinishedCopying(); }).Start(); } AppSettingsSerializer.AppSettings.ServerPath = newPath; AppSettingsSerializer.SaveSettings(); return(true); }
public Backend() { appSettings = AppSettingsSerializer.DeSerialize(); jiraConnectionSettings = JiraConnectionSettingsSerializer.DeSerialize(); jiraTimerCollection = new JiraTimerCollection(); idleTimerCollection = new IdleTimerCollection(); ActivityChecker = new ActivityChecker(jiraTimerCollection, appSettings); ActivityChecker.NoActivityEvent += OnNoActivityEvent; hearbeat = new Timer(3600000); hearbeat.Elapsed += HearbeatOnElapsed; hearbeat.Start(); }
public async Task <bool> SaveAppSettingsAsync() { Task <bool> t = new Task <bool>(() => { try { AppSettingsSerializer.SaveSettings(); return(true); } catch (Exception e) { ErrorLogger.Append(e); return(false); } }); t.Start(); bool r = await t; return(r); }
public async Task <bool> ReadAppSettingsAsync() { Task <bool> t = new Task <bool>(() => { try { AppSettingsSerializer.ReadSettings(); return(true); } catch (Exception e) { ErrorLogger.Append(e); return(false); } }); t.Start(); bool r = await t; RaisePropertyChanged(this, new PropertyChangedEventArgs(nameof(AppSettings))); return(r); }
internal void SaveSettings() { AppSettingsSerializer.Serialize(this); }