async void CustomerSave_Click(object sender, RoutedEventArgs e) { _cInfo.LastModified = DateTime.Now; //_cInfo.Notes = rtbNotes.GetRTF(); if (_cInfo == null || _cInfo.SQLID == 0) { _cInfo = DBAbstract.CreateCustomer(_cInfo); CloseableTabItem tbi = new CloseableTabItem(); CustomerNotes ctn = new CustomerTrackerWPF.CustomerNotes(_cInfo); var header = new TextBlock { Text = _cInfo.FirstName + " " + _cInfo.LastName, VerticalAlignment = VerticalAlignment.Bottom}; tbi.SetHeader(header); tbi.Content = ctn; tbi.Click += (ssender, le) => { CustomerTrackerWPF.Window1.mainWindow.CloseTabButton_OnClick(ssender, le); }; ctn.VerticalAlignment = VerticalAlignment.Top; CustomerTrackerWPF.Window1.mainWindow.mTabControl.Items.Add(tbi); CustomerTrackerWPF.Window1.mainWindow.mTabControl.SelectedItem = tbi; ClearItUp(); } else { bool success = DBAbstract.UpdateCustomer(_cInfo); if (!success) { await Window1.mainWindow.ShowMessage("Failed to update customer information", "Update Failed", MessageDialogStyle.Affirmative); return; } _isDirty = false; //rtbNotes.isDirty = false; } }
void lviewResults_MouseDoubleClick(object sender, MouseButtonEventArgs e) { try { object obj = GetListViewItemObject(lviewResults, e.OriginalSource); if (obj.GetType() == typeof(DataRowView)) { DataRowView MyObject = (DataRowView)obj; CloseableTabItem tbi = new CloseableTabItem(); CustomerNotes ctn = new CustomerTrackerWPF.CustomerNotes(Convert.ToInt32(MyObject.Row[7])); var header = new TextBlock { Text = MyObject.Row[0].ToString() + " " + MyObject.Row[1].ToString()}; tbi.SetHeader(header); tbi.Content = ctn; //tbi.FontFamily = Window1.mainWindow.mTabControl.FontFamily; tbi.Click += (ssender, le) => { CustomerTrackerWPF.Window1.mainWindow.CloseTabButton_OnClick(ssender, le); }; ctn.VerticalAlignment = VerticalAlignment.Top; CustomerTrackerWPF.Window1.mainWindow.mTabControl.Items.Add(tbi); CustomerTrackerWPF.Window1.mainWindow.mTabControl.SelectedItem = tbi; ClearItUp(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }