/// <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());
         }
     }));
 }
Пример #2
0
 public InfoChangeValueEv(string v, XmlReader reader, InfoChangeEvents infoEvent) : base(infoEvent)
 {
     Value     = v;
     GroupPath = reader.GetAttribute(XmlGroupPath);
 }
Пример #3
0
 public InfoChangeValueEv(string value, string groupPath, InfoChangeEvents ice)
     : base(ice)
 {
     Value     = value;
     GroupPath = groupPath;
 }
Пример #4
0
 public InfoChangeEvents(InfoChangeEvents ice)
 {
     this.Path = ice.Path;
     this.Time = ice.Time;
 }