コード例 #1
0
        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;
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: Qulence/SysPro
        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";
            }
        }
コード例 #3
0
 private void OpenFile_Click(object sender, RoutedEventArgs e)
 {
     OpenFileClick?.Invoke(sender, e);
 }
コード例 #4
0
 protected virtual void OnOpenFileClick(EventArgs e)
 {
     OpenFileClick?.Invoke(this, e);
     OpenFileHelper?.OpenFile();
 }