public NotificationEvent(Notice notice = null, ListChangedEventArgs changeArguments = null)
 {
     this.Notice          = notice;
     this.ChangeArguments = changeArguments;
 }
Пример #2
0
 public void KeyBindingSourceListChanged(object sender, ListChangedEventArgs args)
 {
     _KeysChanged = true;
 }
Пример #3
0
 private void RecursosOnListChanged(object sender, ListChangedEventArgs args)
 {
     Debug.WriteLine("Cambio en lista");
 }
Пример #4
0
 /// <summary>
 /// Creates an instance of the object.
 /// </summary>
 /// <param name="childObject">
 /// Reference to the child object that was changed.
 /// </param>
 /// <param name="listArgs">
 /// ListChangedEventArgs object or null.
 /// </param>
 /// <param name="propertyArgs">
 /// PropertyChangedEventArgs object or null.
 /// </param>
 public ChildChangedEventArgs(object childObject, PropertyChangedEventArgs propertyArgs, ListChangedEventArgs listArgs)
     : this(childObject, propertyArgs)
 {
     this.ListChangedArgs = listArgs;
 }
Пример #5
0
	static void list_ListChanged (object sender, ListChangedEventArgs e) { }
 private void currencyManager_ListChanged(object sender, ListChangedEventArgs e)
 {
     this.dataConnectionState[0x20000] = true;
     try
     {
         this.ProcessListChanged(e);
     }
     finally
     {
         this.dataConnectionState[0x20000] = false;
     }
     this.owner.OnDataBindingComplete(e.ListChangedType);
     this.lastListCount = this.currencyManager.Count;
 }
Пример #7
0
        private void FootballersSource_ListChanged(object sender, ListChangedEventArgs e)
        {
            var index = Footballers.IndexOf((Footballer)FootballersSource.Current);

            ElementIndexAndCountLabel.Text = $"{index + 1}/{Footballers.Count}";
        }
Пример #8
0
 void layers_ElementRemoved(object sender, ListChangedEventArgs<Layer> args)
 {
     args.Cancel = (layers.CountNotNull() <= 1);
 }
Пример #9
0
        private void SourceChanged(
            object sender, ListChangedEventArgs e)
        {
            int    listIndex;
            int    filteredIndex = -1;
            T      newItem;
            object newKey;

            switch (e.ListChangedType)
            {
            case ListChangedType.ItemAdded:
                listIndex = e.NewIndex;
                // add new value to index
                newItem = _list[listIndex];
                if (_filterBy != null)
                {
                    newKey = _filterBy.GetValue(newItem);
                }
                else
                {
                    newKey = newItem;
                }

                //check to see if it is in the filter
                if (ItemShouldBeInList(newItem))
                {
                    _filterIndex.Add(
                        new ListItem(newKey, listIndex));
                }
                filteredIndex = _filterIndex.Count - 1;
                // raise event
                OnListChanged(
                    new ListChangedEventArgs(
                        e.ListChangedType, filteredIndex));
                break;

            case ListChangedType.ItemChanged:
                listIndex = e.NewIndex;
                // update index value
                filteredIndex = FilteredIndex(listIndex);
                if (filteredIndex != -1)
                {
                    newItem = _list[listIndex];
                    if (_filterBy != null)
                    {
                        newKey = _filterBy.GetValue(newItem);
                    }
                    else
                    {
                        newKey = newItem;
                    }
                    if (ItemShouldBeInList(newItem))
                    {
                        _filterIndex[filteredIndex] =
                            new ListItem(newKey, listIndex);
                    }
                }
                // raise event if appropriate
                if (filteredIndex > -1)
                {
                    OnListChanged(
                        new ListChangedEventArgs(
                            e.ListChangedType, filteredIndex, e.PropertyDescriptor));
                }
                break;

            case ListChangedType.ItemDeleted:
                listIndex = e.NewIndex;
                // delete corresponding item from index
                // (if any)
                filteredIndex = FilteredIndex(listIndex);
                if (filteredIndex != -1)
                {
                    _filterIndex.RemoveAt(filteredIndex);
                }
                // adjust index xref values
                foreach (ListItem item in _filterIndex)
                {
                    if (item.BaseIndex > e.NewIndex)
                    {
                        item.BaseIndex--;
                    }
                }
                // raise event if appropriate
                if (filteredIndex > -1)
                {
                    OnListChanged(
                        new ListChangedEventArgs(
                            e.ListChangedType, filteredIndex));
                }
                break;

            case ListChangedType.PropertyDescriptorAdded:
            case ListChangedType.PropertyDescriptorChanged:
            case ListChangedType.PropertyDescriptorDeleted:
                OnListChanged(e);
                break;

            default:
                BuildFilterIndex();
                //DoFilter();
                OnListChanged(
                    new ListChangedEventArgs(
                        ListChangedType.Reset, 0));
                break;
            }
        }
Пример #10
0
 /// <summary>
 /// This method is called if the data
 /// object is an IBindingList, and the
 /// ListChanged event was raised by
 /// the data object.
 /// </summary>
 protected override void DataBindingListChanged(ListChangedEventArgs e)
 {
     Refresh();
 }
Пример #11
0
 void IThreadManager.Invoke(Action <object, ListChangedEventArgs> a, object sender, ListChangedEventArgs e)
 {
     if (OwnerControl.IsHandleCreated)
     {
         OwnerControl.Invoke(a, sender, e);
     }
     else
     {
         a(sender, e);
     }
 }
Пример #12
0
 void _Games_ListChanged(object sender, ListChangedEventArgs e)
 {
 }
            private void ProcessListChanged(ListChangedEventArgs e)
            {
                if (((e.ListChangedType == ListChangedType.PropertyDescriptorAdded) || (e.ListChangedType == ListChangedType.PropertyDescriptorDeleted)) || (e.ListChangedType == ListChangedType.PropertyDescriptorChanged))
                {
                    this.dataConnectionState[2] = true;
                    try
                    {
                        this.DataSourceMetaDataChanged();
                    }
                    finally
                    {
                        this.dataConnectionState[2] = false;
                    }
                }
                else if (this.dataConnectionState[0x10000] != this.owner.AllowUserToAddRowsInternal)
                {
                    this.dataConnectionState[0x400] = true;
                    try
                    {
                        this.owner.RefreshRows(!this.owner.InSortOperation);
                        this.owner.PushAllowUserToAddRows();
                    }
                    finally
                    {
                        this.ResetDataConnectionState();
                    }
                }
                else if (this.dataConnectionState[4] || (this.owner.newRowIndex != e.NewIndex))
                {
                    if ((e.ListChangedType == ListChangedType.ItemAdded) && (this.currencyManager.List.Count == (this.owner.AllowUserToAddRowsInternal ? (this.owner.Rows.Count - 1) : this.owner.Rows.Count)))
                    {
                        if (this.dataConnectionState[0x1000] && this.dataConnectionState[0x2000])
                        {
                            this.dataConnectionState[0x4000] = true;
                        }
                    }
                    else
                    {
                        if (e.ListChangedType == ListChangedType.ItemDeleted)
                        {
                            if ((this.dataConnectionState[0x1000] && this.dataConnectionState[0x4000]) && this.dataConnectionState[0x2000])
                            {
                                this.dataConnectionState[0x4000] = false;
                            }
                            else
                            {
                                if (!this.dataConnectionState[4] && this.dataConnectionState[0x8000])
                                {
                                    this.dataConnectionState[0x400] = true;
                                    try
                                    {
                                        this.owner.RefreshRows(!this.owner.InSortOperation);
                                        this.owner.PushAllowUserToAddRows();
                                    }
                                    finally
                                    {
                                        this.dataConnectionState[0x400] = false;
                                    }
                                    return;
                                }
                                if (this.currencyManager.List.Count == this.DataBoundRowsCount())
                                {
                                    return;
                                }
                            }
                        }
                        this.dataConnectionState[0x10] = true;
                        try
                        {
                            switch (e.ListChangedType)
                            {
                                case ListChangedType.Reset:
                                {
                                    this.dataConnectionState[0x400] = true;
                                    bool visible = this.owner.Visible;
                                    if (visible)
                                    {
                                        this.owner.BeginUpdateInternal();
                                    }
                                    try
                                    {
                                        this.owner.RefreshRows(!this.owner.InSortOperation);
                                        this.owner.PushAllowUserToAddRows();
                                        this.ApplySortingInformationFromBackEnd();
                                        goto Label_05B4;
                                    }
                                    finally
                                    {
                                        this.ResetDataConnectionState();
                                        if (visible)
                                        {
                                            this.owner.EndUpdateInternal(false);
                                            this.owner.Invalidate(true);
                                        }
                                    }
                                    break;
                                }
                                case ListChangedType.ItemAdded:
                                    break;

                                case ListChangedType.ItemDeleted:
                                    this.owner.Rows.RemoveAtInternal(e.NewIndex, true);
                                    this.dataConnectionState[0x2000] = false;
                                    goto Label_05B4;

                                case ListChangedType.ItemMoved:
                                {
                                    int lo = Math.Min(e.OldIndex, e.NewIndex);
                                    int hi = Math.Max(e.OldIndex, e.NewIndex);
                                    this.owner.InvalidateRows(lo, hi);
                                    goto Label_05B4;
                                }
                                case ListChangedType.ItemChanged:
                                {
                                    string name = null;
                                    if (e.PropertyDescriptor != null)
                                    {
                                        name = e.PropertyDescriptor.Name;
                                    }
                                    for (int i = 0; i < this.owner.Columns.Count; i++)
                                    {
                                        DataGridViewColumn column = this.owner.Columns[i];
                                        if (column.Visible && column.IsDataBound)
                                        {
                                            if (!string.IsNullOrEmpty(name))
                                            {
                                                if (string.Compare(column.DataPropertyName, name, true, CultureInfo.InvariantCulture) == 0)
                                                {
                                                    this.owner.OnCellCommonChange(i, e.NewIndex);
                                                }
                                            }
                                            else
                                            {
                                                this.owner.OnCellCommonChange(i, e.NewIndex);
                                            }
                                        }
                                    }
                                    this.owner.InvalidateCell(-1, e.NewIndex);
                                    if ((this.owner.CurrentCellAddress.Y == e.NewIndex) && this.owner.IsCurrentCellInEditMode)
                                    {
                                        this.owner.RefreshEdit();
                                    }
                                    goto Label_05B4;
                                }
                                default:
                                    goto Label_05B4;
                            }
                            if ((this.owner.NewRowIndex != -1) && (e.NewIndex == this.owner.Rows.Count))
                            {
                                throw new InvalidOperationException();
                            }
                            this.owner.Rows.InsertInternal(e.NewIndex, this.owner.RowTemplateClone, true);
                        Label_05B4:
                            if (((this.owner.Rows.Count > 0) && !this.dataConnectionState[8]) && !this.owner.InSortOperation)
                            {
                                this.MatchCurrencyManagerPosition(false, e.ListChangedType == ListChangedType.Reset);
                            }
                        }
                        finally
                        {
                            this.dataConnectionState[0x10] = false;
                        }
                    }
                }
                else if (e.ListChangedType == ListChangedType.ItemAdded)
                {
                    if (!this.dataConnectionState[0x200] && !this.dataConnectionState[0x100])
                    {
                        if (this.owner.Columns.Count > 0)
                        {
                            do
                            {
                                this.owner.newRowIndex = -1;
                                this.owner.AddNewRow(false);
                            }
                            while (this.DataBoundRowsCount() < this.currencyManager.Count);
                        }
                        this.dataConnectionState[4] = true;
                        this.MatchCurrencyManagerPosition(true, true);
                    }
                }
                else if (e.ListChangedType == ListChangedType.ItemDeleted)
                {
                    if (this.dataConnectionState[0x40])
                    {
                        this.owner.PopulateNewRowWithDefaultValues();
                    }
                    else
                    {
                        if (this.dataConnectionState[0x8000] || this.dataConnectionState[0x200])
                        {
                            this.dataConnectionState[0x400] = true;
                            try
                            {
                                this.owner.RefreshRows(!this.owner.InSortOperation);
                                this.owner.PushAllowUserToAddRows();
                                return;
                            }
                            finally
                            {
                                this.dataConnectionState[0x400] = false;
                            }
                        }
                        if (this.dataConnectionState[0x1000] && (this.currencyManager.List.Count == 0))
                        {
                            this.AddNew();
                        }
                    }
                }
            }
