public void SaveDistribution(List <Distribution> distribs) { foreach (DataRow drd in distribution.Rows) //Поиск удалённых распределений { bool found = false; foreach (Distribution dst in distribs) { if (dst.Id == drd.Field <long>("id")) { found = true; break; } } if (!found) { drd.Delete(); } } foreach (Distribution newDistr in distribs) { if (newDistr.Id == -1) { DataRow newDistribution = distribution.NewRow(); newDistribution["computerID"] = newDistr.ComputerID; newDistribution["userID"] = newDistr.UserID; distribution.Rows.Add(newDistribution); } } dbHelper.Save(); DataUpdate?.Invoke(); }
public void HandlePrintUpdate(object src, EventArgs e, string s) { // process print string Current.ProcessPrintStr(s); if (!Current.NewPrint) { return; } int i0; // update timeseries data objects for (i0 = 0; i0 < TimeSeries.Count; ++i0) { TimeSeries[i0].NewData(Current.Print); } for (i0 = 0; i0 < OHLC.Count; ++i0) { OHLC[i0].NewData(Current.Print); } for (i0 = 0; i0 < Volume.Count; ++i0) { Volume[i0].NewData(Current.Print); } // update timeframe analytics TFAnalytics.NewData(Current.Print); // call data update event DataUpdate?.Invoke(this, EventArgs.Empty); }
protected void OnDataUpdate(object source, CryptoIdDataUpdateEventArgs args) { if (DataUpdate != null) { DataUpdate.Invoke(source, args); } }
public void RunModel() { var importData = Task.Factory.StartNew(() => { GetInstall(); DataUpdate?.Invoke(); }); }
public void Start() { core.DataUpdate += Core_DataUpdate; var firstLaunch = Task.Factory.StartNew(() => { GetUsers(); GetSoftware(); GetComputers(); GetDivision(); GetUserNoComp(); DataUpdate?.Invoke(); }); }
public void SaveUpdate(List <long> ids) { if (ids.Count > 0) { long softID = install.Rows.Find(ids[0]).Field <long>("softID"); string version = software.Rows.Find(softID).Field <string>("version"); foreach (long id in ids) { DataRow upRow = install.Rows.Find(id); upRow["version"] = version; } Save(); DataUpdate?.Invoke(); } }
public void Save() { try { dbHelper.Save(); dbHelper.Reload(); foreach (DataTable dt in mainDS.Tables) { dt.AcceptChanges(); } DataUpdate?.Invoke(); } catch (Exception e) { onError?.Invoke(new ErrorArgs("Сохранение в БД", e.Message)); } }
public MainDataProvider(int second) { updateSpan = TimeSpan.FromSeconds(second); updateTimer = ThreadPoolTimer.CreatePeriodicTimer(async(source) => { if (this.wanInfo == null) { this.wanInfo = await RouterAPI.GetWANinfo(); } this.netRate = await RouterAPI.GetNetRate(); this.cpuMemInfo = await RouterAPI.GetCpuMemInfo(); this.clients = await RouterAPI.GetClients(); this.devRate = await RouterAPI.GetDeviceRate(); this.banList = await RouterAPI.FireWall.GetBanList(); this.qosRuleList = await RouterAPI.GetQosRuleList(); if (this.wlanInfo == null) { this.wlanInfo = await RouterAPI.GetWLANInfo(); } DataUpdate?.Invoke(); }, updateSpan); }
public void SaveInstall(List <Install> installs) { foreach (Install inst in installs) { long compID = FindCompID(inst.NsName); UnInstall(compID, inst.InstalledSoft); foreach (string insSoft in inst.InstalledSoft) { long softId = FindSoftID(insSoft); if (FindInstallID(compID, softId) < 0) { DataRow idr = install.NewRow(); idr["computerID"] = compID; idr["softID"] = softId; idr["version"] = software.Select($"id = {softId}").First().Field <string>("version"); install.Rows.Add(idr); } } } dbHelper.UpdateInstall(); dbHelper.Reload(); DataUpdate?.Invoke(); }
private void Core_DataUpdate1() { DataUpdate?.Invoke(); }