コード例 #1
0
        public EntityPersister(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
            bindingListChangedEventHandler = new ListChangedEventHandler(BindingSourceListChanged);
            bindingCurrentChangedEventHandler = new EventHandler(BindingSourceCurrentChanged);
        }
コード例 #2
0
ファイル: DataBoundListView.cs プロジェクト: vincenthamm/ATF
        /// <summary>
        /// Constructor</summary>
        public DataBoundListView()
        {
            View = View.Details;
            FullRowSelect = true;
            ColumnClick +=  DataBoundListView_ColumnClick;
            LabelEdit = false;
            HideSelection = false;
            DoubleBuffered = true;

            currencyManager_ListChanged = new ListChangedEventHandler(bindingManager_ListChanged);
            currencyManager_PositionChanged = new EventHandler(bindingManager_PositionChanged);
            SelectedIndexChanged += new EventHandler(listView_SelectedIndexChanged);
            ColumnWidthChanged += new ColumnWidthChangedEventHandler(listView_ColumnWidthChanged);
            ColumnWidthChanging += new ColumnWidthChangingEventHandler(listView_ColumnWidthChanging);
            m_textBox = new TextBox();
            // force creation of the window handles on the GUI thread
            // see http://forums.msdn.microsoft.com/en-US/clr/thread/fa033425-0149-4b9a-9c8b-bcd2196d5471/
            IntPtr handle = m_textBox.Handle;
            m_textBox.BorderStyle = BorderStyle.FixedSingle; //BorderStyle.None;
            m_textBox.AutoSize = false;

            m_textBox.LostFocus += textBox_LostFocus;

            // forward textbox events as if they originated with this control
            m_textBox.DragOver += textBox_DragOver;
            m_textBox.DragDrop += textBox_DragDrop;
            m_textBox.MouseHover += textBox_MouseHover;
            m_textBox.MouseLeave += textBox_MouseLeave;

            m_textBox.Visible = false;
            Controls.Add(m_textBox);

            m_comboBox = new ComboBox();
            handle = m_comboBox.Handle;
            m_comboBox.Visible = false;
            m_comboBox.DropDownClosed += new EventHandler(comboBox_DropDownClosed);
            Controls.Add(m_comboBox);
            OwnerDraw = true;

            m_alternatingRowBrush1 = new SolidBrush(m_alternatingRowColor1);
            m_alternatingRowBrush2 = new SolidBrush(m_alternatingRowColor2);

            m_defaultBackColor = BackColor;
            NormalTextColor = Color.Black;
            HighlightTextColor = Color.White;
            ReadOnlyTextColor = Color.DimGray;
            ExternalEditorTextColor = Color.Black;
            HighlightBackColor = SystemColors.Highlight;
            ColumnHeaderTextColor = NormalTextColor;
            ColumnHeaderTextColorDisabled = ReadOnlyTextColor;
            ColumnHeaderCheckMarkColor = Color.DarkSlateGray;
            ColumnHeaderCheckMarkColorDisabled = ReadOnlyTextColor;
            ColumnHeaderSeparatorColor = Color.FromArgb(228, 229, 230);

            m_boldFont = new Font(Font, FontStyle.Bold);
            ShowGroups = false; 

        }
コード例 #3
0
ファイル: JContainer.cs プロジェクト: rafaolivas19/LibreR
        /// <summary>
        /// Raises the <see cref="ListChanged"/> event.
        /// </summary>
        /// <param name="e">The <see cref="ListChangedEventArgs"/> instance containing the event data.</param>
        protected virtual void OnListChanged(ListChangedEventArgs e)
        {
            ListChangedEventHandler handler = _listChanged;

            if (handler != null)
            {
                _busy = true;
                try {
                    handler(this, e);
                }
                finally {
                    _busy = false;
                }
            }
        }
コード例 #4
0
ファイル: JContainer.cs プロジェクト: cs130-w21/13
        protected virtual void OnListChanged(ListChangedEventArgs e)
        {
            ListChangedEventHandler listChanged = this._listChanged;

            if (listChanged == null)
            {
                return;
            }
            this._busy = true;
            try {
                listChanged((object)this, e);
            } finally {
                this._busy = false;
            }
        }
コード例 #5
0
        public SelectAccountSheet()
        {
            _listChangedHandler = new ListChangedEventHandler(dataManager_ListChanged);
              _positionChangedHandler = new EventHandler(dataManager_PositionChanged);

              addAction = onAddAction;
              removeAction = onRemoveAction;
              selectAccount = onSelectAccount;
              exitAction = onExitAction;

              _removeAccountSheet = new RemoveAccountSheet();
              _removeAccountSheet.removeCompleteAction += onRemoveCompleteAction;

              InitializeComponent();
        }
コード例 #6
0
        public SelectAccountSheet()
        {
            _listChangedHandler     = new ListChangedEventHandler(dataManager_ListChanged);
            _positionChangedHandler = new EventHandler(dataManager_PositionChanged);

            addAction     = onAddAction;
            removeAction  = onRemoveAction;
            selectAccount = onSelectAccount;
            exitAction    = onExitAction;

            _removeAccountSheet = new RemoveAccountSheet();
            _removeAccountSheet.removeCompleteAction += onRemoveCompleteAction;

            InitializeComponent();
        }
コード例 #7
0
ファイル: BoundListView.cs プロジェクト: yzwbrian/MvvmFx
        /// <summary>
        /// Initializes a new instance of the <see cref="BoundListView"/> class.
        /// </summary>
        public BoundListView()
        {
            Logger.Trace("Constructor");

            _listChangedHandler     = ListManager_ListChanged;
            _positionChangedHandler = ListManager_PositionChanged;

            View = View.Details;
#if WINFORMS
            FullRowSelect = true;
            HideSelection = false;
#endif
            MultiSelect = false;
            LabelEdit   = true;
        }
