public void InitModel(bool isInitAnew) { StateSwitcher(false); if (blockSchemeWindow != null) { blockSchemeWindow.WindowDisposal(); blockSchemeWindow = null; } if (isInitAnew) { SetArrays(InitialArraySize); ButtonsReset(); } ModelVarSubst.ItemsSource = null; ErrorVarSubst.ItemsSource = null; ModelVars.Clear(); ErrorVars.Clear(); determinantTextBox.Clear(); substitutionTextBox.Clear(); for (int i = 0; i < ResCount; i++) { Results[i] = string.Empty; SubstitutionResults[i] = string.Empty; } SignalOut = string.Empty; SignalIn = string.Empty; CompleteTransRatio.IsChecked = false; TransRatioOutTxtBox.Text = string.Empty; TransRatioInTxtBox.Text = string.Empty; }
private void StartBlockScheme_Click(object sender, RoutedEventArgs e) { blockSchemeWindow = new BlockSchemeWindow(); blockSchemeWindow.Owner = this; blockSchemeWindow.mainWindow = this; blockSchemeWindow.ShowDialog(); if (!string.IsNullOrEmpty(BlockSchemePath)) { StateSwitcher(true); } }
private void OpenModelCmdExecuted(object sender, ExecutedRoutedEventArgs e) { string exception; ModelItemsToSerialize modelItemsToSerialize = (ModelItemsToSerialize)OpenSaveClass.OpenDialog(ModelType.Matrix, out exception); if (modelItemsToSerialize == null) { if (!string.IsNullOrEmpty(exception)) { MessageBox.Show("Неможливо відкрити файл моделі внаслідок:\n" + exception); } return; } this.RowArray = modelItemsToSerialize.RowArray; this.ModelVars = modelItemsToSerialize.ModelVars; this.ErrorVars = modelItemsToSerialize.ErrorVars; this.Results = modelItemsToSerialize.Results; this.SubstitutionResults = modelItemsToSerialize.SubstitutionResults; this.BlockSchemePath = modelItemsToSerialize.BlockSchemePath; this.SignalOut = modelItemsToSerialize.SignalOut; this.SignalIn = modelItemsToSerialize.SignalIn; modelItemsToSerialize.Clear(); modelItemsToSerialize = null; int arraySize = RowArray.Length, count = dataTable.Columns.Count; if (arraySize > count) { for (int i = count; i < arraySize; i++) { column = new DataGridTextColumn(); column.Header = Convert.ToString(i + 1); column.Binding = new Binding("Row[" + i + "]"); dataTable.Columns.Add(column); } } else if (arraySize < count) { for (int i = count - 1; i >= arraySize; i--) { dataTable.Columns.RemoveAt(i); } } dataTable.ItemsSource = null; dataTableXB.ItemsSource = null; ModelVarSubst.ItemsSource = null; ErrorVarSubst.ItemsSource = null; dataTable.ItemsSource = RowArray; dataTableXB.ItemsSource = RowArray; ModelVarSubst.ItemsSource = ModelVars; ErrorVarSubst.ItemsSource = ErrorVars; if ((!string.IsNullOrEmpty(this.BlockSchemePath)) && (File.Exists(BlockSchemePath))) { StateSwitcher(true); } else { StateSwitcher(false); } if (blockSchemeWindow != null) { blockSchemeWindow.WindowDisposal(); blockSchemeWindow = null; } determinantTextBox.Clear(); substitutionTextBox.Clear(); determinantTextBox.Text = ResultFormation(); substitutionTextBox.Text = SubstResFormation(); ButtonsReset(); }