private void EditClass_Click(object sender, RoutedEventArgs e) { EditClassWindow editClass = new EditClassWindow(_class); editClass.Closed += DataManager.MainWindow.WindowAddEditClass_Closed; editClass.ShowDialog(); }
private async void gvClasses_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e) { string strErrorMsg = string.Empty; if (gvClassTypes.SelectedItem == null) { await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgInfo, "请选择需要添加班级的班级类型!", MessageDialogStyle.Affirmative, null); return; } try { EditClassWindow newClassWindow = new EditClassWindow(); newClassWindow.Om = OperationMode.AddMode; newClassWindow.ClassTypeId = this.selectClassType.Id; if (newClassWindow.ShowDialog() == true) { await bindClassList(); } } catch (TimeoutException timeProblem) { strErrorMsg = timeProblem.Message + UIResources.TimeOut + timeProblem.Message; } catch (FaultException <LCFault> af) { strErrorMsg = af.Detail.Message; } catch (FaultException unknownFault) { strErrorMsg = UIResources.UnKnowFault + unknownFault.Message; } catch (CommunicationException commProblem) { strErrorMsg = UIResources.ConProblem + commProblem.Message + commProblem.StackTrace; } catch (Exception ex) { strErrorMsg = ex.Message; } if (strErrorMsg != string.Empty) { await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgError, "添加班级失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null); } }
private async void UpdateClass_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { ClassDisplayModel selectClass = this.gvClasses.SelectedItem as ClassDisplayModel; if (selectClass != null) { string strErrorMsg = string.Empty; try { EditClassWindow newClassWindow = new EditClassWindow(); newClassWindow.ClassId = selectClass.Id; newClassWindow.Om = OperationMode.EditMode; if (newClassWindow.ShowDialog() == true) { await bindClassList(); } } catch (TimeoutException timeProblem) { strErrorMsg = timeProblem.Message + UIResources.TimeOut + timeProblem.Message; } catch (FaultException <LCFault> af) { strErrorMsg = af.Detail.Message; } catch (FaultException unknownFault) { strErrorMsg = UIResources.UnKnowFault + unknownFault.Message; } catch (CommunicationException commProblem) { strErrorMsg = UIResources.ConProblem + commProblem.Message + commProblem.StackTrace; } catch (Exception ex) { strErrorMsg = ex.Message; } if (strErrorMsg != string.Empty) { await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgError, "更新班级失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null); } } }