Пример #14
0
 void Programs_ListChanged(object sender, ListChangedEventArgs e)
 {
     UpdateControlsFromPrograms();
 }
Пример #15
0
 private void BindingSource1_ListChanged(object sender, ListChangedEventArgs e)
 {
     label1.Visible = true;
     пересчет();
 }
Пример #16
0
 private void ordersBindingSource_2_ListChangedOnChildList(int row, object sender, ListChangedEventArgs e)
 {
     ultraGrid2.Rows[row].ChildBands[0].Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.RefreshDisplay, true);
 }
Пример #17
0
 void Games_ListChanged(object sender, ListChangedEventArgs e)
 {
     UpdateControlsFromGames();
 }
Пример #18
0
 void sections_ElementRemoved(object sender, ListChangedEventArgs<Canguro.Model.Section.Section> args)
 {
     foreach (LineElement line in lineList)
         if (line != null && line.Properties is StraightFrameProps &&
             ((StraightFrameProps)line.Properties).Section == args.ChangedObject)
         {
             args.Cancel = true;
             break;
         }
 }
Пример #19
0
 protected override void OnListChanged(ListChangedEventArgs e)
 {
     base.OnListChanged(e);
 }
        /// <summary>
        /// 引发<see cref="ListChanged"/> 事件
        /// </summary>
        /// <param name="e"></param>
        public virtual void OnListChanged(ListChangedEventArgs e)
        {
            if ((e.ListChangedType == ListChangedType.ItemChanged || e.ListChangedType == ListChangedType.ItemAdded)
                && e.NewIndex == this.DisplayManager.Position)
            {
                //  可能有些值是内部计算的
                this.DisplayManager.DisplayCurrent();
            }

            if (this.ListChanged != null)
            {
                this.ListChanged(this, e);
            }
        }
 void bindingSource1_ListChanged(object sender, ListChangedEventArgs e)
 {
     label1.Visible = true;
 }
