using BPA.CustomResource.UserControls; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Forms; namespace BPASmartClient.ScreenLib { public partial class AppMain { public AppMain(Window window, Type type) { //启动Redis数据读取 Main.GetInstance.Start(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; FSystemHelper.GetInstance.CreateDesktopShortcut(); WindowLargeScreen windowLarge = new WindowLargeScreen(); #region 设置显示页面与标题 string TitleName = $"{type.Assembly.ManifestModule.Name.Replace(".dll", "")}"; string name = type.FullName.Split('.')[2]; string sbmc = string.Empty; switch (type.FullName) { case "BPASmartClient.ScreenALL.App": windowLarge.Init(TitleName, new ScreenALLControl()); windowLarge.Show(); break; case "BPASmartClient.ScreenMaxWok.App": windowLarge.Init(TitleName, new ScreenMaxWokControl()); windowLarge.Show(); break; case "BPASmartClient.ScreenMinWok.App": windowLarge.Init(TitleName, new ScreenMinWokControl()); windowLarge.Show(); break; case "BPASmartClient.ScreenMorks.App": windowLarge.Init(TitleName, new ScreenMorksControl()); windowLarge.Show(); break; case "BPASmartClient.ScreenSplitMeals.App": ScreenSplitMealsControl1 ScreenSplit = new ScreenSplitMealsControl1(); windowLarge.Init("一号" + TitleName, ScreenSplit); WindowLargeScreen windowLarge2 = new WindowLargeScreen(); windowLarge2.Init("二号" + TitleName, new ScreenSplitMealsControl2()); WindowLargeScreen windowLarge3 = new WindowLargeScreen(); windowLarge3.Init("三号" + TitleName, new ScreenSplitMealsControl3()); int i = 0; foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens) { if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["一号屏"].ToString()) { windowLarge.WindowStartupLocation = WindowStartupLocation.Manual; windowLarge.Left = scr.WorkingArea.Left; windowLarge.Top = scr.WorkingArea.Top; windowLarge.Width = scr.Bounds.Width; windowLarge.Height = scr.Bounds.Height; windowLarge.WindowState = WindowState.Maximized; windowLarge.ResizeMode = ResizeMode.NoResize; windowLarge.WindowStyle = WindowStyle.None; windowLarge.WindowState = WindowState.Normal; windowLarge.ShowInTaskbar = false; windowLarge.Topmost = true; } else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["二号屏"].ToString()) { windowLarge2.WindowStartupLocation = WindowStartupLocation.Manual; windowLarge2.Left = scr.WorkingArea.Left; windowLarge2.Top = scr.WorkingArea.Top; windowLarge2.Width = scr.Bounds.Width; windowLarge2.Height = scr.Bounds.Height; windowLarge2.WindowState = WindowState.Maximized; windowLarge2.ResizeMode = ResizeMode.NoResize; windowLarge2.WindowStyle = WindowStyle.None; windowLarge2.WindowState = WindowState.Normal; windowLarge2.ShowInTaskbar = false; windowLarge2.Topmost = true; } else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["三号屏"].ToString()) { windowLarge3.WindowStartupLocation = WindowStartupLocation.Manual; windowLarge3.Left = scr.WorkingArea.Left; windowLarge3.Top = scr.WorkingArea.Top; windowLarge3.Width = scr.Bounds.Width; windowLarge3.Height = scr.Bounds.Height; windowLarge3.WindowState = WindowState.Maximized; windowLarge3.ResizeMode = ResizeMode.NoResize; windowLarge3.WindowStyle = WindowStyle.None; windowLarge3.WindowState = WindowState.Normal; windowLarge3.ShowInTaskbar = false; windowLarge3.Topmost = true; } i++; } windowLarge.Show(); windowLarge2.Show(); windowLarge3.Show(); break; } #endregion window = windowLarge; } private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { } } }