public DefaultInputPage(ScenarioPage previousPage) { _prevPage = previousPage; InitializeComponent(); this.DataContext = App.workingFile; //Binding binding = new Binding(); //// set source object //binding.Source = App.workingFile; //// set source property //binding.Path = new PropertyPath("surfaceRoughnessLength"); //// attach to target property //aadaa.SetBinding(TextBox.TextProperty, binding); }
private void Continue_Button_Click(object sender, RoutedEventArgs e) { /* At this point the user has made a selection via the radio buttons and * then pressed Continue. If a new file is requested, a file open dialog * box should be presented. Once a file is chosen, check to make sure that it's * valid (not an old file) and that the directory is writeable. Then instantiate * and initialize an ArconFile object. This will pass only one filename/path. * * If an existing file is requested, a file open dialog box should be presented. * Once a file is chosen, check that it exists and is readable. Prompt for the * name of the file post-modifications. Verify that the new file is not already * present. Instantiate and initialize an ArconFile object, passing both the old * file name and the new file name. Is is expected that the old file will be read, * but the new file name will be stored for writing. */ // Create OpenFileDialog Microsoft.Win32.OpenFileDialog openFileDlg = new Microsoft.Win32.OpenFileDialog(); Microsoft.Win32.SaveFileDialog saveFileDlg = new Microsoft.Win32.SaveFileDialog(); // Set filter for file extension and default file extension openFileDlg.DefaultExt = ".rsf"; openFileDlg.Filter = "ARCON Files (*.rsf)|*.rsf|All Files (*.*)|*.*"; saveFileDlg.DefaultExt = ".rsf"; saveFileDlg.Filter = "ARCON Files (*.rsf)|*.rsf|All Files (*.*)|*.*"; if ((bool)this.newFileRadioButton.IsChecked) { saveFileDlg.CheckFileExists = false; if (saveFileDlg.ShowDialog() == true) { App.workingFile = new ArconFile(saveFileDlg.FileName); ScenarioPage scenarioPage = new ScenarioPage(); this.NavigationService.Navigate(scenarioPage); } } else { openFileDlg.CheckFileExists = true; if (openFileDlg.ShowDialog() == true) { string oldLongFileName = openFileDlg.FileName; MessageBox.Show("Now enter the filename for the modified input file . . ."); if (saveFileDlg.ShowDialog() == true) { App.workingFile = new ArconFile(oldLongFileName, saveFileDlg.FileName); ScenarioPage scenarioPage = new ScenarioPage(); this.NavigationService.Navigate(scenarioPage); } } } }
public MetfilePage(ScenarioPage previousPage) { _prevPage = previousPage; if (App.workingFile.NumberOfMetFiles == null) { // set a default value count = 1; } else { count = (int)App.workingFile.NumberOfMetFiles; } InitializeComponent(); this.DataContext = App.workingFile; // populate the array for easier working listOfTextBlocks[0] = textBlock1; listOfTextBlocks[1] = textBlock2; listOfTextBlocks[2] = textBlock3; listOfTextBlocks[3] = textBlock4; listOfTextBlocks[4] = textBlock5; listOfTextBlocks[5] = textBlock6; listOfTextBlocks[6] = textBlock7; listOfTextBlocks[7] = textBlock8; listOfTextBlocks[8] = textBlock9; listOfTextBlocks[9] = textBlock10; listOfTextBoxs[0] = textBox1; listOfTextBoxs[1] = textBox2; listOfTextBoxs[2] = textBox3; listOfTextBoxs[3] = textBox4; listOfTextBoxs[4] = textBox5; listOfTextBoxs[5] = textBox6; listOfTextBoxs[6] = textBox7; listOfTextBoxs[7] = textBox8; listOfTextBoxs[8] = textBox9; listOfTextBoxs[9] = textBox10; for (int i = 0; i < count; i++) { listOfTextBlocks[i].Visibility = Visibility.Visible; listOfTextBoxs[i].Visibility = Visibility.Visible; } for (int i = count; i < 10; i++) { listOfTextBlocks[i].Visibility = Visibility.Hidden; listOfTextBoxs[i].Visibility = Visibility.Hidden; } }