コード例 #8
0
        /// <summary>
        /// Inserts entity at specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="entity">The entity.</param>
        public void Insert(int index, TEntity entity)
        {
            if (Source.Contains(entity))
            {
                throw new ArgumentOutOfRangeException();
            }
            OnAdd(entity);
            deferred = false;
            Source.Insert(index, entity);
            ListChangedEventHandler handler = ListChanged;

            if (handler != null)
            {
                handler(this, new ListChangedEventArgs(ListChangedType.ItemAdded, index));
            }
        }
コード例 #9
0
        public static void Serialize(ToDoList theList, string path)
        {
            using (Stream str = new FileStream(path, FileMode.Create))
            {
                var binaryFormatter = new BinaryFormatter();

                //we have to tempsave and reset the event handler, because the mainform is linked in it. a form is not serializeable
                ListChangedEventHandler oldHandler = theList.ListChanged;
                theList.ListChanged = null;

                binaryFormatter.Serialize(str, theList);

                //setting the event handler to it's old state
                theList.ListChanged = oldHandler;
            }
        }
コード例 #10
0
        /// <summary>
        /// Constructor. creates event handlers
        /// </summary>
        public BoundCheckedListBox()
        {
            childListChangedHandler     = new ListChangedEventHandler(dataManager_childListChanged);
            childPositionChangedHandler = new EventHandler(dataManager_childPositionChanged);

            parentListChangedHandler     = new ListChangedEventHandler(dataManager_parentListChanged);
            parentPositionChangedHandler = new EventHandler(dataManager_parentPositionChanged);

            relationListChangedHandler = new ListChangedEventHandler(dataManager_relationListChanged);
            //childPositionChangedHandler = new EventHandler(dataManager_childPositionChanged);

            itemCheckChangesHandler    = new ItemCheckEventHandler(BoundCheckedListBox_ItemCheck);
            this.ItemCheck            += itemCheckChangesHandler;
            selectionChangedHandler    = new EventHandler(BoundCheckedListBox_SelectedIndexChanged);
            this.SelectedIndexChanged += selectionChangedHandler;
        }
コード例 #11
0
        // Token: 0x060011CC RID: 4556 RVA: 0x00057A00 File Offset: 0x00055C00
        protected virtual void gmethod_3193(ListChangedEventArgs arg_0)
        {
            ListChangedEventHandler listChangedEventHandler = this.field_0;

            if (listChangedEventHandler != null)
            {
                this.field_4 = true;
                try
                {
                    listChangedEventHandler(this, arg_0);
                }
                finally
                {
                    this.field_4 = false;
                }
            }
        }
コード例 #12
0
        protected virtual void OnListChanged(ListChangedEventArgs e)
        {
            ListChangedEventHandler listChanged = this.ListChanged;

            if (listChanged != null)
            {
                _busy = true;
                try
                {
                    listChanged(this, e);
                }
                finally
                {
                    _busy = false;
                }
            }
        }
コード例 #13
0
        public static void SerializeToBinary(TodoList theList, string path)
        {
            using (Stream str = new FileStream(path, FileMode.Create))
            {
                BinaryFormatter bf = new BinaryFormatter();
                bf.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple;
                //we have to tempsave and reset the event handler, because the mainform is linked in it. a form is not serializeable
                ListChangedEventHandler oldHandler = theList.ListChanged;
                theList.ListChanged = null;

                bf.Serialize(str, theList);

                //setting the event handler to it's old state
                theList.ListChanged = oldHandler;

                str.Close();
            }
        }
コード例 #14
0
        /// <summary>
        /// Removes the specified entity.
        /// </summary>
        /// <param name="entity">The entity.</param>
        /// <returns></returns>
        public bool Remove(TEntity entity)
        {
            int i = Source.IndexOf(entity);

            if (i < 0)
            {
                return(false);
            }
            deferred = false;
            Source.Remove(entity);
            OnRemove(entity);
            ListChangedEventHandler handler = ListChanged;

            if (deferredSource != null && handler != null)
            {
                handler(this, new ListChangedEventArgs(ListChangedType.ItemDeleted, i));
            }
            return(true);
        }
コード例 #15
0
        /// <summary>
        /// Removes all items in collection
        /// </summary>
        public void Clear()
        {
            ListChangedEventHandler handler = ListChanged;

            deferred       = false;
            assignedValues = true;
            if (deferredSource != null && handler != null)
            {
                foreach (var item in Source)
                {
                    handler(this, new ListChangedEventArgs(ListChangedType.ItemDeleted, 0));
                }
            }
            if (handler != null)
            {
                handler(this, new ListChangedEventArgs(ListChangedType.Reset, 0));
            }
            Source.Clear();
        }
コード例 #16
0
        protected virtual void _0001(ListChangedEventArgs param)
        {
            //Discarded unreachable code: IL_0002
            //IL_0003: Incompatible stack heights: 0 vs 1
            ListChangedEventHandler candidateIssuer = _CandidateIssuer;

            if (candidateIssuer != null)
            {
                m_MockIssuer = true;
                try
                {
                    candidateIssuer(this, param);
                }
                finally
                {
                    m_MockIssuer = false;
                }
            }
        }
コード例 #17
0
        /// <summary>
        /// Adds a row
        /// </summary>
        public void Add(TEntity entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            if (Source.Contains(entity))
            {
                return;
            }
            Source.Add(entity);
            OnAdd(entity);
            ListChangedEventHandler handler = ListChanged;

            if (!deferred && deferredSource != null && handler != null)
            {
                handler(this, new ListChangedEventArgs(ListChangedType.ItemAdded, Source.Count - 1));
            }
        }