Пример #22
0
        // IBindingList ListChanged event handler. Deals with fine-grained
        // changes to list items.

        private void bindingList_ListChanged(object sender,
                                             ListChangedEventArgs e)
        {
            switch (e.ListChangedType)
            {
            // Well, usually fine-grained... The whole list has changed
            // utterly, so reload it.

            case ListChangedType.Reset:
                LoadItemsFromSource();
                break;


            // A single item has changed, so just rebuild that.

            case ListChangedType.ItemChanged:
                object changedRow = m_currencyManager.List[e.NewIndex];
                BeginUpdate();
                Items[e.NewIndex] = BuildItemForRow(changedRow);
                EndUpdate();
                break;


            // A new item has appeared, so add that.

            case ListChangedType.ItemAdded:
                object newRow = m_currencyManager.List[e.NewIndex];
                // We get this event twice if certain grid controls
                // are used to add a new row to a datatable: once when
                // the editing of a new row begins, and once again when
                // that editing commits. (If the user cancels the creation
                // of the new row, we never see the second creation.)
                // We detect this by seeing if this is a view on a
                // row in a DataTable, and if it is, testing to see if
                // it's a new row under creation.
                DataRowView drv = newRow as DataRowView;
                if (drv == null || !drv.IsNew)
                {
                    // Either we're not dealing with a view on a data
                    // table, or this is the commit notification. Either
                    // way, this is the final notification, so we want
                    // to add the new row now!
                    BeginUpdate();
                    Items.Insert(e.NewIndex, BuildItemForRow(newRow));
                    EndUpdate();
                }
                break;


            // An item has gone away.

            case ListChangedType.ItemDeleted:
                if (e.NewIndex < Items.Count)
                {
                    Items.RemoveAt(e.NewIndex);
                }
                break;


            // An item has changed its index.

            case ListChangedType.ItemMoved:
                BeginUpdate();
                ListViewItem moving = Items[e.OldIndex];
                Items.Insert(e.NewIndex, moving);
                EndUpdate();
                break;


            // Something has changed in the metadata. (This control is
            // too lazy to deal with this in a fine-grained fashion,
            // mostly because the author has never seen this event
            // occur... So we deal with it the simple way: reload
            // everything.)

            case ListChangedType.PropertyDescriptorAdded:
            case ListChangedType.PropertyDescriptorChanged:
            case ListChangedType.PropertyDescriptorDeleted:
                LoadColumnsFromSource();
                LoadItemsFromSource();
                break;
            }
        }
 private void MultiplexedListChanged(object sender, ListChangedEventArgs e)
 {
     // Set the OldIndex to -2 so that consumers can identify the change was in a
     // multiplexed list.
     OnListChanged(new ListChangedEventArgs(e.ListChangedType, e.NewIndex, -2));
 }
 protected virtual void CollectionChange(ListChangedEventArgs e)
 {
     Changed?.Invoke(this, e);
 }
Пример #25
0
 void filters_ListChanged(object sender, ListChangedEventArgs e)
 {
     updateList();
 }
