/// <summary> /// Take all controls of info data, select these which has changed, add to sync manager syncEvent and rewrite InfoFile /// </summary> /// <param name="editetInformations">All controls, that can be changed</param> /// <param name="file">Path of file in application data tree</param> /// <returns>Running task</returns> public Task InfoSave(Control[] editetInformations, string filePath) { SyncEvents.InfoChangeEvents eventBase = new SyncEvents.InfoChangeEvents(DateTime.Now, filePath); return(Task.Run(() => { //zkontroluje zda se neco zmenilo bool changed = false; Task <Classes.Interfaces.IInfoGetter> ig = GetPathEnd(filePath); Parallel.ForEach <Control>(editetInformations, (c) => { Item it = c.Tag as Item; if (it != null) { if (it.HasChanged(c)) { syncManager.AddGeneratedSyncEvent(new SyncEvents.InfoChangeValueEv(it.GetChangeInfoSyncString(), it.GetGroupPath(), eventBase)); changed = true; } } }); if (changed) { RewriteInfoFile(ig.Result.GetInfoFile(), ig.Result.GetInfoFilePath()); } })); }
public InfoChangeValueEv(string v, XmlReader reader, InfoChangeEvents infoEvent) : base(infoEvent) { Value = v; GroupPath = reader.GetAttribute(XmlGroupPath); }
public InfoChangeValueEv(string value, string groupPath, InfoChangeEvents ice) : base(ice) { Value = value; GroupPath = groupPath; }
public InfoChangeEvents(InfoChangeEvents ice) { this.Path = ice.Path; this.Time = ice.Time; }