private void tsSetDeny_Click(object sender, EventArgs e) { SelectionBase selection = (SelectionBase)grid1.Selection; var region = selection.GetSelectionRegion(); foreach (var range in region) { for (int i = range.Start.Row; i <= range.End.Row; i++) { string channel = grid1[i, 2].Value.ToString(); string item = grid1[i, 3].Value.ToString(); if (!Deny.ContainsKey(channel)) { Deny.Add(channel, new List <string>()); } Deny[channel].Add(item); } } _Save(); _ApplyAllowDeny(); c_Summary.SetValue(m_Channels.Count); m_DenyForm.ResetItem(); var sum = Deny.Sum(entry => entry.Value.Count); tsDeny.Text = sum == 0 ? string.Empty : $"[{sum}]"; }
public int CompareTo(SelectionBase other) { if (other is Rock) { return(1); } if (other is Paper) { return(0); } if (other is Scissors) { return(-1); } if (other is Lizard) { return(-1); } if (other is Spock) { return(1); } throw new InvalidOperationException("Is this the same game?"); }
/// <summary> /// Test running the node, then clearing the /// selection and running again. /// </summary> /// <typeparam name="T1"></typeparam> /// <typeparam name="T2"></typeparam> /// <param name="selectNode"></param> private void TestSingleSelection <T1, T2>(SelectionBase <T1, T2> selectNode) { var element = GetPreviewValue(selectNode.GUID.ToString()); Assert.NotNull(element); selectNode.ClearSelections(); RunCurrentModel(); element = GetPreviewValue(selectNode.GUID.ToString()); Assert.Null(element); }
/// <summary> /// Test running the node, then clearing the /// selection and running again. /// </summary> /// <typeparam name="T1"></typeparam> /// <typeparam name="T2"></typeparam> /// <param name="selectNode"></param> private void TestMultipleSelection <T1, T2>(SelectionBase <T1, T2> selectNode) { var elements = GetPreviewCollection(selectNode.GUID.ToString()); Assert.NotNull(elements); Assert.Greater(elements.Count(), 0); selectNode.ClearSelections(); RunCurrentModel(); elements = GetPreviewCollection(selectNode.GUID.ToString()); Assert.Null(elements); }
/// <summary> /// /// </summary> /// <param name="ASender">sender</param> /// <param name="AEventArgs">event</param> protected void GrdColumns_CellLostFocus(SelectionBase ASender, ChangeActivePositionEventArgs AEventArgs) { System.Int32 newcolumn; newcolumn = AEventArgs.NewFocusPosition.Column; AEventArgs.Cancel = false; if ((FSelectedColumn != -1) && (newcolumn != -1) && (newcolumn != FSelectedColumn) && (!SelectColumn(-1))) { AEventArgs.Cancel = true; } }
public void CustomizeView(SelectionBase <TSelection, TResult> model, NodeView nodeView) { Model = model; SelectCommand = new DelegateCommand(() => Model.Select(null), Model.CanBeginSelect); var selectionControl = new ElementSelectionControl { DataContext = this }; nodeView.inputGrid.Children.Add(selectionControl); }
private void ArtCellGotFocus(SelectionBase sender, ChangeActivePositionEventArgs e) { _needLoadArt = false; _artPosition = e.NewFocusPosition; _selectedArt = _artDtos[_artPosition.Row - 1]; lArt.Text = _selectedArt.FullName; if (_searchMode && !_searchChanging) { _searchString = ""; lInfo.Text = $"Поиск: {_searchString}"; } }
protected override void Dispose(bool disposing) { if (disposing) { if (image != null) { image.Dispose(); image = null; } if (checkerBoardBitmap != null) { checkerBoardBitmap.Dispose(); checkerBoardBitmap = null; } if (selectionRegion != null) { selectionRegion.Dispose(); selectionRegion = null; } if (path != null) { path.Dispose(); path = null; } if (selectionClass != null) { selectionClass.Dispose(); selectionClass = null; } if (scaledImage != null) { scaledImage.Dispose(); scaledImage = null; } if (outlinePen1 != null) { outlinePen1.Dispose(); outlinePen1 = null; } if (outlinePen2 != null) { outlinePen2.Dispose(); outlinePen2 = null; } if (normalizedPath != null) { normalizedPath.Dispose(); normalizedPath = null; } } base.Dispose(disposing); }
public override string GetWinningVerb(SelectionBase other) { if (other is SelectionBase.Paper) { return("cuts"); } if (other is SelectionBase.Lizard) { return("decapitates"); } throw new InvalidOperationException("Are we playing the same game?"); }
private void tsRestart_Click(object sender, EventArgs e) { SelectionBase selection = (SelectionBase)grid1.Selection; var region = selection.GetSelectionRegion(); foreach (var range in region) { for (int i = range.Start.Row; i <= range.End.Row; i++) { string key = $"{grid1[i, 2].Value.ToString()}.{grid1[i, 3].Value.ToString()}"; m_Channels[key].Start(); } } }
public void CustomizeView(SelectionBase <TSelection, TResult> model, NodeView nodeView) { Model = model; SelectCommand = new DelegateCommand(() => Model.Select(null), Model.CanBeginSelect); Model.PropertyChanged += (s, e) => { if (e.PropertyName == "CanSelect") { SelectCommand.RaiseCanExecuteChanged(); } }; var selectionControl = new ElementSelectionControl { DataContext = this }; nodeView.inputGrid.Children.Add(selectionControl); }
public string GetWinningVerb(SelectionBase other) { if (other is Scissors) { return("crushes"); } if (other is Lizard) { return("crushes"); } if (other is Zombie) { return("trips"); } throw new InvalidOperationException("Is this the same game?"); }
/// <summary> /// Select the new column. /// </summary> /// <param name="ASender">sender</param> /// <param name="AEventArgs">event</param> protected void GrdColumns_CellGotFocus(SelectionBase ASender, ChangeActivePositionEventArgs AEventArgs) { System.Int32 newcolumn; if (FDuringApplyOrCancel == true) { grdColumns.Selection.ResetSelection(false); return; } newcolumn = AEventArgs.NewFocusPosition.Column; AEventArgs.Cancel = false; if ((FSelectedColumn != -1) && (newcolumn != -1) && (newcolumn != FSelectedColumn) && (!SelectColumn(-1))) { AEventArgs.Cancel = true; grdColumns.Selection.SelectColumn(FSelectedColumn, true); } }
public Canvas() { InitializeComponent(); DoubleBuffered = true; SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.Selectable, true); imageBounds = Rectangle.Empty; selectionRegion = null; image = null; checkerBoardBitmap = null; path = null; selectionClass = null; zoomFactor = 1f; resetClip = false; scaledImage = null; isDirty = false; normalizedPath = null; }
public override int CompareTo(SelectionBase other) { if (other is Rock) { return(-1); } if (other is Scissors) { return(0); } if (other is Lizard) { return(1); } if (other is Spock) { return(-1); } throw new InvalidOperationException("Are we playing the same game?"); }
public Rule(SelectionBase Winner, string winningPhrase, SelectionBase loser) { Winner = this.Winner; Loser = loser; WinningPhrase = winningPhrase; }