コード例 #18
0
    void innerList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
    {
        ListChangedEventHandler handler = ListChanged;

        if (handler != null)
        {
            ListChangedEventArgs args = null;
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                args = new ListChangedEventArgs(ListChangedType.ItemAdded, e.NewStartingIndex);
                break;

            case NotifyCollectionChangedAction.Remove:
                args = new ListChangedEventArgs(ListChangedType.ItemDeleted, e.OldStartingIndex);
                break;

            case NotifyCollectionChangedAction.Reset:
                args = new ListChangedEventArgs(ListChangedType.Reset, -1);
                break;

            case NotifyCollectionChangedAction.Replace:
                args = new ListChangedEventArgs(ListChangedType.ItemChanged, e.NewStartingIndex);
                break;

            case NotifyCollectionChangedAction.Move:
                args = new ListChangedEventArgs(ListChangedType.ItemMoved, e.NewStartingIndex, e.OldStartingIndex);
                break;
            }
            if (args != null)
            {
                handler(this, args);
            }
        }
        NotifyCollectionChangedEventHandler handler2 = CollectionChanged;

        if (handler2 != null)
        {
            handler2(this, e);
        }
    }
コード例 #19
0
        public static void SetProfilePage(Page page, ListBox listbox, BindingList <Profile> list)
        {
            SetSelectedProfile(listbox, list);

            var hdr = new ListChangedEventHandler((s, e) =>
            {
                if (e.ListChangedType != ListChangedType.ItemAdded)
                {
                    return;
                }
                SetSelectedProfile(listbox, list);
            });

            list.ListChanged         += hdr;
            listbox.SelectionChanged += _ListBoxSelectionChanged;

            page.Unloaded += delegate
            {
                list.ListChanged         -= hdr;
                listbox.SelectionChanged -= _ListBoxSelectionChanged;
            };
        }
コード例 #20
0
        public static BindingList <T> ForEachItemDeleted <T>(this BindingList <T> source, Action <T, Action> handler)
        {
            var cache = new List <T>();

            cache.AddRange(source);

            ListChangedEventHandler h = null;

            Action Dispose =
                delegate
            {
                source.ListChanged -= h;
                h = null;
                cache.Clear();
                cache = null;
            };

            h = (sender0, args0) =>
            {
                if (args0.ListChangedType == ListChangedType.ItemAdded)
                {
                    cache.Add(source[args0.NewIndex]);
                    return;
                }

                if (args0.ListChangedType == ListChangedType.ItemDeleted)
                {
                    var k = cache[args0.NewIndex];

                    cache.RemoveAt(args0.NewIndex);

                    handler(k, Dispose);
                }
            };

            source.ListChanged += h;

            return(source);
        }
コード例 #21
0
        private void wireupFeatureLayer(IFeatureLayer layer)
        {
            StringComparer comparer             = StringComparer.CurrentCultureIgnoreCase;
            Predicate <LayerWireState> sameName = delegate(LayerWireState find)
            {
                return(comparer.Equals(layer.LayerName,
                                       find.Layer.LayerName));
            };

            if (_wiredLayers.Exists(sameName))
            {
                return;
            }

            LayerWireState wireState = new LayerWireState(layer);

            ListChangedEventHandler handler = GetSelectedChangedEventHandler();

            if (handler != null)
            {
                layer.SelectedFeatures.ListChanged += handler;
                wireState.Selected = true;
            }

            handler = GetHighlightedChangedEventHandler();

            if (handler != null)
            {
                layer.HighlightedFeatures.ListChanged += handler;
                wireState.Highlighted = true;
            }

            if (wireState.Highlighted || wireState.Selected)
            {
                _wiredLayers.Add(wireState);
            }
        }
コード例 #22
0
		public SelectionHandler()
		{
			sceh = ( s, e ) =>
			{
				/*
				 * La ListView ci notifica che la selezione
				 * è cambiata.
				 * 
				 * Per prima cosa ci sganciamo temporaneamente
				 * dalla gestione delle notifiche in modo da non
				 * innescare un meccanismo ricorsivo infinito
				 */
				this.Unwire();

				var bag = this.GetSelectedItemsBag();
				e.RemovedItems.Enumerate( obj =>
				{
					var item = this.GetRealItem( obj );
					if( bag.Contains( item ) )
					{
						bag.Remove( item );
					}
				} );

				e.AddedItems.Enumerate( obj =>
				{
					var item = this.GetRealItem( obj );
					if( !bag.Contains( item ) )
					{
						bag.Add( item );
					}
				} );

				this.Wire();
			};

			ncceh = ( s, e ) =>
			{
				this.Unwire();

				switch( e.Action )
				{
					case NotifyCollectionChangedAction.Add:
						{
							this.AddToListViewSelection( e.NewItems );
						}
						break;

					case NotifyCollectionChangedAction.Remove:
						{
							this.RemoveFromListViewSelection( e.OldItems );
						}
						break;

					case NotifyCollectionChangedAction.Reset:
						{
							this.ClearListViewSelection();
							this.AddToListViewSelection( this.GetSelectedItemsBag() );
						}
						break;

					case NotifyCollectionChangedAction.Move:
					case NotifyCollectionChangedAction.Replace:
						//NOP
						break;

					default:
						throw new NotSupportedException();
				}

				this.Wire();
			};

			lceh = ( s, e ) =>
			{
				this.Unwire();

				switch( e.ListChangedType )
				{
					case ListChangedType.ItemAdded:
						{
							var bag = ( IEntityView )this.selectedItems;
							var item = bag[ e.NewIndex ];

							this.AddToListViewSelection( new[] { item } );
						}
						break;

					case ListChangedType.Reset:
						{
							this.ClearListViewSelection();
							this.AddToListViewSelection( this.selectedItems );
						}
						break;

					case ListChangedType.ItemDeleted:
						{
							this.RemoveFromListViewSelectionAtIndex( e.NewIndex );
						}
						break;

					case ListChangedType.ItemChanged:
					case ListChangedType.ItemMoved:
					case ListChangedType.PropertyDescriptorAdded:
					case ListChangedType.PropertyDescriptorChanged:
					case ListChangedType.PropertyDescriptorDeleted:
						//NOP
						break;

					default:
						throw new NotSupportedException();
				}

				this.Wire();
			};
		}