Пример #26
0
        //----------------------------------------------------------------------
        #region ** Grouping

        // update groups when the data changes (sort/filter)
        void _flexGroup_AfterDataRefresh(object sender, ListChangedEventArgs e)
        {
            UpdateTotals();
        }
Пример #27
0
        /// <devdoc>
        /// <para>Gets the <see cref='T:System.ComponentModel.PropertyDescriptorCollection'/> for the specified list.</para>
        /// </devdoc>
        private void List_ListChanged(Object sender, System.ComponentModel.ListChangedEventArgs e)
        {
            // If you change the assert below, better change the
            // code in the OnCurrentChanged that deals w/ firing the OnCurrentChanged event
            Debug.Assert(lastGoodKnownRow == -1 || lastGoodKnownRow == listposition, "if we have a valid lastGoodKnownRow, then it should equal the position in the list");

            //



            ListChangedEventArgs dbe;

            if (e.ListChangedType == ListChangedType.ItemMoved && e.OldIndex < 0)
            {
                dbe = new ListChangedEventArgs(ListChangedType.ItemAdded, e.NewIndex, e.OldIndex);
            }
            else if (e.ListChangedType == ListChangedType.ItemMoved && e.NewIndex < 0)
            {
                dbe = new ListChangedEventArgs(ListChangedType.ItemDeleted, e.OldIndex, e.NewIndex);
            }
            else
            {
                dbe = e;
            }

            int oldposition = listposition;

            UpdateLastGoodKnownRow(dbe);
            UpdateIsBinding();

            if (list.Count == 0)
            {
                listposition = -1;

                if (oldposition != -1)
                {
                    // if we used to have a current row, but not any more, then report current as changed
                    OnPositionChanged(EventArgs.Empty);
                    OnCurrentChanged(EventArgs.Empty);
                }

                if (dbe.ListChangedType == System.ComponentModel.ListChangedType.Reset && e.NewIndex == -1)
                {
                    // if the list is reset, then let our users know about it.
                    OnItemChanged(resetEvent);
                }

                if (dbe.ListChangedType == System.ComponentModel.ListChangedType.ItemDeleted)
                {
                    // if the list is reset, then let our users know about it.
                    OnItemChanged(resetEvent);
                }

                // we should still fire meta data change notification even when the list is empty
                if (e.ListChangedType == System.ComponentModel.ListChangedType.PropertyDescriptorAdded ||
                    e.ListChangedType == System.ComponentModel.ListChangedType.PropertyDescriptorDeleted ||
                    e.ListChangedType == System.ComponentModel.ListChangedType.PropertyDescriptorChanged)
                {
                    OnMetaDataChanged(EventArgs.Empty);
                }

                //


                OnListChanged(dbe);
                return;
            }

            suspendPushDataInCurrentChanged = true;
            try {
                switch (dbe.ListChangedType)
                {
                case System.ComponentModel.ListChangedType.Reset:
                    Debug.WriteLineIf(CompModSwitches.DataCursor.TraceVerbose, "System.ComponentModel.ListChangedType.Reset Position: " + Position + " Count: " + list.Count);
                    if (listposition == -1 && list.Count > 0)
                    {
                        ChangeRecordState(0, true, false, true, false);         // last false: we don't pull the data from the control when DM changes
                    }
                    else
                    {
                        ChangeRecordState(Math.Min(listposition, list.Count - 1), true, false, true, false);
                    }
                    UpdateIsBinding(/*raiseItemChangedEvent:*/ false);
                    OnItemChanged(resetEvent);
                    break;

                case System.ComponentModel.ListChangedType.ItemAdded:
                    Debug.WriteLineIf(CompModSwitches.DataCursor.TraceVerbose, "System.ComponentModel.ListChangedType.ItemAdded " + dbe.NewIndex.ToString(CultureInfo.InvariantCulture));
                    if (dbe.NewIndex <= listposition && listposition < list.Count - 1)
                    {
                        // this means the current row just moved down by one.
                        // the position changes, so end the current edit
                        ChangeRecordState(listposition + 1, true, true, listposition != list.Count - 2, false);
                        UpdateIsBinding();
                        // refresh the list after we got the item added event
                        OnItemChanged(resetEvent);
                        // when we get the itemAdded, and the position was at the end
                        // of the list, do the right thing and notify the positionChanged after refreshing the list
                        if (listposition == list.Count - 1)
                        {
                            OnPositionChanged(EventArgs.Empty);
                        }
                        break;
                    }
                    else if (dbe.NewIndex == this.listposition && this.listposition == list.Count - 1 && this.listposition != -1)
                    {
                        // The CurrencyManager has a non-empty list.
                        // The position inside the currency manager is at the end of the list and the list still fired an ItemAdded event.
                        // This could be the second ItemAdded event that the DataView fires to signal that the AddNew operation was commited.
                        // We need to fire CurrentItemChanged event so that relatedCurrencyManagers update their lists.
                        OnCurrentItemChanged(System.EventArgs.Empty);
                    }

                    if (listposition == -1)
                    {
                        // do not call EndEdit on a row that was not there ( position == -1)
                        ChangeRecordState(0, false, false, true, false);
                    }
                    UpdateIsBinding();
                    // put the call to OnItemChanged after setting the position, so the
                    // controls would use the actual position.
                    // if we have a control bound to a dataView, and then we add a row to a the dataView,
                    // then the control will use the old listposition to get the data. and this is bad.
                    //
                    OnItemChanged(resetEvent);
                    break;

                case System.ComponentModel.ListChangedType.ItemDeleted:
                    Debug.WriteLineIf(CompModSwitches.DataCursor.TraceVerbose, "System.ComponentModel.ListChangedType.ItemDeleted " + dbe.NewIndex.ToString(CultureInfo.InvariantCulture));
                    if (dbe.NewIndex == listposition)
                    {
                        // this means that the current row got deleted.
                        // cannot end an edit on a row that does not exist anymore
                        ChangeRecordState(Math.Min(listposition, Count - 1), true, false, true, false);
                        // put the call to OnItemChanged after setting the position
                        // in the currencyManager, so controls will use the actual position
                        OnItemChanged(resetEvent);
                        break;
                    }
                    if (dbe.NewIndex < listposition)
                    {
                        // this means the current row just moved up by one.
                        // cannot end an edit on a row that does not exist anymore
                        ChangeRecordState(listposition - 1, true, false, true, false);
                        // put the call to OnItemChanged after setting the position
                        // in the currencyManager, so controls will use the actual position
                        OnItemChanged(resetEvent);
                        break;
                    }
                    OnItemChanged(resetEvent);
                    break;

                case System.ComponentModel.ListChangedType.ItemChanged:
                    Debug.WriteLineIf(CompModSwitches.DataCursor.TraceVerbose, "System.ComponentModel.ListChangedType.ItemChanged " + dbe.NewIndex.ToString(CultureInfo.InvariantCulture));
                    // the current item changed
                    if (dbe.NewIndex == this.listposition)
                    {
                        OnCurrentItemChanged(EventArgs.Empty);
                    }

                    OnItemChanged(new ItemChangedEventArgs(dbe.NewIndex));
                    break;

                case System.ComponentModel.ListChangedType.ItemMoved:
                    Debug.WriteLineIf(CompModSwitches.DataCursor.TraceVerbose, "System.ComponentModel.ListChangedType.ItemMoved " + dbe.NewIndex.ToString(CultureInfo.InvariantCulture));
                    if (dbe.OldIndex == listposition)       // current got moved.
                    // the position changes, so end the current edit. Make sure there is something that we can end edit...
                    {
                        ChangeRecordState(dbe.NewIndex, true, this.Position > -1 && this.Position < list.Count, true, false);
                    }
                    else if (dbe.NewIndex == listposition)       // current was moved
                    // the position changes, so end the current edit. Make sure there is something that we can end edit
                    {
                        ChangeRecordState(dbe.OldIndex, true, this.Position > -1 && this.Position < list.Count, true, false);
                    }
                    OnItemChanged(resetEvent);
                    break;

                case System.ComponentModel.ListChangedType.PropertyDescriptorAdded:
                case System.ComponentModel.ListChangedType.PropertyDescriptorDeleted:
                case System.ComponentModel.ListChangedType.PropertyDescriptorChanged:
                    // reset lastGoodKnownRow because it was computed against property descriptors which changed
                    this.lastGoodKnownRow = -1;

                    // In Everett, metadata changes did not alter current list position. In Whidbey, this behavior
                    // preserved - except that we will now force the position to stay in valid range if necessary.
                    if (listposition == -1 && list.Count > 0)
                    {
                        ChangeRecordState(0, true, false, true, false);
                    }
                    else if (listposition > list.Count - 1)
                    {
                        ChangeRecordState(list.Count - 1, true, false, true, false);
                    }

                    // fire the MetaDataChanged event
                    OnMetaDataChanged(EventArgs.Empty);
                    break;
                }
                // send the ListChanged notification after the position changed in the list
                //


                OnListChanged(dbe);
            } finally {
                suspendPushDataInCurrentChanged = false;
            }
            Debug.Assert(lastGoodKnownRow == -1 || listposition == lastGoodKnownRow, "how did they get out of sync?");
        }
