From c941debc50e4820331bb85151b5accc38926b43f Mon Sep 17 00:00:00 2001 From: fyf Date: Wed, 9 Nov 2022 17:19:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=8D=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BPASmartClient.ScreenLib/AppMain.cs | 63 +++++++++++++++++-- .../ScreenSplitMealsControl1.xaml.cs | 40 ------------ .../分餐机/WindowShow.xaml | 31 --------- .../分餐机/WindowShow.xaml.cs | 41 ------------ BPASmartClient.ScreenSplitMeals/App.config | 4 ++ WpfTest/MainWindow.xaml | 1 + WpfTest/MainWindow.xaml.cs | 33 ++++++++++ WpfTest/Window1.xaml | 12 ++++ WpfTest/Window1.xaml.cs | 27 ++++++++ 9 files changed, 135 insertions(+), 117 deletions(-) delete mode 100644 BPASmartClient.ScreenLib/分餐机/WindowShow.xaml delete mode 100644 BPASmartClient.ScreenLib/分餐机/WindowShow.xaml.cs create mode 100644 WpfTest/Window1.xaml create mode 100644 WpfTest/Window1.xaml.cs diff --git a/BPASmartClient.ScreenLib/AppMain.cs b/BPASmartClient.ScreenLib/AppMain.cs index 3624193f..51710b03 100644 --- a/BPASmartClient.ScreenLib/AppMain.cs +++ b/BPASmartClient.ScreenLib/AppMain.cs @@ -20,8 +20,8 @@ namespace BPASmartClient.ScreenLib WindowLargeScreen windowLarge = new WindowLargeScreen(); #region 设置显示页面与标题 string TitleName = $"{type.Assembly.ManifestModule.Name.Replace(".dll", "")}"; - string name= type.FullName.Split('.')[2]; - string sbmc=string.Empty; + string name = type.FullName.Split('.')[2]; + string sbmc = string.Empty; switch (type.FullName) { case "BPASmartClient.ScreenALL.App": @@ -37,10 +37,63 @@ namespace BPASmartClient.ScreenLib windowLarge.Init(TitleName, new ScreenMorksControl()); windowLarge.Show(); break; case "BPASmartClient.ScreenSplitMeals.App": - ScreenSplitMealsControl1 ScreenSplit=new ScreenSplitMealsControl1(); + ScreenSplitMealsControl1 ScreenSplit = new ScreenSplitMealsControl1(); windowLarge.Init("一号" + TitleName, ScreenSplit); - windowLarge.Show(); - ScreenSplit.Start(TitleName); + + 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 diff --git a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs index 1560287f..b6b53f5f 100644 --- a/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs +++ b/BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs @@ -26,45 +26,5 @@ namespace BPASmartClient.ScreenLib InitializeComponent(); this.DataContext = new ScreenSplitMealsControl1ViewModel(); } - - public void Start(string name) - { - WindowShow windowLarge2 = new WindowShow(); - windowLarge2.Init("二号" + name, new ScreenSplitMealsControl2()); - WindowShow windowLarge3 = new WindowShow(); - windowLarge3.Init("三号"+ name, new ScreenSplitMealsControl3()); - int i = 0; - foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens) - { - if (!scr.Primary) - { - if (i == 1) - { - 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; - } - else if (i == 2) - { - windowLarge3.WindowStartupLocation = WindowStartupLocation.Manual; - - windowLarge3.Left = scr.WorkingArea.Left; - windowLarge3.Top = scr.WorkingArea.Top; - windowLarge3.Width = scr.Bounds.Width; - windowLarge3.Height = scr.Bounds.Height; - } - i++; - } - } - windowLarge2.Show(); windowLarge3.Show(); - } } } diff --git a/BPASmartClient.ScreenLib/分餐机/WindowShow.xaml b/BPASmartClient.ScreenLib/分餐机/WindowShow.xaml deleted file mode 100644 index 43bcfed6..00000000 --- a/BPASmartClient.ScreenLib/分餐机/WindowShow.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/BPASmartClient.ScreenLib/分餐机/WindowShow.xaml.cs b/BPASmartClient.ScreenLib/分餐机/WindowShow.xaml.cs deleted file mode 100644 index 2b29271d..00000000 --- a/BPASmartClient.ScreenLib/分餐机/WindowShow.xaml.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Shapes; - -namespace BPASmartClient.ScreenLib -{ - /// - /// WindowShow.xaml 的交互逻辑 - /// - public partial class WindowShow : Window - { - public WindowShow() - { - InitializeComponent(); - this.KeyDown += new KeyEventHandler((o, k) => - { - if (k.Key == Key.Escape) - { - if (MessageBox.Show("确认是否退出大屏!", "退出提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes) - this.Close(); - } - }); - } - - public void Init(string title, UserControl user) - { - titlename.Header = title; - main.Child = user; - } - } -} diff --git a/BPASmartClient.ScreenSplitMeals/App.config b/BPASmartClient.ScreenSplitMeals/App.config index 7eeaad9e..29e645ac 100644 --- a/BPASmartClient.ScreenSplitMeals/App.config +++ b/BPASmartClient.ScreenSplitMeals/App.config @@ -6,5 +6,9 @@ + + + + \ No newline at end of file diff --git a/WpfTest/MainWindow.xaml b/WpfTest/MainWindow.xaml index 08bfab87..d710fa7f 100644 --- a/WpfTest/MainWindow.xaml +++ b/WpfTest/MainWindow.xaml @@ -8,5 +8,6 @@ Title="MainWindow" Height="450" Width="800"> + diff --git a/WpfTest/MainWindow.xaml.cs b/WpfTest/MainWindow.xaml.cs index 9f92921e..6d0943f9 100644 --- a/WpfTest/MainWindow.xaml.cs +++ b/WpfTest/MainWindow.xaml.cs @@ -45,6 +45,7 @@ namespace WpfTest InitializeComponent(); Connection(); ThreadServer(); + //Button_Click(null, null); } public void ThreadServer() { @@ -342,5 +343,37 @@ namespace WpfTest })); } + + private void Button_Click(object sender, RoutedEventArgs e) + { + int i = 0; + Window1 window1 = new Window1(); + foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens) + { + //if (!scr.Primary) + { + if (i == 1) + { + window1.WindowStartupLocation = WindowStartupLocation.Manual; + + window1.Left = scr.WorkingArea.Left; + window1.Top = scr.WorkingArea.Top; + window1.Width = scr.Bounds.Width; + window1.Height = scr.Bounds.Height; + window1.WindowState = WindowState.Maximized; + window1.ResizeMode = ResizeMode.NoResize; + window1.WindowStyle = WindowStyle.None; + window1.WindowState = WindowState.Normal; + window1.ShowInTaskbar = false; + window1.Show(); + } + else if (i == 2) + { + } + i++; + } + } + + } } } diff --git a/WpfTest/Window1.xaml b/WpfTest/Window1.xaml new file mode 100644 index 00000000..49c33aaf --- /dev/null +++ b/WpfTest/Window1.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/WpfTest/Window1.xaml.cs b/WpfTest/Window1.xaml.cs new file mode 100644 index 00000000..a918282e --- /dev/null +++ b/WpfTest/Window1.xaml.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Shapes; + +namespace WpfTest +{ + /// + /// Window1.xaml 的交互逻辑 + /// + public partial class Window1 : Window + { + public Window1() + { + InitializeComponent(); + } + } +}