private void OnBindingListChanged(object sender, ListChangedEventArgs e) { switch (e.ListChangedType) { case ListChangedType.Reset: this.RaiseDataCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); break; case ListChangedType.ItemAdded: this.RaiseDataCollectionChanged( new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, ((IList)sender)[e.NewIndex], e.NewIndex)); break; case ListChangedType.ItemDeleted: //TODO: implement conversion this.RaiseDataCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); break; case ListChangedType.ItemMoved: this.RaiseDataCollectionChanged( new NotifyCollectionChangedEventArgs( NotifyCollectionChangedAction.Move, ((IList)sender)[e.NewIndex], e.NewIndex, e.OldIndex)); break; case ListChangedType.ItemChanged: //TODO: implement conversion this.RaiseDataCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); break; case ListChangedType.PropertyDescriptorAdded: break; case ListChangedType.PropertyDescriptorDeleted: break; case ListChangedType.PropertyDescriptorChanged: break; default: throw new ArgumentOutOfRangeException(); } }
public void Ctor_ListChangedType_NewIndex_OldIndex() { ListChangedEventArgs e = new ListChangedEventArgs (ListChangedType.ItemMoved, 1, 2); Assert.AreEqual (ListChangedType.ItemMoved, e.ListChangedType); Assert.AreEqual (1, e.NewIndex); Assert.AreEqual (2, e.OldIndex); }
private void bindingSourceProfiles_ListChanged(object sender, ListChangedEventArgs e) { button4.Enabled = bindingSourceProfiles.Current != null; btnNewVariable.Enabled = bindingSourceProfiles.Current != null; btnEditVariable.Enabled = bindingSourceProfiles.Current != null; btnDeleteVariable.Enabled = bindingSourceProfiles.Current != null; }
void DataSource_ListChanged(object sender, ListChangedEventArgs e) { switch (e.ListChangedType) { case ListChangedType.ItemAdded: { vScrollBar.Value = 0; Twitter.Status newTweet = DataSource[e.NewIndex]; TweetPane newPane = new TweetPane(newTweet); newPane.Location = new Point(0, 0); newPane.Size = new Size(panelTweetPanels.Width, 140); newPane.Visible = true; foreach (var item in Panes) item.Location = new Point(item.Location.X, item.Location.Y + 140); Panes.Add(newPane); panelTweetPanels.Controls.Add(newPane); vScrollBar.Maximum = Panes.Count * 140; newPane.Reply += new TweetReplyEventHandler(TweetPane_Reply); break; } default: break; } }
private void dataSource_ListChanged( object sender, ListChangedEventArgs e ) { switch( e.ListChangedType ) { case ListChangedType.ItemChanged: ItemChanged( e.NewIndex ); break; case ListChangedType.ItemAdded: ItemAdded( e.NewIndex ); break; case ListChangedType.ItemDeleted: ItemDeleted( e.NewIndex ); break; case ListChangedType.ItemMoved: ItemMoved( e.OldIndex, e.NewIndex ); break; case ListChangedType.Reset: ResetList(); break; } }
void Strategies_ListChanged(object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemAdded) { NotifyPropertyChanged(); } }
void Parts_ListChanged(object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemAdded) AddPart(_adapter.Parts[e.NewIndex], e.NewIndex); else if (e.ListChangedType == ListChangedType.ItemDeleted) RemovePart(e.NewIndex); }
public override void ItemClearAll() { int newIndex = -1; try { if (base.bsRepeat != null) { newIndex = base.bsRepeat.Position; base.bsRepeat.RaiseListChangedEvents = false; base.bsRepeat.SuspendBinding(); } base.Items.ClearAll(); } finally { if (base.bsRepeat != null) { base.bsRepeat.RaiseListChangedEvents = true; base.bsRepeat.ResumeBinding(); base.bsRepeat.ResetBindings(false); if (base.bsRepeat.Position == newIndex) { ListChangedEventArgs e = new ListChangedEventArgs(ListChangedType.ItemMoved, newIndex); base.bsRepeat.OnPositionChangedEx(e); } else { base.bsRepeat.Position = newIndex; } } base.lblNextpage.Text = ""; } }
public void Ctor_ListChangedType_NewIndex() { ListChangedEventArgs e = new ListChangedEventArgs (ListChangedType.ItemAdded, 0); Assert.AreEqual (ListChangedType.ItemAdded, e.ListChangedType); Assert.AreEqual (0, e.NewIndex); Assert.AreEqual (-1, e.OldIndex); }
void ListChanged(object sender, ListChangedEventArgs e) { if(Answers.Count > 0) { Type = OQuestionType.Collection; } }
private void OnPropertiesListChanged(object sender, ListChangedEventArgs e) { if (e.ListChangedType != ListChangedType.ItemAdded) return; var property = ((PropertyCollection)sender)[e.NewIndex]; if (!MustEncrypt(property)) return; property.DbType = System.Data.DbType.Binary; property.MaxLength = 8000; if (property.Entity.AmbientParameters[PassPhraseParameterName] != null) return; // create one pass phrase ambient parameter for each entity that has at least one crypt property var passPhraseParameter = new MethodParameter { Name = PassPhraseParameterName, ClrFullTypeName = "string", Nullable = CodeFluent.Model.Code.Nullable.False, Options = MethodParameterOptions.Ambient | MethodParameterOptions.Inherits | MethodParameterOptions.UsedForLoad | MethodParameterOptions.UsedForSearch | MethodParameterOptions.UsedForCount | MethodParameterOptions.UsedForRaw | MethodParameterOptions.UsedForSave, ModelName = "[" + Project.DefaultNamespace + ".PassPhrase.GetPassPhrase()]", AmbientExpression = "(1=1)" }; property.Entity.AmbientParameters.Add(passPhraseParameter); }
void Boats_ListChanged(object sender, ListChangedEventArgs e) { if (e != null) { OnPropertyChanged("Boats"); } }
private void approvedBindingSource_ListChanged(object sender, ListChangedEventArgs e) { if (inited) { PluginSettings.Default.Quotes = new ArrayList(approvedBindingSource.List); PluginSettings.Default.UnapprovedQuotes = new ArrayList(pendingBindingSource.List); PluginSettings.Default.Save(); } }
void Members_ListChanged(object sender, ListChangedEventArgs e) { if (e != null) { SaveMembers(); } }
void Items_ListChanged(object sender, ListChangedEventArgs e) { // find at what point the BindingSources changed int from = 0; for (; from < layoutFieldPaths.Controls.Count && from < Adapter.Items.Count && ((ComboBox)layoutFieldPaths.Controls[from]).DataSource == Adapter.Items[from].Fields; from++) ; for (int i = layoutFieldPaths.Controls.Count - 1; i >= from; i--) { var cbo = (ComboBox)layoutFieldPaths.Controls[i]; cbo.SelectedIndexChanged -= cboFields_SelectedIndexChanged; layoutFieldPaths.Controls.Remove(cbo); layoutFieldPaths.RowStyles.RemoveAt(i); cbo.Dispose(); } for (int i = from; i < Adapter.Items.Count; i++) { var cbo = new ComboBox(); cbo.DropDownStyle = ComboBoxStyle.DropDownList; cbo.Anchor = AnchorStyles.Left | AnchorStyles.Right; layoutFieldPaths.RowStyles.Add(new RowStyle(SizeType.AutoSize)); layoutFieldPaths.Controls.Add(cbo); var item = Adapter.Items[i]; cbo.DisplayMember = "DisplayName"; cbo.DataSource = item.Fields; //cbo.DataBindings.Add("SelectedItem", item, "SelectedField", false, DataSourceUpdateMode.OnPropertyChanged); cbo.SelectedItem = item.SelectedField; cbo.Tag = item; cbo.SelectedIndexChanged += cboFields_SelectedIndexChanged; } }
public DataViewTest() { _dataTable = new DataTable("itemTable"); _dc1 = new DataColumn("itemId"); _dc2 = new DataColumn("itemName"); _dc3 = new DataColumn("itemPrice"); _dc4 = new DataColumn("itemCategory"); _dataTable.Columns.Add(_dc1); _dataTable.Columns.Add(_dc2); _dataTable.Columns.Add(_dc3); _dataTable.Columns.Add(_dc4); DataRow dr; _seed = 123; _rowCount = 5; _rndm = new Random(_seed); for (int i = 1; i <= _rowCount; i++) { dr = _dataTable.NewRow(); dr["itemId"] = "item " + i; dr["itemName"] = "name " + _rndm.Next(); dr["itemPrice"] = "Rs. " + (_rndm.Next() % 1000); dr["itemCategory"] = "Cat " + ((_rndm.Next() % 10) + 1); _dataTable.Rows.Add(dr); } _dataTable.AcceptChanges(); _dataView = new DataView(_dataTable); _dataView.ListChanged += new ListChangedEventHandler(OnListChanged); _listChangedArgs = null; }
private void bsMalzeme_ListChanged(object sender, ListChangedEventArgs e) { if (dsIzleme.HasChanges()) { degisimMalzeme = true; } }
private void Binding_ListChanged(object sender, ListChangedEventArgs e) { if (UpdateRecordCount != null) { UpdateRecordCount(this.Binding.Count); } }
private void OnListChanged(object sender, System.ComponentModel.ListChangedEventArgs args) { Console.WriteLine("ListChanged:"); Console.WriteLine("\table Type = " + args.ListChangedType); Console.WriteLine("\tOldIndex = " + args.OldIndex); Console.WriteLine("\tNewIndex = " + args.NewIndex); }
public void Ctor_ListChangedType_NewIndex_PropDesc() { PropertyDescriptor p = null; ListChangedEventArgs e = new ListChangedEventArgs (ListChangedType.ItemMoved, 2, p); Assert.AreEqual (ListChangedType.ItemMoved, e.ListChangedType); Assert.AreEqual (2, e.NewIndex); Assert.AreEqual (2, e.OldIndex); }
public void Call(object param0, System.ComponentModel.ListChangedEventArgs param1) { func.BeginPCall(); func.Push(param0); func.PushObject(param1); func.PCall(); func.EndPCall(); }
void Settings_ListChanged(object sender, ListChangedEventArgs e) { EventHandler handler = Changed; if (handler != null) { handler(this, EventArgs.Empty); } }
private void OnListChanged(Object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.Reset) { this.back.Clear(); this.forward.Clear(); } }
void _carInfos_BeforeRemove(object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemDeleted) { var item = _carInfos[e.NewIndex]; _removedCarInfos.Add(item); } }
private void usersBindingSource_ListChanged(object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemAdded || e.ListChangedType == ListChangedType.ItemChanged) { DBUser changedObj = (DBUser)userBindingSource[e.NewIndex]; changedObj.Commit(); } }
private void bindingSource_ListChanged(object sender, ListChangedEventArgs e) { Session session = bindingSource.Current as Session; if (session != null) { sessions.Remove(session); sessions.Add(session); } }
internal void IndexListChanged(ListChangedEventArgs e) { DataView dv = (DataView)_dvWeak.Target; if (dv != null) { dv.IndexListChangedInternal(e); } else { CleanUp(true); } }
private void BdsWarehouseIODetailListChanged(object sender, ListChangedEventArgs e) { /* if (e.ListChangedType == ListChangedType.ItemAdded) { MessageBox.Show("Xin chào"); } */ }
protected void ListSource_ListChanged(object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemAdded) { GridView.FocusedRowHandle = e.NewIndex; ForceEditMode(); } }
private void OnIncomesListChanged(object sender, ListChangedEventArgs listChangedEventArgs) { if (listChangedEventArgs.ListChangedType == ListChangedType.ItemAdded) { this.IncomesListScrollViewer.ScrollToBottom(); int count = this.Incomes.Items.Count == 0 ? 0 : this.Incomes.Items.Count - 1; this.Incomes.SelectedIndex = count; } }
private void BdsFigureDetailListChanged(object sender, ListChangedEventArgs e) { if (e.ListChangedType == ListChangedType.ItemAdded) { var source = (BindingSource)sender; var item = source.List[e.NewIndex] as FigureDetail; //item.MedicineId = source.List.Count; //item.Day = this.Day; } }
private void HandleLayersListChanged(object sender, ListChangedEventArgs e) { using (var m = _map.Clone()) { m.DisposeLayersOnDispose = false; m.Size = new Size(24, 24); m.ZoomToExtents(); _mapSymbol = m.GetMap(); MyExtent = GeoAPI.Geometries.GeometryConverter.ToDotSpatial(m.GetExtents()); } }
void _flex_AfterDataRefresh(object sender, System.ComponentModel.ListChangedEventArgs e) { int cnt = _flex.Rows.Count - _flex.Rows.Fixed; _status.Text = cnt.ToString() + " rows in data source"; }
void _grid_AfterDataRefresh(object sender, System.ComponentModel.ListChangedEventArgs e) { UpdateScrollbar(); }
void _list_ListChanged(object sender, ListChangedEventArgs e) { membersLabel.Text = String.Format("Members ({0} in total):", _list.Count); }
void StatusBar_AfterDataRefresh(object sender, System.ComponentModel.ListChangedEventArgs e) { int cnt = grfStf.Rows.Count - grfStf.Rows.Fixed; sB.Text = cnt.ToString() + " rows in data source"; }
private void Child_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (this.RaiseListChangedEvents) { if (sender == null || e == null || string.IsNullOrEmpty(e.PropertyName)) { // Fire reset event (per INotifyPropertyChanged spec) ResetBindings(); } else { // The change event is broken should someone pass an item to us that is not // of type T. Still, if they do so, detect it and ignore. It is an incorrect // and rare enough occurrence that we do not want to slow the mainline path // with "is" checks. T item; try { item = (T)sender; } catch (InvalidCastException) { ResetBindings(); return; } // Find the position of the item. This should never be -1. If it is, // somehow the item has been removed from our list without our knowledge. int pos = _lastChangeIndex; if (pos < 0 || pos >= Count || !this[pos].Equals(item)) { pos = this.IndexOf(item); _lastChangeIndex = pos; } if (pos == -1) { Debug.Fail("Item is no longer in our list but we are still getting change notifications."); UnhookPropertyChanged(item); ResetBindings(); } else { // Get the property descriptor if (null == _itemTypeProperties) { // Get Shape _itemTypeProperties = TypeDescriptor.GetProperties(typeof(T)); Debug.Assert(_itemTypeProperties != null); } PropertyDescriptor pd = _itemTypeProperties.Find(e.PropertyName, true); // Create event args. If there was no matching property descriptor, // we raise the list changed anyway. ListChangedEventArgs args = new ListChangedEventArgs(ListChangedType.ItemChanged, pos, pd); // Fire the ItemChanged event OnListChanged(args); } } } }
private void TeachersSubjectsListBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) { }
private void _list_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e) { if (CoreListChanged != null) { CoreListChanged(sender, e); } ListChangedEventArgs args = e; int i = 0; switch (e.ListChangedType) { case ListChangedType.ItemAdded: if (IsFilteredOrSorted()) { if (_filter == null || _filter((T)_list[e.NewIndex])) { args = null; while (i < _filterIds.Count) { if (_filterIds[i] >= e.NewIndex) { if (args == null) { _filterIds.Insert(i, e.NewIndex); args = new ListChangedEventArgs(ListChangedType.ItemAdded, i); } else { _filterIds[i] += 1; } } i += 1; } if (args == null) { _filterIds.Add(e.NewIndex); args = new ListChangedEventArgs(ListChangedType.ItemAdded, _filterIds.Count - 1); } } else { return; } } break; case ListChangedType.ItemDeleted: if (_filterIds.Count > 0) { args = null; while (i < _filterIds.Count) { if (_filterIds[i] == e.NewIndex) { _filterIds.RemoveAt(i); args = new ListChangedEventArgs(ListChangedType.ItemDeleted, i); } else { if (_filterIds[i] > e.NewIndex) { _filterIds[i] -= 1; } i += 1; } } if (args == null) { return; } } break; case ListChangedType.ItemChanged: if (_filter != null) { //Rebuild the index because the item might have its filter status changed as a result of the property change var currIndex = _filterIds.IndexOf(e.NewIndex); if ((currIndex >= 0) ^ _filter((T)_list[e.NewIndex])) { RebuildIndexWithoutEvents(); var newIndex = _filterIds.IndexOf(e.NewIndex); if (currIndex != newIndex) { args = new ListChangedEventArgs(ListChangedType.Reset, -1); } else if (currIndex == -1) { //Item not shown, so suppress the message return; } else { args = new ListChangedEventArgs(ListChangedType.ItemChanged, currIndex, e.PropertyDescriptor); } } else { return; } } break; case ListChangedType.Reset: RebuildIndexWithoutEvents(); break; } FireListChanged(args); }
// update sql query when any of the QueryFields change private void _flex_AfterDataRefresh(object sender, System.ComponentModel.ListChangedEventArgs e) { _txtSql.Text = _qb.Sql; }