コード例 #23
0
ファイル: BoundTreeView.cs プロジェクト: tfreitasleal/MvvmFx
        /// <summary>
        /// Default constructor.
        /// </summary>
        public BoundTreeView()
        {
            SetDefaultMessages();

            _listChangedHandler = ListManager_ListChanged;
            _positionChangedHandler = ListManager_PositionChanged;

            _identifierMember = string.Empty;
            _displayMember = string.Empty;
            _parentIdentifierMember = string.Empty;
            _itemsPositions = new SortedList();
            _itemsIdentifiers = new SortedList();
#if !WISEJ
            HideSelection = false;
#endif
#if !WEBGUI && !WISEJ
            HotTracking = true;
#endif
        }
コード例 #24
0
 public void AddListChangedEventHandler(ListChangedEventHandler handler)
 {
     ListChanged += handler;
 }
コード例 #25
0
 public void _0002(ListChangedEventHandler init)
 {
     //Discarded unreachable code: IL_0002
     //IL_0003: Incompatible stack heights: 0 vs 1
     _CandidateIssuer = (ListChangedEventHandler)Delegate.Remove(_CandidateIssuer, init);
 }
コード例 #26
0
 void IBindingList.remove_ListChanged(ListChangedEventHandler init)
 {
     //ILSpy generated this explicit interface implementation from .override directive in 
     this._0002(init);
 }
コード例 #27
0
        public static void RemoveListChangedEventHandler(this FormCollection collection, ListChangedEventHandler eventHandler, ListChangedType changedType)
        {
            var innerListlistFieldInfo = collection.GetType().BaseType.GetField("list", fieldBindingFlags);
            var innerlist = innerListlistFieldInfo?.GetValue(Application.OpenForms);

            if (!(innerlist is ObservableArrayList))
            {
                var newInnerList = new ObservableArrayList();
                foreach (var item in innerlist as ArrayList)
                {
                    newInnerList.Add(item);
                }

                innerListlistFieldInfo.SetValue(Application.OpenForms, newInnerList);
            }

            if (innerListlistFieldInfo?.GetValue(Application.OpenForms) is ObservableArrayList currentInnerList)
            {
                switch (changedType)
                {
                case ListChangedType.Added:
                    currentInnerList.Added -= eventHandler;
                    break;

                case ListChangedType.Removed:
                    currentInnerList.Removed -= eventHandler;
                    break;
                }
            }
        }
コード例 #28
0
 void IBindingList.add_ListChanged(ListChangedEventHandler item)
 {
     //ILSpy generated this explicit interface implementation from .override directive in 
     this._0001(item);
 }
コード例 #29
0
 private ListChangedEventHandler WrapListChangedEventHandler(ListChangedEventHandler eventHandler)
 {
     return((sender, args) => eventHandler(this, args));
 }