Пример #28
0
 void order_details_bndSource_ListChanged(object sender, ListChangedEventArgs e)
 {
     saveprompt = true;
 }
Пример #29
0
 private void Games_Items_ListChanged(object sender, ListChangedEventArgs e)
 {
     ControlHelper.ShowHideAndSelectGridRows(GamesDataGridView, ShowGamesDropDownButton);
 }
Пример #30
0
 void bindingListBoxes_ListChanged(object sender, ListChangedEventArgs e)
 {
     Save();
 }
Пример #31
0
 private void thongTinTaiKhoan_NhanBindingSource_ListChanged(object sender, ListChangedEventArgs e)
 {
     XuLyDaLuong.ChangeText(lblSoLuongKetQua,
                            string.Format("Số lượng kết quả: {0}", thongTinTaiKhoan_TimKiemBindingSource.Count), Color.Black);
 }
Пример #32
0
 private static void ConstantsBindingList_ListChanged(object sender, ListChangedEventArgs e)
 {
     DeclarationEditBox.variableCompletionData = null;
 }
Пример #33
0
 private void werkgeverBindingSource_ListChanged(object sender, ListChangedEventArgs e)
 {
     recordCountStatusLabel.Text = "Aantal items : " + this.werkgeverBindingSource.List.Count;
 }
