终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AppMain.cs 5.5 KiB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. using BPA.CustomResource.UserControls;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Forms;
  9. namespace BPASmartClient.ScreenLib
  10. {
  11. public partial class AppMain
  12. {
  13. public AppMain(Window window, Type type)
  14. {
  15. //启动Redis数据读取
  16. Main.GetInstance.Start();
  17. AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
  18. FSystemHelper.GetInstance.CreateDesktopShortcut();
  19. WindowLargeScreen windowLarge = new WindowLargeScreen();
  20. #region 设置显示页面与标题
  21. string TitleName = $"{type.Assembly.ManifestModule.Name.Replace(".dll", "")}";
  22. string name = type.FullName.Split('.')[2];
  23. string sbmc = string.Empty;
  24. switch (type.FullName)
  25. {
  26. case "BPASmartClient.ScreenALL.App":
  27. windowLarge.Init(TitleName, new ScreenALLControl()); windowLarge.Show();
  28. break;
  29. case "BPASmartClient.ScreenMaxWok.App":
  30. windowLarge.Init(TitleName, new ScreenMaxWokControl()); windowLarge.Show();
  31. break;
  32. case "BPASmartClient.ScreenMinWok.App":
  33. windowLarge.Init(TitleName, new ScreenMinWokControl()); windowLarge.Show();
  34. break;
  35. case "BPASmartClient.ScreenMorks.App":
  36. windowLarge.Init(TitleName, new ScreenMorksControl()); windowLarge.Show();
  37. break;
  38. case "BPASmartClient.ScreenSplitMeals.App":
  39. ScreenSplitMealsControl1 ScreenSplit = new ScreenSplitMealsControl1();
  40. windowLarge.Init("一号" + TitleName, ScreenSplit);
  41. WindowLargeScreen windowLarge2 = new WindowLargeScreen();
  42. windowLarge2.Init("二号" + TitleName, new ScreenSplitMealsControl2());
  43. WindowLargeScreen windowLarge3 = new WindowLargeScreen();
  44. windowLarge3.Init("三号" + TitleName, new ScreenSplitMealsControl3());
  45. int i = 0;
  46. foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens)
  47. {
  48. if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["一号屏"].ToString())
  49. {
  50. windowLarge.WindowStartupLocation = WindowStartupLocation.Manual;
  51. windowLarge.Left = scr.WorkingArea.Left;
  52. windowLarge.Top = scr.WorkingArea.Top;
  53. windowLarge.Width = scr.Bounds.Width;
  54. windowLarge.Height = scr.Bounds.Height;
  55. windowLarge.WindowState = WindowState.Maximized;
  56. windowLarge.ResizeMode = ResizeMode.NoResize;
  57. windowLarge.WindowStyle = WindowStyle.None;
  58. windowLarge.WindowState = WindowState.Normal;
  59. windowLarge.ShowInTaskbar = false;
  60. windowLarge.Topmost = true;
  61. }
  62. else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["二号屏"].ToString())
  63. {
  64. windowLarge2.WindowStartupLocation = WindowStartupLocation.Manual;
  65. windowLarge2.Left = scr.WorkingArea.Left;
  66. windowLarge2.Top = scr.WorkingArea.Top;
  67. windowLarge2.Width = scr.Bounds.Width;
  68. windowLarge2.Height = scr.Bounds.Height;
  69. windowLarge2.WindowState = WindowState.Maximized;
  70. windowLarge2.ResizeMode = ResizeMode.NoResize;
  71. windowLarge2.WindowStyle = WindowStyle.None;
  72. windowLarge2.WindowState = WindowState.Normal;
  73. windowLarge2.ShowInTaskbar = false;
  74. windowLarge2.Topmost = true;
  75. }
  76. else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["三号屏"].ToString())
  77. {
  78. windowLarge3.WindowStartupLocation = WindowStartupLocation.Manual;
  79. windowLarge3.Left = scr.WorkingArea.Left;
  80. windowLarge3.Top = scr.WorkingArea.Top;
  81. windowLarge3.Width = scr.Bounds.Width;
  82. windowLarge3.Height = scr.Bounds.Height;
  83. windowLarge3.WindowState = WindowState.Maximized;
  84. windowLarge3.ResizeMode = ResizeMode.NoResize;
  85. windowLarge3.WindowStyle = WindowStyle.None;
  86. windowLarge3.WindowState = WindowState.Normal;
  87. windowLarge3.ShowInTaskbar = false;
  88. windowLarge3.Topmost = true;
  89. }
  90. i++;
  91. }
  92. windowLarge.Show(); windowLarge2.Show(); windowLarge3.Show();
  93. break;
  94. }
  95. #endregion
  96. window = windowLarge;
  97. }
  98. private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
  99. {
  100. }
  101. }
  102. }