/// <summary>Handles the Click event of the button1 control.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void OnButton1Click(object sender, EventArgs e) { openFileDialog1.FileName = label1.Text; if (openFileDialog1.ShowDialog() == DialogResult.OK) { label1.Text = openFileDialog1.FileName; if (BrowseClicked != null) { BrowseClicked.Invoke(label1.Text); //reload the grid with data } } }
/// <summary>Handles the Click event of the button1 control.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void OnButton1Click(object sender, EventArgs e) { string fileName = AskUserForFileName("Choose a weather file to open", Utility.FileDialog.FileActionType.Open, "APSIM Weather file (*.met)|*.met|Excel file(*.xlsx)|*.xlsx", labelFileName.Text); if (!String.IsNullOrEmpty(fileName)) { Filename = fileName; if (BrowseClicked != null) { BrowseClicked.Invoke(Filename); //reload the grid with data notebook1.CurrentPage = 0; } } }
/// <summary>Handles the Click event of the button1 control.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void OnButton1Click(object sender, EventArgs e) { openFileDialog1.FileName = FileNameControl.Text; if (openFileDialog1.ShowDialog() == DialogResult.OK) { FileNameControl.Text = openFileDialog1.FileName; if (BrowseClicked != null) { BrowseClicked.Invoke(FileNameControl.Text); //reload the grid with data if (tabControl1.SelectedTab.TabIndex != 0) { tabControl1.SelectedIndex = 0; } } } }
/// <summary>Handles the Click event of the button1 control.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void OnButton1Click(object sender, EventArgs e) { string fileName = null; FileChooserDialog fileChooser = new FileChooserDialog("Choose a weather file to open", null, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept); FileFilter fileFilter = new FileFilter(); fileFilter.Name = "APSIM Weather file (*.met)"; fileFilter.AddPattern("*.met"); fileChooser.AddFilter(fileFilter); FileFilter excelFilter = new FileFilter(); excelFilter.Name = "Excel file (*.xlsx)"; excelFilter.AddPattern("*.xlsx"); fileChooser.AddFilter(excelFilter); FileFilter allFilter = new FileFilter(); allFilter.Name = "All files"; allFilter.AddPattern("*"); fileChooser.AddFilter(allFilter); fileChooser.SetFilename(labelFileName.Text); if (fileChooser.Run() == (int)ResponseType.Accept) { fileName = fileChooser.Filename; fileChooser.Destroy(); if (BrowseClicked != null) { BrowseClicked.Invoke(fileName); //reload the grid with data } } else { fileChooser.Destroy(); } }