コード例 #30
0
ファイル: GBGMain.cs プロジェクト: Xunnamius/GBotGUI
        private void GBGMain_Load(Object sender, EventArgs e)
        {
            ttUpdater.Interval = 500;
            ttUpdater.Tick += new EventHandler((o, ev) =>
            {
                long mil = totalRunTime.ElapsedMilliseconds,
                     seconds = mil / 1000,
                     minutes = seconds / 60 % 60,
                     hours = minutes / 60,
                     days = hours / 24;

                lblCurrentRunTime.Text = "Approx. " + days + "d " + (hours % 24) + "h " + (minutes % 60) + "m " + (seconds % 60) + "s";
            });

            bgw.WorkerSupportsCancellation = true;
            bgw.WorkerReportsProgress = true;
            bgw.DoWork += new DoWorkEventHandler(RunBot_Work);
            bgw.ProgressChanged += new ProgressChangedEventHandler(bgw_ProgressChanged);
            bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);

            Hotkey hkRunBot = new Hotkey(Keys.F12, false, true, true, false);

            hkRunBot.Pressed += delegate
            {
                if (btnStopBot.Enabled)
                    StopBot();
                else if (btnRunBot.Enabled)
                    RunBot();
            };

            hkRunBot.Register(this);

            Text += ASMVersion;

            WriteLogLine("Version: ", ASMVersion);
            WriteLogLine("Disclaimer: if you get caught, it's not my nor anyone else's problem. "
                         + "This understanding should be tacit. Deal with it (or don't use the "
                         + "program). By using this program you are agreeing to hold no one "
                         + "other than your cheating self responsible if anything goes wrong. "
                         + "Don't even attempt to contact me.");
            WriteLogLine("Oh, and you should probably consider disabling the UAC when running ",
                "this bot, especially if you're encountering problems.");
            WriteLogLine("Finishing initialization...");
            ResetRunStatistics();

            long frequency = Stopwatch.Frequency;
            long nanosecPerTick = (1000L * 1000L * 1000L) / frequency;
            WriteLogLine("**Timer frequency in ticks per second = ", frequency);
            WriteLogLine("*-*Duration stopwatch estimated to be accurate to within ",
                nanosecPerTick, " nanoseconds on this system");

            // Load/Save dialogs
            saveFileDialog = new SaveFileDialog();
            saveFileDialog.Title = "Choose Profile Location...";

            openFileDialog = new OpenFileDialog();
            openFileDialog.Title = "Select Profile...";

            saveFileDialog.InitialDirectory = openFileDialog.InitialDirectory = profileController.DefaultSaveDirectory;
            saveFileDialog.DefaultExt = openFileDialog.DefaultExt = Properties.Settings.Default.ProfileFileExtension;
            saveFileDialog.Filter = openFileDialog.Filter = "profiles (*."
                + Properties.Settings.Default.ProfileFileExtension
                + ")|*."
                + Properties.Settings.Default.ProfileFileExtension
                + "|All files (*.*)|*.*";

            // Set up MouseTracker
            Timer mouseTrackerTimer = new Timer();
            mouseTrackerTimer.Interval = 200;
            mouseTrackerTimer.Tick += new EventHandler(mouseTrackerTimer_Tick);

            // Set up events
            profileController.Profiles.ListChanged += new ListChangedEventHandler((o, ev) =>
            {
                if(profileController.Profiles.Count > 0)
                    cbProfileSelector.Enabled = true;
                else
                    cbProfileSelector.Enabled = false;
            });

            lbNodesListChangedEventHandler = new ListChangedEventHandler(nodeList_ListChanged);

            // ListControls
            cbProfileSelector.DataSource = profileController.Profiles;
            lbNodes.DisplayMember = "Display";
            cbProfileSelector.DisplayMember = "Display";

            // Load/Create the default profile
            profileController.ProfileControllerAction +=
                new ProfileController.ProfileControllerActionHandler(profileController_ProfileControllerAction);

            String errpath = "(unknown location)";
            mouseTrackerTimer.Enabled = true;

            try
            {
                EnableInitialControls();

                if(File.Exists(profileController.PathOfDefaultProfile))
                    profileController.LoadProfile(errpath = profileController.PathOfDefaultProfile);

                else
                {
                    NodeProfile profile =
                        new NodeProfile("default", profileController.DefaultSaveDirectory, new BindingList<GenericNode>());

                    errpath = profile.FilePath;
                    profileController.SaveProfile(profile);
                    profileController.LoadProfile(profile.FilePath);
                }

                SetCurrentAction("Idle (fully initialized)");
                elbNodes = new ExtendedListControl<GenericNode>(lbNodes);
                profileController.Profiles.ResetBindings();
            }

            catch(System.Runtime.Serialization.SerializationException ouch)
            {
                WriteLogLine(
                    "ERROR: Failed to mutate your default profile.",
                    "If you continue to see this error, please  ",
                    "delete the following file: \"", errpath, "\".");
                WriteLogLine("WARNING: Due to Profile functionality being unavailable for the duration ",
                    "of this session, program functionality has become limited.");

                menuStripMain.Enabled = false;
                SetCurrentAction("Idle (bad startup; check logs)");
            }
        }
コード例 #31
0
ファイル: HRAList.cs プロジェクト: mahitosh/HRA4
        public void AddHandlersWithLoad(ListChangedEventHandler listChangedEventHandler,
                                        LoadFinishedEventHandler loadFinishedEventHandler,
                                        ListItemChangedEventHandler itemChangedEventHandler)
        {
            #if (CHATTY_DEBUG)
            string msg = "*** HRA LIST AddHandlersWithLoad on : " + this.ToString() + System.Environment.NewLine;
            if (listChangedEventHandler != null)
            {
                msg += "By: " + listChangedEventHandler.Target.ToString();
            }
            else if (loadFinishedEventHandler != null)
            {
                msg += "By: " + loadFinishedEventHandler.Target.ToString();
            }
            else if (itemChangedEventHandler != null)
            {
                msg += "By: " + itemChangedEventHandler.Target.ToString();
            }

            Logger.Instance.DebugToLog(msg);
            #endif

            if (listChangedEventHandler != null)
            {
                if (ListChanged == null)
                {
                    ListChanged += listChangedEventHandler;
                }
                else
                {
                    bool ok = true;
                    foreach (Delegate d in ListChanged.GetInvocationList())
                    {
                        if (d.Target == listChangedEventHandler.Target)
                        {
                            ok = false;
                        }
                    }
                    if (ok)
                    {
                        ListChanged += listChangedEventHandler;
                    }
                }
            }

            if (loadFinishedEventHandler != null)
            {
                if (LoadFinished == null)
                {
                    LoadFinished += loadFinishedEventHandler;
                }
                else
                {
                    bool ok = true;
                    foreach (Delegate d in LoadFinished.GetInvocationList())
                    {
                        if (d.Target == loadFinishedEventHandler.Target)
                        {
                            ok = false;
                        }
                    }
                    if (ok)
                    {
                        LoadFinished += loadFinishedEventHandler;
                    }
                }
            }

            if (itemChangedEventHandler != null)
            {
                if (ListItemChanged == null)
                {
                    ListItemChanged += itemChangedEventHandler;
                }
                else
                {
                    bool ok = true;
                    foreach (Delegate d in ListItemChanged.GetInvocationList())
                    {
                        if (d.Target == loadFinishedEventHandler.Target)
                        {
                            ok = false;
                        }
                    }
                    if (ok)
                    {
                        ListItemChanged += itemChangedEventHandler;
                    }
                }
            }

            if (loaded)
            {
                if (loadFinishedEventHandler != null)
                {
                    HraListLoadedEventArgs args = new HraListLoadedEventArgs();
                    args.sender     = this;
                    args.workerArgs = new RunWorkerCompletedEventArgs(this, null, false);
                    loadFinishedEventHandler.Invoke(args);
                }
            }
            else
            {
                LoadList();
            }
        }
