Example #1
0
        private void DoAction(DualListAction dualListAction, bool remove, int index)
        {
            DualListCancelEventArgs e = new DualListCancelEventArgs(dualListAction, ListBoxFrom.Items[index]);

            if (BeforeAction != null)
            {
                BeforeAction(this, e);
            }

            if (!e.Cancel)
            {
                int newIndex = ListBoxTo.Items.Add(e.Item);
                ListBoxTo.SelectedIndices.Add(newIndex);

                if (remove)
                {
                    listBoxFrom.Items.RemoveAt(index);
                }

                if (AfterAction != null)
                {
                    DualListActionEventArgs f = new DualListActionEventArgs(dualListAction, e.Item, newIndex);
                    AfterAction(this, f);
                }
            }
        }
Example #2
0
        private void DoAction( DualListAction dualListAction, bool remove, int index )
        {
            DualListCancelEventArgs e = new DualListCancelEventArgs( dualListAction, ListBoxFrom.Items[index] );
            if ( BeforeAction != null )
            {
                BeforeAction( this, e );
            }

            if ( !e.Cancel )
            {
                int newIndex = ListBoxTo.Items.Add( e.Item );
                ListBoxTo.SelectedIndices.Add( newIndex );

                if ( remove )
                {
                    listBoxFrom.Items.RemoveAt( index );
                }

                if ( AfterAction != null )
                {
                    DualListActionEventArgs f = new DualListActionEventArgs( dualListAction, e.Item, newIndex );
                    AfterAction( this, f );
                }
            }
        }