コード例 #1
0
        private async void gvClassRoomDetail_AddingNewDataItem(object sender, Telerik.Windows.Controls.GridView.GridViewAddingNewEventArgs e)
        {
            string strErrorMsg = string.Empty;

            if (_selectedCenter == null)
            {
                await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgError, "请选择需要添加教室的中心", MessageDialogStyle.Affirmative, null);

                return;
            }
            try
            {
                EditClassroomWindow newClassroomWindow = new EditClassroomWindow();
                newClassroomWindow.ParentCenter = _selectedCenter;
                newClassroomWindow.Om           = OperationMode.AddMode;

                if (newClassroomWindow.ShowDialog() == true)
                {
                    await bindClassroom();
                }
            }
            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;
                //AisinoMessageBox.Show(ex.Message, UIResources.MsgInfo, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK);
            }
            if (strErrorMsg != string.Empty)
            {
                await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgError, "添加教室信息失败!原因:" + strErrorMsg, MessageDialogStyle.Affirmative, null);
            }
        }
コード例 #2
0
        private async void UpdateClassroom_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            ClassroomModel selectClassroom = gvClassRoomDetail.SelectedItem as ClassroomModel;

            if (selectClassroom != null)
            {
                string strErrorMsg = string.Empty;
                try
                {
                    EditClassroomWindow newClassroomWindow = new EditClassroomWindow();
                    newClassroomWindow.SelectClassroom = gvClassRoomDetail.SelectedItem as ClassroomModel;
                    newClassroomWindow.Om = OperationMode.EditMode;

                    if (newClassroomWindow.ShowDialog() == true)
                    {
                        await bindClassroom();
                    }
                }
                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);
                }
            }
        }