public FormSelectionListener() { InitializeComponent(); this.Location = Settings.Current.location; this.Size = Settings.Current.size; this.scItems.SplitterDistance = Settings.Current.splitterPosition; this.cbListen.Checked = Settings.Current.active; this.StartUserActivityBroadcaster(); this.cbListen.CheckedChanged += new System.EventHandler(this.cbListen_CheckedChanged); this.btnClearLockedSelectionItems.Click += new System.EventHandler(this.btnClearLockedSelectionItems_Click); this.btnClearSelectionItems.Click += new System.EventHandler(this.btnClearSelectionItems_Click); this.Move += new EventHandler(FormSelectionListener_Move); this.Resize += new EventHandler(FormSelectionListener_Resize); this.scItems.SplitterMoved += new SplitterEventHandler(scItems_SplitterMoved); this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.FormSelectionListener_FormClosed); this._fixedSelectionItem = new SelectionItem(this, "(Nothing hovered so far)"); this.flpPickedSelectionItem.Controls.Add(this._fixedSelectionItem); this._fixedSelectionItem.BackColor = Color.Green; this.UpdateFixedItemWidth(); Focuser.Current.Start(); }
internal void UnlockSelectionItem(SelectionItem item) { this.flpLockedItems.Controls.Remove(item); //item.Width = this.GetItemWidth(); item.cbLock.BackgroundImage = global::EnsoPlus.Properties.Resources.Unlocked; this.flpItems.Controls.Add(item); this.flpItems.ScrollControlIntoView(item); UpdateAllLockedItemsWidths(); UpdateAllItemsWidths(); }
private void UpdateSelectionItemColor(SelectionItem selectionItem) { if (selectionItem == this._pickedSelectionItem) { } else if (selectionItem == this._currentSelectionItem) { } else { } }
internal void RemoveSelectionItem(SelectionItem item) { if (item.cbLock.Checked) { this.flpLockedItems.Controls.Remove(item); UpdateAllLockedItemsWidths(); } else { this.flpItems.Controls.Remove(item); this.UpdateAllItemsWidths(); } }
internal bool UpdateLastSelectionItem(string lastAddedSelection, string selection) { bool updated = false; FormSelectionListener.Current.flpItems.Invoke((Action)(() => { if (this.flpItems.Controls.Count > 0) { SelectionItem lastSelectionItem = (SelectionItem)this.flpItems.Controls[this.flpItems.Controls.Count - 1]; if (lastSelectionItem.Content == lastAddedSelection) { lastSelectionItem.Content = selection; updated = true; } } })); return(updated); }
internal void SetPickedSelectionItem(SelectionItem selectionItem) { if (this._pickedSelectionItem != null) { if (this._pickedSelectionItem == this._currentSelectionItem) { this._currentSelectionItem.BackColor = Color.DarkBlue; } else if (this._pickedSelectionItem != this._fixedSelectionItem) { this._pickedSelectionItem.BackColor = SystemColors.ButtonFace; } } this._pickedSelectionItem = selectionItem; this._pickedSelectionItem.BackColor = Color.Green; this._fixedSelectionItem.Content = this._pickedSelectionItem.Content; }
internal void AddSelectionItem(string selection) { FormSelectionListener.Current.flpItems.Invoke((Action)(() => { SelectionItem newSelectionItem = null; //search old items int i = this.flpItems.Controls.Count - 1; while (i >= 0) { SelectionItem currentSelectionItem = (SelectionItem)this.flpItems.Controls[i]; if (string.Compare(selection, currentSelectionItem.Content, StringComparison.Ordinal) == 0) { newSelectionItem = currentSelectionItem; break; } i--; } if (newSelectionItem == null) { if (this.flpItems.Controls.Count >= Settings.Current.queueLength) { this.flpItems.Controls.RemoveAt(0); } newSelectionItem = new SelectionItem(FormSelectionListener.Current, selection); //newSelectionItem.Width = this.GetItemWidth(); this.flpItems.Controls.Add(newSelectionItem); UpdateAllItemsWidths(); } if (!Focuser.Current.IsFocused) { this.flpItems.ScrollControlIntoView(newSelectionItem); } this.SetCurrentSelectionItem(newSelectionItem); })); Application.DoEvents(); }