/// <summary> /// Selects the given nodes. /// </summary> /// <param name="items"></param> private void SetSelectedObjects(IEnumerable <Item> items) { // Updates selection SelectedObjects = items == null ? new List <Item>() : new List <Item>(items); // Selects the proper nodes if (SelectedObjects.Count() == 1) { // If the object is not already selected Item obj = SelectedObjects.First(); tvItems.SelectNodeWithTag(obj); } // Notify subscribers SelectionChanged?.ThreadSafeInvoke(this, new EventArgs()); }
private void RevertChanges(string senderName) { if (senderName.Equals("ReportCommentEditDenie")) { SelectedTask.SupervisorComment = ReporterCommentCache; } else if (senderName.Equals("AssigneeCommentEditDenie")) { SelectedTask.EmployeeComment = AssigneeCommentCache; } else if (senderName.Equals("DonePercentageEditDenie")) { SelectedTask.SupervisorDonePercent = DonePercentageCache; } SelectionChanged?.Invoke(); }
public void AddSelection(Gwen.Control.Base pControl, bool fireEvent) { Cage pCage = new Cage(this); pCage.Setup(pControl); pCage.Moving += OnCageMoving; m_Selected.Add(pControl); if (fireEvent && SelectionChanged != null) { SelectionChanged.Invoke(m_Selected); } Redraw(); }
public void GivenMonitoredTarget_WhenMonitoringStatusChanged_ThenProperEventIsRaised() { KeyValuePair <MonitoringTarget, bool> eventResult = new KeyValuePair <MonitoringTarget, bool>(MonitoringTarget.RAM_Usage, false); MonitoringTargetViewModel targetSubject = new MonitoringTargetViewModel(MonitoringTarget.CPU_Load); targetSubject.IsSelected = true; targetSubject.DisplayName = "TEST"; SelectionChanged selectionChangedTestHandler = new SelectionChanged((arg) => eventResult = arg); targetSubject.SelectionChangedEvent += selectionChangedTestHandler; targetSubject.PublishMonitoringOptionStatusCommand.Execute(null); Assert.Equal(new KeyValuePair <MonitoringTarget, bool>(MonitoringTarget.CPU_Load, true), eventResult); targetSubject.SelectionChangedEvent -= selectionChangedTestHandler; }
public void SelectModel(SelectableModel model, bool unselectOthers) { if (model.Selected) { return; } if (unselectOthers) { UnselectAll(); } model.Selected = true; model.Refresh(); SelectionChanged?.Invoke(model); }
private void SeatEntity_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (_isSelected == null) { _isSelected = Value.IsSelected; } else { if (_isSelected.Value != Value.IsSelected) { _isSelected = Value.IsSelected; SelectionChanged?.Invoke(Value); } } }
protected void NotifyHighlightChanged() { SelectionChanged handler = OnHighlightChanged; if (handler != null) { if (RenderInfo.Highlight != null) { handler(RenderInfo.Highlight.Primitive, RenderInfo.Highlight.SelectedTriangleIndex, RenderInfo.Highlight.SelectedTriangleIsOpaque); } else { handler(null, -1, false); } } }
public void SetSelected(int index) { for (var i = 0; i < m_Widgets.Length; i++) { if (i == index) { m_Widgets[i].Selected = !m_Widgets[i].Selected; } else { m_Widgets[i].Selected = false; } } SelectionChanged?.Invoke(index); }
public RevisionBrowser() { _initializing = true; InitializeComponent(); _initializing = false; _treeView.Model = new RevisionBrowserModel(); _treeView.SelectionChanged += (s, e) => SelectionChanged?.Invoke(s, e); _treeView.RowDraw += treeView_DrawRow; _name.ToolTipProvider = new NameTooltipProvider(); _name.DrawText += treeView_DrawNode; _timestamp.ToolTipProvider = new TimeStampTooltipProvider(); _timestamp.DrawText += treeView_DrawNode; }
private void keys_keysequence_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (keys_keysequence.SelectedItems.Count <= 1) { this.sequence_up.IsEnabled = IsEnabled && true; this.sequence_down.IsEnabled = IsEnabled && true; } else { this.sequence_up.IsEnabled = IsEnabled && false; this.sequence_down.IsEnabled = IsEnabled && false; } // Bubble the selection changed event SelectionChanged?.Invoke(this, e); }
void OnColorWheelSelectionChanged(object sender, EventArgs e) { Color selcol = m_colorWheel.SelectedColor; if (selcol != null && selcol != m_selectedColor) { m_selectedColor = selcol; m_colorSample.Refresh(); if (lockColorTable == false && selcol != m_colorTable.SelectedItem) { m_colorTable.SetCustomColor(selcol); } } UpdateInfo(); SelectionChanged?.Invoke(this, null); }
void XSelectionChangeListener.selectionChanged(EventObject aEvent) { // Logger.Instance.Log(LogPriority.DEBUG, this, "[SELECTION INFO] Selection changed in forwarder"); if (SelectionChanged != null) { try { SelectionChanged.Invoke(this, new ForwardedEventArgs(aEvent)); } catch (Exception e) { Logger.Instance.Log(LogPriority.ALWAYS, this, "[ERROR] Could not forward selection event: " + e); } } }
private void HandleItemSelection(ItemClickEventArgs args) { if (SelectionMode != ListViewSelectionMode.None) { var newSelection = ListViewAdapter.GetItemAt(args.Position); switch (SelectionMode) { case ListViewSelectionMode.Single: var selectedItem = ListViewAdapter.SelectedItems.FirstOrDefault(); // Unselect the current item only if a new selection is made or // the option to unselect the current item is activated. if (selectedItem != null && (selectedItem != newSelection || UnselectOnClick)) { ListViewAdapter.SetItemSelection(selectedItem, null, false); } if (selectedItem != newSelection) { ListViewAdapter.SetItemSelection( newSelection, (args.View as ItemContainerHolder)?.Child as SelectorItem, true ); } SelectedItem = newSelection; if (selectedItem != newSelection) { SelectionChanged?.Invoke(this, new SelectionChangedEventArgs(this, new[] { selectedItem }, new[] { newSelection })); } break; case ListViewSelectionMode.Multiple: ListViewAdapter.SetItemSelection( ListViewAdapter.GetItemAt(args.Position), args.View as SelectorItem, !ListViewAdapter.SelectedItems.Contains(newSelection) ); break; } SelectedItems = ListViewAdapter.SelectedItems.ToArray(); } }
public void SelectModel(SelectableModel model, bool unselectOthers) { if (_selectedModels.Contains(model)) { return; } if (unselectOthers) { UnselectAll(); } model.Selected = true; _selectedModels.Add(model); model.Refresh(); SelectionChanged?.Invoke(model, true); }
/// <summary> /// Called when public properties changed. /// </summary> /// <param name="name">The name of the property.</param> public void OnPropertyChanged([CallerMemberName] string name = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); if (name == nameof(IsSelected)) { SelectionChanged?.Invoke(this, EventArgs.Empty); } else if (name == nameof(Name)) { NodeChanged?.Invoke(this, new NodeChangedEventArgs(NodeChangeEventType.NodeNameChanged)); } else if (name == nameof(Comment)) { NodeChanged?.Invoke(this, new NodeChangedEventArgs(NodeChangeEventType.NodeCommentChanged)); } }
public void AddItems(IEnumerable <TItem> items) { foreach (var item in items) { if (!selectedItems.Contains(item)) { selectedItems.Add(item); } } if (items != null && items.Count() > 0) { doNotRenderOnce = true; selectedItemsSubject.OnNext(selectedItems); SelectionChanged.InvokeAsync(new Selection <TItem>(selectedItems)); } }
/// <summary> /// Close listbox and update textbox, and invoke SelectionChanged /// event. /// </summary> /// <param name="sender">Selected control.</param> protected void OnSelectionChanged(UIComponent sender) { // Update text string text = this.listBox.GetSelectedText(); if (text != null) { this.textBox.Text = text; } CloseListBox(); if (SelectionChanged != null) { SelectionChanged.Invoke(this); } }
public void SelectSameDir(FileItem item, bool selected) { bool changed = false; foreach (FileItem fileItem in this) { if (fileItem.DirName == item.DirName && fileItem.Selected != selected) { fileItem.Selected = selected; changed = true; } } if (changed) { SelectionChanged?.Invoke(this, EventArgs.Empty); } }
public int Find(string str, bool caseSensitive) { int pos; try { pos = Text.IndexOf(str, caseSensitive == false ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal); if (pos != -1) { Select(pos, str.Length); SelectionChanged?.Invoke(this, new EventArgs()); } } catch (Exception ex) { MessageBox.Show("Não foi possível realizar a busca do texto\n" + ex.Message); return(-1); } return(pos); }
public void UnselectAll() { foreach (var model in _selectedModels.ToList()) { if (!model.Selected) // In case it got unselected by something else, like grouping { continue; } model.Selected = false; model.Refresh(); // Todo: will result in many events, maybe one event for all of them? SelectionChanged?.Invoke(model, false); } _selectedModels.Clear(); }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (e.Button != MouseButtons.Left) { return; } if (hovered.Index == -1) { return; } mouseDown = false; marginScrollTimer.Stop(); if (selecting) { int min = Math.Min(selectRangeStart, selectRangeEnd); int max = Math.Max(selectRangeStart, selectRangeEnd); if (subtract) { LastSelectedItem = Select(min, max, SelectionChangeMode.SUBTRACT); } else if (keepTheRest) { LastSelectedItem = Select(min, max, SelectionChangeMode.ADD); } else { LastSelectedItem = Select(min, max, SelectionChangeMode.SET); } prevSelectStartIndex = selectRangeStart; selectRangeStart = -1; selectRangeEnd = -1; keepTheRest = true; SelectionChanged?.Invoke(this, EventArgs.Empty); } selecting = false; }
public void Add(FrameworkElement item) { if (_currentRow == this.RowsCount) { return; } if (item == null) { return; } if (this.ItemsPanelRoot?.Children == null) { return; } item.Width = this.ItemWidth; item.Height = this.ItemHeight; var proCalendarToggleButton = item as ProCalendarToggleButton; if (proCalendarToggleButton != null) { proCalendarToggleButton.Selected -= OnSelected; proCalendarToggleButton.Selected += OnSelected; proCalendarToggleButton.Unselected -= OnSelected; proCalendarToggleButton.Unselected += OnSelected; void OnSelected(object sender, RoutedEventArgs e) => SelectionChanged?.Invoke(sender, null); } Grid.SetColumn(item, _currentColumn); Grid.SetRow(item, _currentRow); _currentColumn++; if (_currentColumn == this.ColumnsCount) { _currentColumn = 0; _currentRow++; } this.ItemsPanelRoot.Children.Add(item); }
partial void OnSelectedItemChangedPartial(object oldSelectedItem, object newSelectedItem) { var row = Items?.IndexOf(newSelectedItem) ?? -1; if (row == -1) // item not found { var firstItem = Items?.FirstOrDefault(); if (firstItem != newSelectedItem) // We compare to 'newSelectedItem' so we allow them to be both 'null' { SelectedItem = firstItem; return; } if (Items.Length > 0) // If we have no Items, we don't need to call UIPickerView.Select(). Skipping the call avoids a native crash under certain narrow circumstances. (https://github.com/unoplatform/private/issues/115) { Select(row, component: 0, animated: true); } } else if (newSelectedItem != null && Items[0] == null) { // On ItemSelection remove initial null item at Items[0] Items = Items .Skip(1) .ToObjectArray(); // Now that Items changed, we must reload the UIPickerView's components. ReloadAllComponents(); // Because we removed the first item, we decrement the row by 1. --row; // We select the row without the animation, because the previous state has a different items source in wich the items have different indexes. Select(row, component: 0, animated: false); } SelectionChanged?.Invoke( this, // TODO: Add multi-selection support new SelectionChangedEventArgs( this, new[] { oldSelectedItem }, new[] { newSelectedItem } ) ); }
private void CheckedListBox_ItemCheck(object sender, ItemCheckEventArgs e) { checkedListBox.ItemCheck -= CheckedListBox_ItemCheck; if (!MultiSelection) { if (e.Index != lastCheckedIndex) { if (lastCheckedIndex != -1) { checkedListBox.SetItemCheckState(lastCheckedIndex, CheckState.Unchecked); } lastCheckedIndex = e.Index; } } SelectionChanged?.Invoke(sender, e); checkedListBox.ItemCheck += CheckedListBox_ItemCheck; }
public async Task ToggleSelectedAsync(BaseTableRow row) { if (row.Selected) { var current = Current; Current = row; if (current != null && current != row && current.Selected) { await current.ToggleSelectedAsync(); } SelectionChanged?.Invoke(Current.RowItem); } else { SelectionChanged?.Invoke(null); } }
public void ModifySelection(int newSelectionItem, bool onlyRemove) { if (onlyRemove) { if (SelectedFaces.Contains(newSelectionItem)) { SelectedFaces.Remove(newSelectionItem); } } else { if (!SelectedFaces.Contains(newSelectionItem)) { SelectedFaces.Add(newSelectionItem); } } SelectionChanged?.Invoke(this); }
protected void _tabHeaderControl_SelectionChanged(object sender, System.EventArgs e) { if ((_selectedUserControl != null) && (Children.Contains(_selectedUserControl))) { Children.Remove(_selectedUserControl); } _selectedUserControl = null; if ((TabHeaderControl.SelectedIndex > -1) && (TabHeaderControl.SelectedIndex < _items.Count)) { _selectedUserControl = _items[TabHeaderControl.SelectedIndex].Key; Children.Add(_selectedUserControl); SetSelectedUserControlGridPosition(); } CheckTabCount(); SelectionChanged?.Invoke(sender, e); }
private void UpdateStrokes() { App.Current.Dispatcher.Invoke(() => { // Do we need a lock here? IsRefreshingStrokes = true; var newStrokes = new StrokeCollection(StrokeCollection.GetMergedStrokeMaps()); Strokes.Clear(); Strokes.Add(newStrokes); if (EditingMode == InkCanvasEditingMode.Select) { SelectionChanged?.Invoke(SelectedStrokes); } IsRefreshingStrokes = false; }); }
public override uint MouseMove(MouseEventArgs e, Point lastMousePos, GL_ControlBase control) { uint var = 0; foreach (IEditableObject obj in GetObjects()) { var |= obj.MouseMove(e, lastMousePos, control); } foreach (AbstractGlDrawable obj in StaticObjects) { var |= obj.MouseMove(e, lastMousePos, control); } if (SelectionTransformAction != NoAction || CurrentAction != null) { SelectionTransformAction.UpdateMousePos(e.Location); CurrentAction?.UpdateMousePos(e.Location); var |= REDRAW | NO_CAMERA_ACTION; var &= ~REPICK; } else { if (e.Button == MouseButtons.Left && WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftAlt)) { if (WinInput.Keyboard.IsKeyDown(WinInput.Key.LeftShift)) { Hovered?.Deselect(HoveredPart, control); } else { Hovered?.Select(HoveredPart, control); } SelectionChanged?.Invoke(this, new EventArgs()); var |= NO_CAMERA_ACTION | FORCE_REENTER; } var |= REPICK; } return(var); }
private void OnSelectionChanges() { _isUpdatingSelection = true; // Update tree var selection = Selection; if (selection.Count == 0) { _tree.Deselect(); } else { // Find nodes to select var nodes = new List <TreeNode>(selection.Count); for (int i = 0; i < selection.Count; i++) { if (selection[i] is ActorNode node) { nodes.Add(node.TreeNode); } } // Select nodes _tree.Select(nodes); // For single node selected scroll view so user can see it if (nodes.Count == 1) { nodes[0].ExpandAllParents(true); ScrollViewTo(nodes[0]); } } // Update properties editor var objects = Selection.ConvertAll(x => x.EditableObject).Distinct(); _propertiesEditor.Select(objects); _isUpdatingSelection = false; // Send event SelectionChanged?.Invoke(); }
public void SetListener(SelectionChanged l) { listener = l; ListenSelectionChanges(null, null); }