private void openFileMenuBtn_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog { Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" }; if (openFileDialog.ShowDialog() == DialogResult.OK) { filePath = openFileDialog.FileName; OpenFileClick?.Invoke(sender, EventArgs.Empty); saveFileMenuBtn.Enabled = true; } }
private void OpenFileMenuButton_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "bin files (*.bin)|*.bin"; if (openFileDialog.ShowDialog() == DialogResult.OK) { filePath = openFileDialog.FileName; OpenFileClick?.Invoke(this, EventArgs.Empty); UpdateTable(entries); logTextBox.Text += DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString() + "\t" + "Файл " + openFileDialog.FileName + " успешно открыт.\n"; } else { logTextBox.Text += DateTime.Now.ToLongDateString() + DateTime.Now.ToLongTimeString() + "\t" + "Открытие файла было отменено.\n"; } }
private void OpenFile_Click(object sender, RoutedEventArgs e) { OpenFileClick?.Invoke(sender, e); }
protected virtual void OnOpenFileClick(EventArgs e) { OpenFileClick?.Invoke(this, e); OpenFileHelper?.OpenFile(); }