/// <summary> /// Change TextBoxEdges.ToolTip after input text to TextBoxVertex /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void TextBoxNodes_TextChanged(object sender, TextChangedEventArgs e) { if (!await TheCorrectnessOfData.IsTheCorrectNumberOfEdges(TextBoxEdges.Text, TextBoxNodes.Text)) { return; } TextBoxEdges.ToolTip = $"m < {Calculations.CalculateTheBorderNumberOfEdges(int.Parse(TextBoxNodes.Text))}"; }
private async void DrawGraphBtn_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (!int.TryParse(TextBoxVertices.Text, out int verticesResult) || !double.TryParse(TextBoxPropability.Text, out double propabilityResult)) { return; } GraphArray = await ArrayCreator.GenerateGraphArray(verticesResult, propabilityResult); GraphArea.LogicCore = GraphAreaModel.GraphArea_Setup(Graph.Graph_Setup(GraphArray)); GraphAreaModel.GraphAreaSetupLayoutAlgorithm((LayoutAlgorithmTypeEnum)LayoutAlgorithmComboBox.SelectedIndex); InitializeGraph(); if (!await TheCorrectnessOfData.checkGraphCompact(GraphArray)) { MessageBox.Show("Graph is not compact!!"); } }
/// <summary> /// Check text before input /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void TextBoxEdges_PreviewTextInput(object sender, TextCompositionEventArgs e) => e.Handled = !await TheCorrectnessOfData.IsTextAllowed(e.Text);