Beispiel #1
0
 private void addButton_Click(object sender, EventArgs e)
 {
     try
     {
         var viewModel = new DiaryEditViewModel(_viewModel.Company, null);
         using (var dialog = new DiaryEditForm(viewModel, _viewModel.Diaries))
         {
             var result = dialog.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         // ログは画面では記録しない
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
        private void editButton_Click(object sender, EventArgs e)
        {
            // FullRowSelect
            var rows     = dataGridView1.SelectedRows.OfType <DataGridViewRow>();
            var selected = rows.Select(r => r.DataBoundItem as DiaryData).Single();

            try
            {
                var viewModel = new DiaryEditViewModel(_viewModel.Company, selected);
                using (var dialog = new DiaryEditForm(viewModel, _viewModel.Diaries))
                {
                    var result = dialog.ShowDialog();
                    dataGridView1.Refresh();
                }
            }
            catch (Exception ex)
            {
                // ログは画面では記録しない
                MessageBox.Show(ex.Message);
            }
        }