コード例 #32
0
        public SelectionHandler()
        {
            sceh = (s, e) =>
            {
                /*
                 * La ListView ci notifica che la selezione
                 * è cambiata.
                 *
                 * Per prima cosa ci sganciamo temporaneamente
                 * dalla gestione delle notifiche in modo da non
                 * innescare un meccanismo ricorsivo infinito
                 */
                this.Unwire();

                var bag = this.GetSelectedItemsBag();
                e.RemovedItems.Enumerate(obj =>
                {
                    var item = this.GetRealItem(obj);
                    if (bag.Contains(item))
                    {
                        bag.Remove(item);
                    }
                });

                e.AddedItems.Enumerate(obj =>
                {
                    var item = this.GetRealItem(obj);
                    if (!bag.Contains(item))
                    {
                        bag.Add(item);
                    }
                });

                this.Wire();
            };

            ncceh = (s, e) =>
            {
                this.Unwire();

                switch (e.Action)
                {
                case NotifyCollectionChangedAction.Add:
                {
                    this.AddToListViewSelection(e.NewItems);
                }
                break;

                case NotifyCollectionChangedAction.Remove:
                {
                    this.RemoveFromListViewSelection(e.OldItems);
                }
                break;

                case NotifyCollectionChangedAction.Reset:
                {
                    this.ClearListViewSelection();
                    this.AddToListViewSelection(this.GetSelectedItemsBag());
                }
                break;

                case NotifyCollectionChangedAction.Move:
                case NotifyCollectionChangedAction.Replace:
                    //NOP
                    break;

                default:
                    throw new NotSupportedException();
                }

                this.Wire();
            };

            lceh = (s, e) =>
            {
                this.Unwire();

                switch (e.ListChangedType)
                {
                case ListChangedType.ItemAdded:
                {
                    var bag  = ( IEntityView )this.selectedItems;
                    var item = bag[e.NewIndex];

                    this.AddToListViewSelection(new[] { item });
                }
                break;

                case ListChangedType.Reset:
                {
                    this.ClearListViewSelection();
                    this.AddToListViewSelection(this.selectedItems);
                }
                break;

                case ListChangedType.ItemDeleted:
                {
                    this.RemoveFromListViewSelectionAtIndex(e.NewIndex);
                }
                break;

                case ListChangedType.ItemChanged:
                case ListChangedType.ItemMoved:
                case ListChangedType.PropertyDescriptorAdded:
                case ListChangedType.PropertyDescriptorChanged:
                case ListChangedType.PropertyDescriptorDeleted:
                    //NOP
                    break;

                default:
                    throw new NotSupportedException();
                }

                this.Wire();
            };
        }
コード例 #33
0
 public EntityPersister()
 {
     InitializeComponent();
     bindingListChangedEventHandler = new ListChangedEventHandler(BindingSourceListChanged);
     bindingCurrentChangedEventHandler = new EventHandler(BindingSourceCurrentChanged);
 }
コード例 #34
0
ファイル: BoundListView.cs プロジェクト: tfreitasleal/MvvmFx
        /// <summary>
        /// Initializes a new instance of the <see cref="BoundListView"/> class.
        /// </summary>
        public BoundListView()
        {
            _listChangedHandler = ListManager_ListChanged;
            _positionChangedHandler = ListManager_PositionChanged;

            View = View.Details;
#if !WISEJ
            FullRowSelect = true;
            HideSelection = false;
#endif
            MultiSelect = false;
            LabelEdit = true;
        }
