Esempio n. 1
0
        private async void DeleSubSys_Click(object sender, RoutedEventArgs e)
        {
            string strErrorMsg = string.Empty;

            try
            {
                if (this.mySelectedElement == null)
                {
                    await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgInfo, "请选择需要删除的子菜单!", MessageDialogStyle.Affirmative, null);

                    return;
                }
                MessageDialogResult result = await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgInfo, "确认删除所选子菜单吗?", MessageDialogStyle.AffirmativeAndNegative, null);

                if (result == MessageDialogResult.Affirmative)
                {
                    this._SubSystemAyncProxy = await Task.Run(() => ServiceHelper.GetSubSystemService());

                    await this._SubSystemAyncProxy.CallAsync(c => c.DeleteByCode(this.mySelectedElement.SubSystemCode));

                    this.mySelectedElement = null;
                    await DialogManager.ShowMessageAsync(this.GetMainWindow(), UIResources.MsgInfo, "删除子菜单成功!", MessageDialogStyle.Affirmative, null);

                    this.subSystemModelBind();
                }
            }
            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);
            }
        }
Esempio n. 2
0
        private async void GetSysSubSystem(SubSystemDisplayModel subsys)
        {
            string strErrorMsg = string.Empty;

            try
            {
                this._SubSystemAyncProxy = await Task.Run(() => ServiceHelper.GetSubSystemService());

                SubSystemEditModel subSystemEditModel = await this._SubSystemAyncProxy.CallAsync(c => c.GetSubSystemByCode(subsys.SubSystemCode));

                if (subSystemEditModel != null)
                {
                    this._sysSubSystem = subSystemEditModel;
                }
                this.gdMenu.DataContext = this._sysSubSystem;
                this.gdMenu.DataContext = subSystemEditModel;
            }
            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);
            }
        }
Esempio n. 3
0
        private async void ltSubSystem_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string strErrorMsg = string.Empty;

            try
            {
                this.mySelectedElement = (SubSystemDisplayModel)this.ltSubSystem.SelectedItem;
                if (mySelectedElement == null)
                {
                    return;
                }
                (this.rightmenuTree.Items[0] as RadTreeViewItem).CheckState = ToggleState.Off;
                this.menuBindToRight(mySelectedElement.SubSystemCode);
            }
            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);

                //AisinoMessageBox.Show(strErrorMsg);
            }
        }
Esempio n. 4
0
        private List <SubSystemDisplayModel> BuildModels(List <SysSubSystem> sysSubSystemList)
        {
            List <SubSystemDisplayModel> menuDisplayModelList = new List <SubSystemDisplayModel>();

            if (sysSubSystemList != null && sysSubSystemList.Count > 0)
            {
                foreach (SysSubSystem sysSubSystem in sysSubSystemList)
                {
                    SubSystemDisplayModel ssdm = new SubSystemDisplayModel();
                    ssdm.SubSystemCode = sysSubSystem.SubSystemCode;
                    ssdm.SubSystemName = sysSubSystem.SubSystemName;
                    ssdm.MetroType     = sysSubSystem.MetroType.ToString();
                    ssdm.BackColor     = sysSubSystem.MetroBackColor;
                    ssdm.Remark        = sysSubSystem.Remark;
                    ssdm.IconString    = sysSubSystem.IconString;
                    ssdm.ForeColor     = sysSubSystem.MetroForeColor;
                    menuDisplayModelList.Add(ssdm);
                }
                return(menuDisplayModelList);
            }
            return(null);
        }