private void CreateButton(PageStyle pageStyle, bool isData) { var bts = ModuleConfig.Buttons.Where(a => a.Name == pageStyle.ToString()); bool isBt = bts != null && bts.Count() > 0; if (!isBt) { CustomButtonConfig bt = new CustomButtonConfig(); bt.IsData = isData; bt.Name = pageStyle.ToString(); bt.Text = pageStyle.GetDescription(); bt.Client = new ClientConfig() { Function = pageStyle.ToString() }; ModuleConfig.Buttons.Add(bt); } else { AtawDebug.AssertArgument(bts.Count() == 1, pageStyle.ToString(), string.Format(ObjectUtil.SysCulture, "同名的系统按钮{0}不能配置多个", pageStyle), this); var bt = bts.FirstOrDefault(); if (!bt.IsData && isData) { bt.IsData = true; } if (bt.Text.IsEmpty()) { bt.Text = pageStyle.GetDescription(); } if (bt.Client == null) { bt.Client = new ClientConfig() { Function = pageStyle.ToString() }; } } // return bt; }
private void SetDefaultButton() { List <CustomButtonConfig> list = new List <CustomButtonConfig>(); if (ModuleConfig.SupportPage.IsEmpty()) { ModuleConfig.SupportPage = PageStyle.All.ToString(); } //if (!ModuleConfig.SupportPage.IsEmpty()) //{ var pages = ModuleConfig.SupportPage.Split('|'); // if(pages ) CreatePageStyleButton(pages, PageStyle.Insert, false); CreatePageStyleButton(pages, PageStyle.Delete, true); CreatePageStyleButton(pages, PageStyle.Detail, true); CreatePageStyleButton(pages, PageStyle.Update, true); if (ModuleConfig.HasReview == true) { CreatePageStyleButton(pages, PageStyle.Review, true); } if (AtawAppContext.Current.ApplicationXml.IsSupportMobile) { CustomButtonConfig bt = new CustomButtonConfig(); bt.IsData = false; bt.Name = "btMobilePage"; bt.Text = "打开手机版"; bt.Client = new ClientConfig() { Function = "GotoMobilePage" }; ModuleConfig.Buttons.Add(bt); } if (AtawAppContext.Current.ApplicationXml.IsSupportReport) { CustomButtonConfig bt = new CustomButtonConfig(); bt.IsData = false; bt.Name = "btReportPage"; bt.Text = "打开报表"; bt.Client = new ClientConfig() { Function = "GotoReportPage" }; ModuleConfig.Buttons.Add(bt); } if (AtawAppContext.Current.ApplicationXml.IsSupportReport) { CustomButtonConfig bt = new CustomButtonConfig(); bt.IsData = false; bt.Name = "btQing"; bt.Text = "轻办公"; bt.Client = new ClientConfig() { Function = "GotoQing" }; ModuleConfig.Buttons.Add(bt); } //} // return list; }