Пример #34
0
 /// <summary>
 /// Callback function called before an abstract case is deleted. 
 /// Cancels the removing if the case has dependencies.
 /// </summary>
 /// <param name="sender">The AbstractCases Managed List</param>
 /// <param name="args">Object to check the Abstract case being deleted and to cancel if needed</param>
 void abstractCases_ElementRemoved(object sender, ListChangedEventArgs<AbstractCase> args)
 {
     Dictionary<AbstractCase, LinkedList<AbstractCase>> adjacency = BuildAnalysisCaseAdjacency();
     bool cancel = false;
     // Cancel if there are dependencies.
     if (adjacency.ContainsKey(args.ChangedObject) && adjacency[args.ChangedObject].Count > 0)
         cancel = true;
     else
     {
         // Deactivate before removing
         args.ChangedObject.IsActive = false;
         // Cancel remove if can't deactivate
         cancel = args.ChangedObject.IsActive;
     }
     args.Cancel = cancel;
 }
Пример #35
0
 private void contacts_ListChanged(object sender, ListChangedEventArgs e)
 {
     UpdateButtons();
 }
Пример #36
0
        void loadCases_ElementRemoved(object sender, ListChangedEventArgs<string> args)
        {
            if (LoadCases.Count <= 1)
                args.Cancel = true;
            else
            {
                string name = args.ChangedObject;
                LoadCase lCase = LoadCases[name];
                foreach (Element element in JointList)
                    if (element != null && element.Loads != null)
                        element.Loads.Remove(lCase);
                foreach (Element element in LineList)
                    if (element != null && element.Loads != null)
                        element.Loads.Remove(lCase);

                if (ActiveLoadCase == lCase)
                {
                    foreach (Canguro.Model.Load.LoadCase lc in LoadCases.Values)
                    {
                        ActiveLoadCase = lc;
                        break;
                    }
                }
            }
        }
Пример #37
0
 private void Channels_ListChanged(object sender, ListChangedEventArgs e)
 {
     NotifyChanged("Channels");
 }
