상속: System.EventArgs
예제 #1
0
		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();
			}
		}
예제 #2
0
		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);
		}
예제 #3
0
 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;
 }
예제 #4
0
        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;
            }            
        }
예제 #5
0
        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;
            }
        }
예제 #6
0
 void Strategies_ListChanged(object sender, ListChangedEventArgs e)
 {
     if (e.ListChangedType == ListChangedType.ItemAdded)
     {
             NotifyPropertyChanged();
     }
 }
예제 #7
0
 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);
 }
예제 #8
0
 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 = "";
     }
 }
예제 #9
0
		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);
		}
예제 #10
0
파일: Question.cs 프로젝트: aelhadi/opencbs
 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);
        }
예제 #12
0
 void Boats_ListChanged(object sender, ListChangedEventArgs e)
 {
     if (e != null)
     {
         OnPropertyChanged("Boats");
     }
 }
예제 #13
0
 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();
     }
 }
예제 #14
0
 void Members_ListChanged(object sender, ListChangedEventArgs e)
 {
     if (e != null)
     {
         SaveMembers();
     }
 }
예제 #15
0
        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;
            }
        }
예제 #16
0
        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;
     }
 }
예제 #18
0
 private void Binding_ListChanged(object sender, ListChangedEventArgs e)
 {
     if (UpdateRecordCount != null)
     {
         UpdateRecordCount(this.Binding.Count);
     }
 }
예제 #19
0
 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);
 }
예제 #20
0
		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);
		}
예제 #21
0
 public void Call(object param0, System.ComponentModel.ListChangedEventArgs param1)
 {
     func.BeginPCall();
     func.Push(param0);
     func.PushObject(param1);
     func.PCall();
     func.EndPCall();
 }
예제 #22
0
 void Settings_ListChanged(object sender, ListChangedEventArgs e)
 {
     EventHandler handler = Changed;
     if (handler != null)
     {
         handler(this, EventArgs.Empty);
     }
 }
예제 #23
0
 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();
            }
        }
예제 #26
0
파일: FormMain.cs 프로젝트: helgihaf/Alpha
 private void bindingSource_ListChanged(object sender, ListChangedEventArgs e)
 {
     Session session = bindingSource.Current as Session;
     if (session != null)
     {
         sessions.Remove(session);
         sessions.Add(session);
     }
 }
예제 #27
0
 internal void IndexListChanged(ListChangedEventArgs e) {
     DataView dv = (DataView)_dvWeak.Target;
     if (dv != null) {
         dv.IndexListChangedInternal(e);
     }
     else {
         CleanUp(true);
     }
 }
예제 #28
0
 private void BdsWarehouseIODetailListChanged(object sender, ListChangedEventArgs e)
 {
     /*
     if (e.ListChangedType == ListChangedType.ItemAdded)
     {
         MessageBox.Show("Xin chào");
     }
     */
 }
예제 #29
0
        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;
     }
 }
예제 #31
0
 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;
     }
 }
예제 #32
0
 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());
     }
 }
예제 #33
0
        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";
        }
예제 #34
0
 void _grid_AfterDataRefresh(object sender, System.ComponentModel.ListChangedEventArgs e)
 {
     UpdateScrollbar();
 }
예제 #35
0
 void _list_ListChanged(object sender, ListChangedEventArgs e)
 {
     membersLabel.Text = String.Format("Members ({0} in total):", _list.Count);
 }
예제 #36
0
        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";
        }
예제 #37
0
        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);
                    }
                }
            }
        }
예제 #38
0
 private void TeachersSubjectsListBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
 {
 }
예제 #39
0
        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);
        }
예제 #40
0
 // update sql query when any of the QueryFields change
 private void _flex_AfterDataRefresh(object sender, System.ComponentModel.ListChangedEventArgs e)
 {
     _txtSql.Text = _qb.Sql;
 }