コード例 #35
0
ファイル: Table.cs プロジェクト: antiduh/XPTable
        /// <summary>
        /// Initializes a new instance of the Table class with default settings
        /// </summary>
        public Table()
        {
            // starting setup
            this.init = true;

            // This call is required by the Windows.Forms Form Designer.
            components = new System.ComponentModel.Container();

            //
            this.SetStyle(ControlStyles.UserPaint, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.Selectable, true);
            this.TabStop = true;

            this.Size = new Size(150, 150);

            this.BackColor = Color.White;

            //
            this.columnModel = null;
            this.tableModel = null;

            // header
            this.headerStyle = ColumnHeaderStyle.Clickable;
            this.headerAlignWithColumn = false;
            this.headerFont = this.Font;
            this.headerRenderer = new XPHeaderRenderer();
            //this.headerRenderer = new GradientHeaderRenderer();
            //this.headerRenderer = new FlatHeaderRenderer();
            this.headerRenderer.Font = this.headerFont;
            this.headerContextMenu = new HeaderContextMenu();
            this.includeHeaderInAutoWidth = true;

            this.columnResizing = true;
            this.resizingColumnIndex = -1;
            this.resizingColumnWidth = -1;
            this.hotColumn = -1;
            this.pressedColumn = -1;
            this.lastSortedColumn = -1;
            this.sortedColumnBackColor = Color.WhiteSmoke;

            // borders
            this.borderStyle = BorderStyle.Fixed3D;
            this.borderColor = Color.Black;
            this.unfocusedBorderColor = Color.Black;

            // scrolling
            this.scrollable = true;

            this.hScrollBar = new HScrollBar();
            this.hScrollBar.Visible = false;
            this.hScrollBar.Location = new Point(this.BorderWidth, this.Height - this.BorderWidth - SystemInformation.HorizontalScrollBarHeight);
            this.hScrollBar.Width = this.Width - (this.BorderWidth * 2) - SystemInformation.VerticalScrollBarWidth;
            this.hScrollBar.Scroll += new ScrollEventHandler(this.OnHorizontalScroll);
            this.Controls.Add(this.hScrollBar);

            this.vScrollBar = new VScrollBar();
            this.vScrollBar.Visible = false;
            this.vScrollBar.Location = new Point(this.Width - this.BorderWidth - SystemInformation.VerticalScrollBarWidth, this.BorderWidth);
            this.vScrollBar.Height = this.Height - (this.BorderWidth * 2) - SystemInformation.HorizontalScrollBarHeight;
            this.vScrollBar.Scroll += new ScrollEventHandler(this.OnVerticalScroll);
            this.vScrollBar.ValueChanged += new EventHandler(vScrollBar_ValueChanged);
            this.Controls.Add(this.vScrollBar);

            //
            this.gridLines = GridLines.None; ;
            this.gridColor = SystemColors.Control;
            this.gridLineStyle = GridLineStyle.Solid;

            this.allowSelection = true;
            this.allowRMBSelection = false;
            this.multiSelect = false;
            this.fullRowSelect = false;
            this.hideSelection = false;
            this.selectionBackColor = SystemColors.Highlight;
            this.selectionForeColor = SystemColors.HighlightText;
            this.unfocusedSelectionBackColor = SystemColors.Control;
            this.unfocusedSelectionForeColor = SystemColors.ControlText;
            this.selectionStyle = SelectionStyle.ListView;
            this.alternatingRowColor = Color.Transparent;
            this.alternatingRowSpan = 1;

            // current table state
            this.tableState = TableState.Normal;

            this.lastMouseCell = new CellPos(-1, -1);
            this.lastMouseDownCell = new CellPos(-1, -1);
            this.focusedCell = new CellPos(-1, -1);
            this.hoverTime = 1000;
            this.trackMouseEvent = null;
            this.ResetMouseEventArgs();

            this.toolTip = new ToolTip(this.components);
            this.toolTip.Active = false;
            this.toolTip.InitialDelay = 1000;

            this.noItemsText = "There are no items in this view";

            this.editingCell = new CellPos(-1, -1);
            this.curentCellEditor = null;
            this.editStartAction = EditStartAction.DoubleClick;
            this.customEditKey = Keys.F5;
            //this.tabMovesEditor = true;

            // showSelectionRectangle defaults to true
            this.showSelectionRectangle = true;

            // drang and drop
            _dragDropHelper = new DragDropHelper(this);
            _dragDropHelper.DragDropRenderer = new DragDropRenderer();

            // for data binding
            listChangedHandler = new ListChangedEventHandler(dataManager_ListChanged);
            positionChangedHandler = new EventHandler(dataManager_PositionChanged);
            dataSourceColumnBinder = new DataSourceColumnBinder();

            // finished setting up
            this.beginUpdateCount = 0;
            this.init = false;
            this.preview = false;
        }
コード例 #36
0
ファイル: VirtualMachine.cs プロジェクト: Zaneo/LittleMan
 public void SubscribeListChanged(ListChangedEventHandler handler)
 {
     _memory.ListChanged += handler;
 }
コード例 #37
0
 public void _0001(ListChangedEventHandler item)
 {
     //Discarded unreachable code: IL_0002
     //IL_0003: Incompatible stack heights: 0 vs 1
     _CandidateIssuer = (ListChangedEventHandler)Delegate.Combine(_CandidateIssuer, item);
 }
コード例 #38
0
ファイル: GBGMain.cs プロジェクト: A-Charvin/GBotGUI
        private void GBGMain_Load(Object sender, EventArgs e)
        {
            ttUpdater.Interval = 500;
            ttUpdater.Tick    += new EventHandler((o, ev) =>
            {
                long mil = totalRunTime.ElapsedMilliseconds,
                seconds  = mil / 1000,
                minutes  = seconds / 60 % 60,
                hours    = minutes / 60,
                days     = hours / 24;

                lblCurrentRunTime.Text = "Approx. " + days + "d " + (hours % 24) + "h " + (minutes % 60) + "m " + (seconds % 60) + "s";
            });

            bgw.WorkerSupportsCancellation = true;
            bgw.WorkerReportsProgress      = true;
            bgw.DoWork             += new DoWorkEventHandler(RunBot_Work);
            bgw.ProgressChanged    += new ProgressChangedEventHandler(bgw_ProgressChanged);
            bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgw_RunWorkerCompleted);

            Hotkey hkRunBot = new Hotkey(Keys.F12, false, true, true, false);

            hkRunBot.Pressed += delegate
            {
                if (btnStopBot.Enabled)
                {
                    StopBot();
                }
                else if (btnRunBot.Enabled)
                {
                    RunBot();
                }
            };

            hkRunBot.Register(this);

            Text += ASMVersion;

            WriteLogLine("Version: ", ASMVersion);
            WriteLogLine("Disclaimer: if you get caught, it's not my nor anyone else's problem. "
                         + "This understanding should be tacit. Deal with it (or don't use the "
                         + "program). By using this program you are agreeing to hold no one "
                         + "other than your cheating self responsible if anything goes wrong. "
                         + "Don't even attempt to contact me.");
            WriteLogLine("Oh, and you should probably consider disabling the UAC when running ",
                         "this bot, especially if you're encountering problems.");
            WriteLogLine("Finishing initialization...");
            ResetRunStatistics();

            long frequency      = Stopwatch.Frequency;
            long nanosecPerTick = (1000L * 1000L * 1000L) / frequency;

            WriteLogLine("**Timer frequency in ticks per second = ", frequency);
            WriteLogLine("*-*Duration stopwatch estimated to be accurate to within ",
                         nanosecPerTick, " nanoseconds on this system");

            // Load/Save dialogs
            saveFileDialog       = new SaveFileDialog();
            saveFileDialog.Title = "Choose Profile Location...";

            openFileDialog       = new OpenFileDialog();
            openFileDialog.Title = "Select Profile...";

            saveFileDialog.InitialDirectory = openFileDialog.InitialDirectory = profileController.DefaultSaveDirectory;
            saveFileDialog.DefaultExt       = openFileDialog.DefaultExt = Properties.Settings.Default.ProfileFileExtension;
            saveFileDialog.Filter           = openFileDialog.Filter = "profiles (*."
                                                                      + Properties.Settings.Default.ProfileFileExtension
                                                                      + ")|*."
                                                                      + Properties.Settings.Default.ProfileFileExtension
                                                                      + "|All files (*.*)|*.*";

            // Set up MouseTracker
            Timer mouseTrackerTimer = new Timer();

            mouseTrackerTimer.Interval = 200;
            mouseTrackerTimer.Tick    += new EventHandler(mouseTrackerTimer_Tick);

            // Set up events
            profileController.Profiles.ListChanged += new ListChangedEventHandler((o, ev) =>
            {
                if (profileController.Profiles.Count > 0)
                {
                    cbProfileSelector.Enabled = true;
                }
                else
                {
                    cbProfileSelector.Enabled = false;
                }
            });

            lbNodesListChangedEventHandler = new ListChangedEventHandler(nodeList_ListChanged);

            // ListControls
            cbProfileSelector.DataSource    = profileController.Profiles;
            lbNodes.DisplayMember           = "Display";
            cbProfileSelector.DisplayMember = "Display";

            // Load/Create the default profile
            profileController.ProfileControllerAction +=
                new ProfileController.ProfileControllerActionHandler(profileController_ProfileControllerAction);

            String errpath = "(unknown location)";

            mouseTrackerTimer.Enabled = true;

            try
            {
                EnableInitialControls();

                if (File.Exists(profileController.PathOfDefaultProfile))
                {
                    profileController.LoadProfile(errpath = profileController.PathOfDefaultProfile);
                }

                else
                {
                    NodeProfile profile =
                        new NodeProfile("default", profileController.DefaultSaveDirectory, new BindingList <GenericNode>());

                    errpath = profile.FilePath;
                    profileController.SaveProfile(profile);
                    profileController.LoadProfile(profile.FilePath);
                }

                SetCurrentAction("Idle (fully initialized)");
                elbNodes = new ExtendedListControl <GenericNode>(lbNodes);
                profileController.Profiles.ResetBindings();
            }

            catch (System.Runtime.Serialization.SerializationException ouch)
            {
                WriteLogLine(
                    "ERROR: Failed to mutate your default profile.",
                    "If you continue to see this error, please  ",
                    "delete the following file: \"", errpath, "\".");
                WriteLogLine("WARNING: Due to Profile functionality being unavailable for the duration ",
                             "of this session, program functionality has become limited.");

                menuStripMain.Enabled = false;
                SetCurrentAction("Idle (bad startup; check logs)");
            }
        }
