public void OnAddFiles(object sender, FileListEventArgs e) { foreach (var file in e.Files) { var newTarget = new CopyTarget() { SrcFilePath = file }; newTarget.RefreshTimestamp(); Targets.Add(newTarget); } }
public bool LoadFromFile(string path) { var polling = m_polling.IsRunning; m_polling.Stop(); Data data = null; try { using (var reader = new StreamReader(path)) { var json = reader.ReadToEnd(); data = JsonConvert.DeserializeObject <Data>(json); } } catch (Exception) { return(false); } if (data == null) { return(false); } TargetRootPath = data.TargetRootPath; Targets.Clear(); foreach (var target in data.CopyTargets) { var newTarget = new CopyTarget() { SrcFilePath = target.Src, DstFilePath = target.Dst }; newTarget.RefreshTimestamp(); Targets.Add(newTarget); } if (polling) { m_polling.Start(); } return(true); }