Пример #38
0
		/// <summary>
		/// update the contents of the tree bar and anything else that should change when,
		/// for example, the filter or sort order changes.
		/// </summary>
		protected void OnListChanged(object src, ListChangedEventArgs arguments)
		{
			if (IsControllingTheRecordTreeBar) // m_treeBarHandler!= null)
			{
				if (arguments.Actions == ListChangedEventArgs.ListChangedActions.UpdateListItemName)
				{
					// ******************************************************************************
					// In the case where there are no other items and the Current object isn't valid,
					// then just don't do anything.  LT-5849.
					// A more robust solution would be to have in our design a way to produce
					// a 'defered' prop changed so that the current actions can finish before
					// others are notified of the change (which is often incomplete at that time).
					// The stack for this issue showed the RecordList and RecordClerk being
					// re-entered while they were deleting an object in a previous stack frame.
					// This is not the only case where this has been noted, but a solution has
					// not yet been thought of.
					// In the meantime, this fixed the crash .. <sigh> but doesn't help at all
					// for the other cases where this can happen.
					// ******************************************************************************
					if (m_recordBarHandler is TreeBarHandler && m_list.CurrentObject != null &&
						(m_list.CurrentObject.Cache != null || m_list.SortedObjects.Count != 1))
					{
						// all we need to do is replace the currently selected item in the tree.
						m_recordBarHandler.ReloadItem(m_list.CurrentObject);
					}
				}
				else
				{
					m_recordBarHandler.PopulateRecordBar(m_list);
				}
			}

			if (arguments.Actions == ListChangedEventArgs.ListChangedActions.SkipRecordNavigation ||
				arguments.Actions == ListChangedEventArgs.ListChangedActions.UpdateListItemName)
			{
				SelectedRecordChanged(true);
			}
			else if (arguments.Actions == ListChangedEventArgs.ListChangedActions.SuppressSaveOnChangeRecord)
			{
				bool oldSuppressSaveChangeOnRecord = SuppressSaveOnChangeRecord;
				SuppressSaveOnChangeRecord = true;
				try
				{
					BroadcastChange();
				}
				finally
				{
					SuppressSaveOnChangeRecord = oldSuppressSaveChangeOnRecord;
				}
			}
			else if (arguments.Actions == ListChangedEventArgs.ListChangedActions.Normal)
			{
				BroadcastChange();
			}
			else
			{
				throw new NotImplementedException("An enum choice for ListChangedEventArgs was selected that OnListChanged is not aware of.");
			}
		}
Пример #39
0
 private void OnBindingListChanged(object sender, ListChangedEventArgs e)
 {
     OnItemsChanged();
 }
Пример #40
0
	/// <summary>
	/// Re-synchronises the internal sorted collection when the data source changes.
	/// </summary>
	/// <param name="sender"></param>
	/// <param name="e"></param>
	private void mBindingSource_ListChanged(object sender, ListChangedEventArgs e) {
		SyncInternalItems();
	}
Пример #41
0
 private void SpecializationsOnListChanged(object sender, ListChangedEventArgs listChangedEventArgs)
 {
     _cachedStringSpec = null;
     OnPropertyChanged(nameof(Specialization));
     OnPropertyChanged(nameof(DisplaySpecialization));
 }
        /// <summary>
        /// 处理位于Position位置的Entity改变后的事情(保存,更新界面)
        /// </summary>
        /// <returns></returns>
        public virtual bool ProcessEntityChanged(int position)
        {
            object entity = this.DisplayManager.Items[position];
            if (entity == null)
            {
                throw new ArgumentException("Position is invalid!");
            }
            EntityChangedEventArgs arg;
            ListChangedEventArgs arg2;
            switch (this.State)
            {
                case StateType.Add:
                    arg = new EntityChangedEventArgs(EntityChangedType.Add, entity);
                    arg2 = new ListChangedEventArgs(ListChangedType.ItemAdded, position);
                    break;
                case StateType.Delete:
                    arg = new EntityChangedEventArgs(EntityChangedType.Delete, entity);
                    arg2 = new ListChangedEventArgs(ListChangedType.ItemDeleted, position);
                    break;
                case StateType.Edit:
                    arg = new EntityChangedEventArgs(EntityChangedType.Edit, entity);
                    arg2 = new ListChangedEventArgs(ListChangedType.ItemChanged, position);
                    break;
                default:
                    throw new InvalidOperationException("Invalid State");
            }

            OnEntityChanged(arg);

            if (arg.Exception == null)
            {
                OnListChanged(arg2);
                return true;
            }
            else
            {
                if (arg.Exception is InvalidUserOperationException)
                {
                    // 只是提示,不刷新。而且在Dao中,不清空内部Dao数据(Clear)。
                }
                else
                {
                    DoOnFailedOperation();
                }
                return false;
            }
        }
Пример #43
0
 private void ordersBindingSource_ListChangedOnChildList(int row, object sender, ListChangedEventArgs e)
 {
 }