コード例 #39
0
        private void GBGCreateAndModify_Load(Object sender, EventArgs e)
        {
            txbName.Text = _internalNode.Name;
            lbRecords.DataSource = InternalNode.Settings.Records;
            elbRecords = new ExtendedListControl<RecordBase>(lbRecords);
            recordListChangedHandler = new ListChangedEventHandler(Records_ListChanged);

            lbRecords.DisplayMember = "Display";
            setDefaultTitle();

            InternalNode.Settings.Records.ListChanged += recordListChangedHandler;
            InternalNode.Settings.Records.ResetBindings();
        }
コード例 #40
0
        private void ComposeChildNotifications(PropertyDescriptor property, object oldValue, object newValue)
        {
            if (composedChildNotifications == null)
            {
                composedChildNotifications = new Dictionary <object, object>();
            }

            if (oldValue != null)
            {
                object handler;
                if (composedChildNotifications.TryGetValue(oldValue, out handler))
                {
                    composedChildNotifications.Remove(oldValue);

                    if (oldValue is INotifyPropertyChanged)
                    {
                        ((INotifyPropertyChanged)oldValue).PropertyChanged -= Child_PropertyChanged;
#if !SILVERLIGHT
                        if (oldValue is INotifyPropertyChanging)
                        {
                            ((INotifyPropertyChanging)oldValue).PropertyChanging -= Child_PropertyChanging;
                        }
                    }
                    else if (oldValue is IBindingList)
                    {
                        ((IBindingList)oldValue).ListChanged -= (ListChangedEventHandler)handler;
#endif
                    }
                }
            }

            if (newValue != null && !composedChildNotifications.ContainsKey(newValue))
            {
                if (newValue is INotifyPropertyChanged)
                {
                    ((INotifyPropertyChanged)newValue).PropertyChanged += Child_PropertyChanged;

#if !SILVERLIGHT
                    if (newValue is INotifyPropertyChanging)
                    {
                        ((INotifyPropertyChanging)newValue).PropertyChanging += Child_PropertyChanging;
                    }

                    composedChildNotifications.Add(newValue, null);
                }
                else if (newValue is IBindingList)
                {
                    ListChangedEventHandler handler = (sender, args) =>
                    {
                        if (propagateChildNotifications)
                        {
                            var propertyChanged = PropertyChanged;

                            if (propertyChanged != null)
                            {
                                if (args.PropertyDescriptor != null)
                                {
                                    var propertyName = args.PropertyDescriptor.Name;
                                    propertyChanged(sender, new PropertyChangedEventArgs(propertyName));
                                }
                                propertyChanged(this, new PropertyChangedEventArgs(property.PropertyName));
                            }
                        }
                    };
                    ((IBindingList)newValue).ListChanged += handler;

                    composedChildNotifications.Add(newValue, handler);
#endif
                }
            }
        }
コード例 #41
0
 public ToolStripPickTextBox()
 {
     listChangedHandler             = new ListChangedEventHandler(dataManager_ListChanged);
     positionChangedHandler         = new EventHandler(dataManager_PositionChanged);
     Control.BindingContextChanged += ControlOnBindingContextChanged;
 }