public MainWindow() { //登陆模块处理 LoginMainWindow loginMainWindow = new LoginMainWindow(); bool dialogResult = loginMainWindow.ShowDialog().Value; if (!dialogResult) { Environment.Exit(0); } InitializeComponent(); }
private void Application_Startup(object sender, StartupEventArgs e) { //RootVisual = new UserFormLayout(); string url = App.Current.Host.NavigationState.ToString(); if (url == "") { RootVisual = new LoginMainWindow(); } else { string [] Params = url.Split(','); string tblUser = Params[1]; this.RootVisual = new ChildPage(int.Parse(tblUser), ""); } }
private void InitiateLoginProcess() { Content = new LoginMainWindow(); }
public static void InitiatePermissions(MainPage main, StackPanel panelButtons, LoginMainWindow loginMain, LoginChildWindow loginChildWindow) { WFM_UserJobPermissions = new List <TblAuthJobPermission>(); //var client = new CRUD_ManagerServiceClient(); var client = new LoginService.LoginServiceClient(); client.GetItemsPermissionsByParentCompleted += (s, e) => { var temp = (from z in e.Result where (from x in WFM_UserJobPermissions select x.TblPermission).Contains(z.Iserial) select z).ToList(); if (temp.Any(x => x.Code == "Brandsales")) { main.Brandsales.Visibility = Visibility.Visible; main.BrandSalesControl.Visibility = Visibility.Visible; main.BrandSalesBorder.Visibility = Visibility.Visible; main.TodaySales.Visibility = Visibility.Visible; } if (temp.Any(x => x.Code == "BrandPercentage")) { main.BrandPercentage.Visibility = Visibility.Visible; main.BrandPercentageControl.Visibility = Visibility.Visible; main.BrandPercentageBorder.Visibility = Visibility.Visible; main.TodaySales.Visibility = Visibility.Visible; } if (temp.Any(x => x.Code == "BrandRatio")) { main.BrandRatio.Visibility = Visibility.Visible; main.BrandRatioControl.Visibility = Visibility.Visible; main.BrandRatioBorder.Visibility = Visibility.Visible; main.TodaySales.Visibility = Visibility.Visible; } if (temp.Any(x => x.Code == "BrandMargin")) { main.GrossMarginChart.Visibility = Visibility.Visible; main.BrandMarginControl.Visibility = Visibility.Visible; main.BrandMarginBorder.Visibility = Visibility.Visible; main.GlDashBoard.Visibility = Visibility.Visible; } }; client.GetUserJobAsync((int)WFM_UserID, WFM_UserName); client.GetUserJobCompleted += (s, ev) => { WFM_UserJob = ev.Result; client.GetUserJobPermissionsAsync((int)WFM_UserJob); client.GetUserJobPermissionsCompleted += (s2, ev2) => { WFM_UserJobPermissions.AddRange(ev2.Result.ToList()); client.GetItemsPermissionsByParentAsync("Charts"); client.GetUserMenuesPermissionsAsync((int)WFM_UserJob); client.GetUserMenuesPermissionsCompleted += (s3, ev3) => { WFM_MenuesPermissions = new ObservableCollection <TblAuthPermission>(ev3.Result); foreach (var variable in panelButtons.Children) { var btn = variable as Button; if (!WFM_MenuesPermissions.Any(x => x.Code == btn.Name)) { btn.Visibility = Visibility.Collapsed; } else { string toolTip = ""; if (CurrLang == 0) { toolTip = WFM_MenuesPermissions.FirstOrDefault(x => x.Code == btn.Name).Aname; } else { toolTip = WFM_MenuesPermissions.FirstOrDefault(x => x.Code == btn.Name).Ename; } btn.Visibility = Visibility.Visible; ToolTipService.SetToolTip(btn, toolTip); } } var aa = new MenuTestViewModel(); if (main.AppMenu.MenuItem != null) { main.AppMenu.MenuItem.Clear(); main.AppMenu.MenuItem.MenuItems.Clear(); } main.DataContext = aa; //if (menuCollection != null) InitiateMenusPermissions(menuCollection); client.CloseAsync(); loginMain.Content = main; loginChildWindow.DialogResult = true; }; }; }; }