public void AddBindingList(BindingList <T> list) { list.AddingNew += _OnAddingNew; list.ListChanged += _OnListChanged; _sources.Add(list); ListChanged?.Invoke(this, new ListChangedEventArgs(ListChangedType.Reset, 0)); }
private void raiseListElementsAdded(int index, int length) { if (null != ListChanged) { ListChanged.Invoke(this, new ListChangedEventArgs(ListChangedEventType.ItemsInserted, index, length, null)); } }
private void ValuesChanged() { if (ListChanged != null) { ListChanged.Invoke(this, null); } }
private void raiseListElementsRemoved(int index, int length, ArrayList removedItems) { if (null != ListChanged) { ListChanged.Invoke(this, new ListChangedEventArgs(ListChangedEventType.ItemsRemoved, index, length, removedItems)); } }
/// <summary> /// 修改单个信号设置信息 /// </summary> /// <param name="name">原信号名称</param> /// <param name="changesetting">修改后的信号设置信息</param> /// <returns></returns> public static bool ChangeValue(string name, OneListSetting changesetting) { var onesetting = _Settings.Find((x) => x.SignalName == name); if (onesetting == null) { cards[onesetting.OneCardSetting.cardname.Value].DelChannel(onesetting.OneCardSetting.channel.channel.Value); CardSettingError.RaiseError(001); return(false); } // setting修改 onesetting = changesetting; // 采集卡修改 cards[changesetting.OneCardSetting.cardname.Value].SetSamplerate(changesetting.OneCardSetting.channel.channel.Value, changesetting.OneCardSetting.samplerate); cards[changesetting.OneCardSetting.cardname.Value].SetValuesRange(changesetting.OneCardSetting.channel.channel.Value, changesetting.OneCardSetting.range.Value); // 数据库修改 var info = CollectDataSet.GetSignal(name); SignalInfo new_info = new SignalInfo(); new_info.cardname = changesetting.OneCardSetting.cardname.Value; new_info.name = changesetting.SignalName; new_info.position = changesetting.SensorPosition; new_info.resolution = (ushort)cards[changesetting.OneCardSetting.cardname.Value].GetResolution(); new_info.sensortype = changesetting.SensorType; new_info.signalrange = changesetting.OneCardSetting.range.Value; new_info.detectequipment = changesetting.DetectEquipment; new_info.resolutiondouble = cards[changesetting.OneCardSetting.cardname.Value].GetDoubleResolution(changesetting.OneCardSetting.range.Value, out new_info.basevalue); CollectDataSet.ChgSignal(info, new_info); ListChanged?.Invoke("Chg", changesetting); return(true); }
public void ReList() { content.Items.Clear(); foreach (DirectoryInfo directory in History[hIndex].GetDirectories()) { content.Items.Add(new ListViewItem(new[] { directory.Name, ".dir", "" }) { Font = new Font(FontFamily.GenericSansSerif, 10F) }); } foreach (FileInfo file in History[hIndex].GetFiles()) { content.Items.Add(new ListViewItem(new[] { file.Name, file.Extension, Math.Round((double)file.Length / 1048576, 2).ToString() }) { Font = new Font(FontFamily.GenericSansSerif, 10F) }); } ListChanged.Invoke(this, EventArgs.Empty); }
private void timer1_Tick(object sender, EventArgs e) { bEventsChanged = (oldcntev != wle.Events.Count()); if (cntdone >= 4) { cntdone = 0; ThreadPool.QueueUserWorkItem(new WaitCallback(shardStatus)); ThreadPool.QueueUserWorkItem(new WaitCallback(loadEvents)); ThreadPool.QueueUserWorkItem(new WaitCallback(loadLeaderboards)); ThreadPool.QueueUserWorkItem(new WaitCallback(loadPersonas)); wle.LastUpdate = DateTime.Now; } label1.Text = "worldLeaderboardEvents:" + wle.Events.Count() + "" + (bEventsChanged ? "!+" + (wle.Events.Count() - oldcntev) : ""); oldcntev = wle.Events.Count(); bool bLeaderboardChanged = oldcntlb != wllist.Count(); label2.Text = "worldLeaderboardsList:" + wllist.Count() + "" + (oldcntlb != wllist.Count() ? "!+" + (wllist.Count() - oldcntlb) : ""); oldcntlb = wllist.Count(); label3.Text = "lastupdate:" + wle.LastUpdate.ToString("yyyy-MM-dd HH:mm:ss"); if (bEventsChanged || bLeaderboardChanged) { if (ListChanged != null) { ListChanged.Invoke(null, new ListChangeEventArgs(wle, wllist, drivers)); } } }
/// <summary> /// 添加单行信号设置 /// </summary> /// <param name="onesetting">单个信号设置</param> /// <returns>是否添加成功</returns> public static bool AddSetting(OneListSetting onesetting) { // setting添加 _Settings.Add(onesetting); // 采集卡进行设置采样频率以及电信号范围 cards[onesetting.OneCardSetting.cardname.Value].SetSamplerate(onesetting.OneCardSetting.channel.channel.Value, onesetting.OneCardSetting.samplerate); cards[onesetting.OneCardSetting.cardname.Value].SetValuesRange(onesetting.OneCardSetting.channel.channel.Value, onesetting.OneCardSetting.range.Value); // 将该行信号设置添加到数据库母表,并建立对应子表 SignalInfo info = new SignalInfo(); info.cardname = onesetting.OneCardSetting.cardname.Value; info.name = onesetting.SignalName; info.position = onesetting.SensorPosition; info.resolution = (ushort)cards[onesetting.OneCardSetting.cardname.Value].GetResolution(); info.sensortype = onesetting.SensorType; info.signalrange = onesetting.OneCardSetting.range.Value; info.detectequipment = onesetting.DetectEquipment; info.resolutiondouble = cards[onesetting.OneCardSetting.cardname.Value].GetDoubleResolution(onesetting.OneCardSetting.range.Value, out info.basevalue); CollectDataSet.AddSignal(info); // 事件 ListChanged?.Invoke("Add", onesetting); return(true); }
public bool Remove(T item) { bool result = collection.Remove(item); ListChanged?.Invoke(this, new PropertyChangedEventArgs("List")); return(result); }
private void raiseListElementReplaced(int index, ArrayList removedItems) { if (null != ListChanged) { ListChanged.Invoke(this, new ListChangedEventArgs(ListChangedEventType.ItemReplaced, index, 1, removedItems)); } }
public void RemoveSort() { IsSorted = false; SortProperty = null; SortDirection = ListSortDirection.Ascending; ListChanged?.Invoke(this, new ListChangedEventArgs(ListChangedType.Reset, -1)); }
public bool Remove(PedData item) { bool remove = peds.Remove(item); ListChanged?.Invoke(this); return(remove); }
public void Undo() { if (StoryIndex < 0) { return; } var act = Story[StoryIndex]; switch (act.Type) { case StoryAction.Changed: Data[act.Index] = act.Value[0]; break; case StoryAction.Created: Data.RemoveAt(act.Index); break; case StoryAction.Removed: Data.Insert(act.Index, act.Value[0]); break; } StoryIndex--; if (act.Type == StoryAction.Created) { act.Type = StoryAction.Removed; } else if (act.Type == StoryAction.Removed) { act.Type = StoryAction.Created; } ListChanged?.Invoke(this, new StoryEventArgs(act.Index, act.Type)); if (StoryIndex >= 0 && Story[StoryIndex].Link) { Undo(); } }
public void Add(WorkTaskDto entity) { _ctx.WorkTasks.Add((WorkTask)entity); ListChanged?.Invoke(); _ctx.Save(); }
public void Add(WorkTimeRangeDto entity) { _ctx.WorkTimeRanges?.Add((WorkTimeRange)entity); ListChanged?.Invoke(); _ctx.Save(); }
public void Remove(int id) { _ctx.WorkTimeRanges?.Remove(id); ListChanged?.Invoke(); _ctx.Save(); }
public void Add(WorkProjectDto entity) { _ctx.WorkProjects.Add((WorkProject)entity); ListChanged?.Invoke(); _ctx.Save(); }
public void Remove(int id) { _ctx.WorkProjects.Remove(id); ListChanged?.Invoke(); _ctx.Save(); }
public void RemoveAt(int index) { TrimStory(); StoryIndex++; Story.Add(new Event(StoryAction.Removed, index, Data[index])); Data.RemoveAt(index); ListChanged?.Invoke(this, new StoryEventArgs(index, StoryAction.Removed)); }
public void Insert(int index, T item) { TrimStory(); StoryIndex++; Story.Add(new Event(StoryAction.Created, index, item)); Data.Insert(index, item); ListChanged?.Invoke(this, new StoryEventArgs(index, StoryAction.Created)); }
public T this[int index] { get { return(collection[index]); } set { collection[index] = value; ListChanged?.Invoke(this, new PropertyChangedEventArgs("List")); } }
public void Remove(int id) { _ctx.Bills.Remove(id); ListChanged?.Invoke(); _ctx.Save(); BillLoaded?.Invoke(); }
private void ObservableCollectionOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Remove) { Enumerable.Range(e.OldStartingIndex, e.OldItems.Count).ForEach(i => ListChanged?.Invoke(this, new ListChangedEventArgs(ListChangedType.ItemDeleted, i))); } else if (e.Action == NotifyCollectionChangedAction.Add) { Enumerable.Range(e.NewStartingIndex, e.NewItems.Count).ForEach(i => ListChanged?.Invoke(this, new ListChangedEventArgs(ListChangedType.ItemAdded, i))); } }
public void Insert(int index, TItem item) { if (_slave) { throw new ReadOnlyModelModifiedException(); } _list.Insert(index, item); ItemAdded?.Invoke(this, new ListPropertyChangedEventArgs <TItem>(index, item)); ListChanged?.Invoke(this, EventArgs.Empty); }
public void RemoveAt(int index) { if (_slave) { throw new ReadOnlyModelModifiedException(); } _list.RemoveAt(index); ItemRemoved?.Invoke(this, new ListPropertyChangedEventArgs <TItem>(index, default)); ListChanged?.Invoke(this, EventArgs.Empty); }
protected virtual void OnListChanged(ListChangedEventArgs e) { try { ListChanged?.Invoke(this, e); } catch (Exception f) when(Common.ADP.IsCatchableExceptionType(f)) { ExceptionBuilder.TraceExceptionWithoutRethrow(f); // ignore the exception } }
public void AddGame(string hostPath) { string title = "Error finding title", version = "also on internet"; version = webHandler.GetVersion(hostPath); title = webHandler.GetTitle(hostPath); if (GameLibrary.Instance.AddGame(title, GenerateGamePath(title), version, hostPath)) { ListChanged?.Invoke(this, EventArgs.Empty); } }
public bool Remove(T item) { int index = IndexOf(item); if (index < 0) { return(false); } Data.RemoveAt(index); ListChanged?.Invoke(this, new StoryEventArgs(index, StoryAction.Removed)); return(true); }
public void Insert(int index, object item) { if (!(item is IRemoteCommand)) { return; } var command = (IRemoteCommand)item; _commandsSettings.Add(command.GetType(), command.Id); _commands.Insert(index, command); ListChanged?.Invoke(this, new ListChangedEventArgs(ListChangedType.ItemAdded, index)); }
public int Add(object item) { if (!(item is IRemoteCommand)) { return(-1); } var command = (IRemoteCommand)item; _commands.Add(command); _commandsSettings.Add(item.GetType(), command.Id); ListChanged?.Invoke(this, new ListChangedEventArgs(ListChangedType.ItemAdded, _commands.Count - 1)); return(_commands.Count - 1); }