/// <summary> /// Invoke the whole backup process - get sources, discover files, copy to destination /// </summary> static public void InvokeBackup() { try { BackupStarted?.Invoke(); //while (!cts.IsCancellationRequested) //{ // Thread.Sleep(1000); // Debug.WriteLine("WORKING"); //} //Debug.WriteLine("COMPLETE"); //isWorking = false; //return; var sources = GetSources(); var files = DiscoverFiles(sources); SaveDiscoveredFiles(files); CopyFiles(); UpdateTimestamp(sources); BackupCompleted?.Invoke(); } catch (Exception ex) { Debug.WriteLine(ex.Message); BackupError?.Invoke(ex.Message); } }
/// <summary> /// Invoke backup of the discovered files list, possibly modified by user /// </summary> static public void InvokeBackupFromUser() { try { BackupStarted?.Invoke(); CopyFiles(); UpdateTimestamp(GetSources()); BackupCompleted?.Invoke(); } catch (Exception ex) { Debug.WriteLine(ex.Message); BackupError?.Invoke(ex.Message); } }