Browse Source

1.重绘window窗体
2.Revtech 新协议代码修改

lixiang 1 year ago
parent
commit
5e8bf0ff14
27 changed files with 1130 additions and 57 deletions
  1. 21 0
      Venus/Venus_MainPages/Role/Menus.cs
  2. 15 0
      Venus/Venus_MainPages/Role/Role.cs
  3. 15 0
      Venus/Venus_MainPages/Role/User.cs
  4. 3 0
      Venus/Venus_MainPages/Venus_MainPages.csproj
  5. 1 0
      Venus/Venus_MainPages/ViewModels/OperationOverViewModel.cs
  6. 59 0
      Venus/Venus_MainPages/ViewModels/RoleViewModel.cs
  7. 1 1
      Venus/Venus_MainPages/ViewModels/TopViewModel.cs
  8. 8 7
      Venus/Venus_MainPages/Views/OperationOverView.xaml
  9. 86 6
      Venus/Venus_MainPages/Views/RoleView.xaml
  10. 1 1
      Venus/Venus_MainPages/Views/TopView.xaml
  11. 1 0
      Venus/Venus_RT/Config/System.sccfg
  12. 1 1
      Venus/Venus_RT/Devices/RevtechMatch.cs
  13. 1 1
      Venus/Venus_RT/Modules/PMs/GasFlowRoutine.cs
  14. 55 0
      Venus/Venus_Themes/CustomControls/Controls/Win32.cs
  15. 17 0
      Venus/Venus_Themes/CustomControls/Controls/WindowButtonBase.cs
  16. 23 0
      Venus/Venus_Themes/CustomControls/Controls/WindowButtonClose.cs
  17. 22 0
      Venus/Venus_Themes/CustomControls/Controls/WindowButtonMax.cs
  18. 21 0
      Venus/Venus_Themes/CustomControls/Controls/WindowButtonMin.cs
  19. 22 0
      Venus/Venus_Themes/CustomControls/Controls/WindowButtonNormal.cs
  20. 243 0
      Venus/Venus_Themes/CustomControls/Controls/WindowTopArea.cs
  21. 44 0
      Venus/Venus_Themes/Styles/CustomWindowStyle.xaml
  22. 70 0
      Venus/Venus_Themes/Styles/WindowElementStyle.xaml
  23. 128 1
      Venus/Venus_Themes/Themes/Generic.xaml
  24. 15 0
      Venus/Venus_Themes/Venus_Themes.csproj
  25. 2 0
      Venus/Venus_UI/App.xaml
  26. 3 3
      Venus/Venus_UI/Views/ShellView.xaml
  27. 252 36
      Venus/Venus_UI/Views/ShellView.xaml.cs

+ 21 - 0
Venus/Venus_MainPages/Role/Menus.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Venus_MainPages.Role
+{
+    internal class Menu
+    {
+        public Menu(int id, string firstmenu, string secondmenu)
+        {
+            Id = id;
+            FirstMenu = firstmenu;
+            SecondMenu = secondmenu;
+        }
+        public int Id { get; set; }
+        public string FirstMenu { get; set; }
+        public string SecondMenu { get; set; }
+    }
+}

+ 15 - 0
Venus/Venus_MainPages/Role/Role.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Venus_Core;
+
+namespace Venus_MainPages.Role
+{
+    internal class Role
+    {
+        public string Name { get; set; }
+        public List<VenusMenu> Menus { get; set; }
+    }
+}

+ 15 - 0
Venus/Venus_MainPages/Role/User.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Venus_MainPages.Role
+{
+    internal class User
+    {
+        public int Id { get; set; }
+        public string Name { get; set; }
+        public string Menu {  get; set; }
+    }
+}

+ 3 - 0
Venus/Venus_MainPages/Venus_MainPages.csproj

@@ -137,6 +137,9 @@
     <Compile Include="PMS\IUiRecipeManager.cs" />
     <Compile Include="PMS\UiRecipeManager.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Role\Menus.cs" />
+    <Compile Include="Role\Role.cs" />
+    <Compile Include="Role\User.cs" />
     <Compile Include="RTData.cs" />
     <Compile Include="Sequence\EventToCommand.cs" />
     <Compile Include="Sequence\FileNode.cs" />

+ 1 - 0
Venus/Venus_MainPages/ViewModels/OperationOverViewModel.cs

@@ -1170,6 +1170,7 @@ namespace Venus_MainPages.ViewModels
             }
 
             m_RtDataKeys.Add("System.IsAutoMode");
+            m_RtDataKeys.Add("System.IsBusy");      
             m_RtDataKeys.Add("Scheduler.CycledCount");
             m_RtDataKeys.Add("Scheduler.CycledWafer");
             m_RtDataKeys.Add("Scheduler.CycleSetPoint");

+ 59 - 0
Venus/Venus_MainPages/ViewModels/RoleViewModel.cs

@@ -2,18 +2,28 @@
 using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows.Controls;
+using System.Windows.Data;
 using Venus_Core;
 using Venus_Unity;
+using Menu = Venus_MainPages.Role.Menu;
 
 namespace Venus_MainPages.ViewModels
 {
     internal class RoleViewModel : BindableBase
     {
+        #region 私有属性
         List<VenusMenu> m_venusMenus = new List<VenusMenu>();
+        ObservableCollection<Menu> m_Menus=new ObservableCollection<Menu>();
+        ICollectionView vm;
+        #endregion
 
+        #region 依赖项属性
         public List<VenusMenu> VenusMenus
         {
             get { return m_venusMenus; }
@@ -22,6 +32,16 @@ namespace Venus_MainPages.ViewModels
                 SetProperty(ref m_venusMenus, value);
             }
         }
+        public ObservableCollection<Menu> Menus
+        {
+            get { return m_Menus; }
+            set
+            {
+                SetProperty(ref m_Menus, value);
+            }
+        }
+        #endregion
+
         private DelegateCommand _SaveCommand;
         public DelegateCommand SaveCommand =>
             _SaveCommand ?? (_SaveCommand = new DelegateCommand(OnSave));
@@ -33,6 +53,45 @@ namespace Venus_MainPages.ViewModels
         public RoleViewModel()
         {
             VenusMenus = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>("Config/UIMenu.json");
+            Menus.Add(new Menu(1, "Operation", "OverView"));
+            Menus.Add(new Menu(1, "Operation", "Sequence"));
+            Menus.Add(new Menu(1, "Operation", "FA"));
+
+
+            Menus.Add(new Menu(1, "PMA", "Operation"));
+            Menus.Add(new Menu(1, "PMA", "IO"));
+            Menus.Add(new Menu(1, "PMA", "Recipe"));
+            Menus.Add(new Menu(1, "PMA", "Gas&Leak Check"));
+            Menus.Add(new Menu(1, "PMA", "MFCVerification"));
+            Menus.Add(new Menu(1, "PMA", "PartialPressure"));
+            Menus.Add(new Menu(1, "PMA", "VATPerformance"));
+
+            Menus.Add(new Menu(1, "PMB", "Operation"));
+            Menus.Add(new Menu(1, "PMB", "IO"));
+            Menus.Add(new Menu(1, "PMB", "Recipe"));
+            Menus.Add(new Menu(1, "PMB", "Gas&Leak Check"));
+            Menus.Add(new Menu(1, "PMB", "MFCVerification"));
+            Menus.Add(new Menu(1, "PMB", "PartialPressure"));
+            Menus.Add(new Menu(1, "PMB", "VATPerformance"));
+
+            Menus.Add(new Menu(1, "PMC", "Operation"));
+            Menus.Add(new Menu(1, "PMC", "IO"));
+            Menus.Add(new Menu(1, "PMC", "Recipe"));
+            Menus.Add(new Menu(1, "PMC", "Gas&Leak Check"));
+            Menus.Add(new Menu(1, "PMC", "MFCVerification"));
+            Menus.Add(new Menu(1, "PMC", "PartialPressure"));
+            Menus.Add(new Menu(1, "PMC", "VATPerformance"));
+
+            Menus.Add(new Menu(1, "PMD", "Operation"));
+            Menus.Add(new Menu(1, "PMD", "IO"));
+            Menus.Add(new Menu(1, "PMD", "Recipe"));
+            Menus.Add(new Menu(1, "PMD", "Gas&Leak Check"));
+            Menus.Add(new Menu(1, "PMD", "MFCVerification"));
+            Menus.Add(new Menu(1, "PMD", "PartialPressure"));
+            Menus.Add(new Menu(1, "PMD", "VATPerformance"));
+
+            vm = CollectionViewSource.GetDefaultView(Menus);
+            vm.GroupDescriptions.Add(new PropertyGroupDescription("FirstMenu"));
         }
         private void OnSave()
         {

+ 1 - 1
Venus/Venus_MainPages/ViewModels/TopViewModel.cs

@@ -292,7 +292,7 @@ namespace Venus_MainPages.ViewModels
 
             EventClient.Instance.OnEvent += Instance_OnEvent;
             EventClient.Instance.Start();
-
+            Title = QueryDataClient.Instance.Service.GetConfig($"System.Name").ToString();
 
 
 

+ 8 - 7
Venus/Venus_MainPages/Views/OperationOverView.xaml

@@ -34,6 +34,7 @@
         <converters:BoolToColor4 x:Key="boolToColor4"/>
         <converters2:IntToPathDataConverter x:Key="IntToPathDataConverter"/>
     </UserControl.Resources>
+
     <Canvas>
         <Border BorderThickness="0,0,0,1" BorderBrush="Black" Canvas.Top="20" Canvas.Left="40">
             <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
@@ -41,12 +42,12 @@
                 <customControls:PathButton PathData="{StaticResource Icon_Return}"  DefaultFillBrush="White" Width="146" Height="30" Content="Return Wafer"    Command="{Binding ReturnAllWaferCommand}"         IsEnabled="{Binding RtDataValues[System.IsAutoMode],Converter={StaticResource BoolToBool}}" Margin="50,0,0,0"/>
 
                 <RadioButton Content="Manual"   FontSize="15"   Width="120" Height="28" Margin="50 0 5 0" Style="{StaticResource Button_RadioButton}"  Command="{Binding EnableManualCommand}" IsChecked="{Binding RtDataValues[System.IsAutoMode],Converter={StaticResource BoolToBool}}"/>
-                
+
                 <RadioButton Content="Auto"     FontSize="15"   Width="120" Height="28" Margin="0 0 0 0" Style="{StaticResource Button_RadioButton}"     Command="{Binding EnableAutoCommand}"  IsChecked="{Binding RtDataValues[System.IsAutoMode]}"/>
                 <customControls:PathButton PathData="{StaticResource Icon_Abort}"   DefaultFillBrush="White" Width="130" Height="30" Content="Abort"           Command="{Binding AbortAllCommand}"               IsEnabled="{Binding RtDataValues[System.IsAutoMode]}" Margin="50 0 0 0" />
                 <customControls:PathButton PathData="{Binding RtDataValues[EquipmentStatus],Converter={StaticResource IntToPathDataConverter}}"   DefaultFillBrush="White" Width="130" Height="30" Content="{Binding RouteState}"           Command="{Binding ResumeAllJobCommand}"            IsEnabled="{Binding RtDataValues[System.IsAutoMode]}" Margin="50 0 0 0" />
-                
-               
+
+
             </StackPanel>
         </Border>
         <Grid   Canvas.Left="50" Canvas.Top="60">
@@ -61,7 +62,7 @@
                 <ColumnDefinition Width="Auto"/>
                 <ColumnDefinition Width="Auto"/>
                 <ColumnDefinition Width="Auto"/>
-               
+
             </Grid.ColumnDefinitions>
 
             <TextBlock Text="TM Lid Closed"    Margin="5,0,5,0" Grid.Column="0" FontSize="15"  HorizontalAlignment="Center" VerticalAlignment="Center" />
@@ -72,7 +73,7 @@
 
             <TextBlock Text="LLB Lid Closed"  Margin="15,0,5,0" Grid.Column="4"  FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" />
             <Ellipse                      Grid.Column="5"  Width="16" Height="16"  Fill="{Binding RtDataValues[TM.LLBLidClosed],Converter={StaticResource boolToColor4}}"   Stroke="Silver" StrokeThickness="2"></Ellipse>
-                
+
         </Grid>
         <Canvas Canvas.Top="40">
             <Canvas Canvas.Left="180">
@@ -407,7 +408,7 @@
                     <RowDefinition Height="30"/>
                     <RowDefinition />
                 </Grid.RowDefinitions>
-                
+
                 <Border Grid.Row="0" BorderBrush="{DynamicResource MainFrame_BD}" BorderThickness="1" Background="{DynamicResource MainFrame_BG_Title}" Padding="5,1">
                     <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
                         <Path Data="M0,0 L5,0 5,5 z" Fill="Black" HorizontalAlignment="Left" Grid.Row="1" RenderTransformOrigin="0.5,0.5" Stretch="Fill" Width="5" Height="5">
@@ -468,7 +469,7 @@
                         </Grid>
                     </StackPanel>
                 </Border>
-             
+
 
                 <Border Grid.Row="2" BorderBrush="{DynamicResource MainFrame_BD}" BorderThickness="1,0,1,1" Background="{DynamicResource MainFrame_BG_Title}" Padding="5,1">
 

+ 86 - 6
Venus/Venus_MainPages/Views/RoleView.xaml

@@ -6,22 +6,101 @@
              xmlns:local="clr-namespace:Venus_MainPages.Views"
              xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
              xmlns:prism="http://prismlibrary.com/"
+             xmlns:customControls="clr-namespace:Venus_Themes.CustomControls;assembly=Venus_Themes"
              prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
-    <StackPanel>
-       
+
+
+        <!--<Grid>
+            <Grid.RowDefinitions>
+                <RowDefinition Height="40"/>
+                <RowDefinition/>
+            </Grid.RowDefinitions>
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                <customControls:PathButton Width="120" Height="30" Content="Add"/>
+                <customControls:PathButton Width="120" Height="30" Content="Delete"/>
+                <customControls:PathButton Width="120" Height="30" Content="Edit"/>
+            </StackPanel>
+            <DataGrid Grid.Row="1"  ItemsSource="{Binding Menus}" AlternationCount="2"
+                      Width="500" FontSize="20"
+                      AutoGenerateColumns="False" HorizontalAlignment="Center"  VerticalAlignment="Top" CanUserAddRows="False" Margin="0">
+                <DataGrid.Columns>
+                    <DataGridTemplateColumn Header="Id"  Width="60">
+                        <DataGridTemplateColumn.CellTemplate>
+                            <DataTemplate>
+                                <TextBlock Text="{Binding Id}"/>
+                            </DataTemplate>
+                        </DataGridTemplateColumn.CellTemplate>
+                    </DataGridTemplateColumn>
+                    <DataGridTemplateColumn Header="FirstMenu"  Width="200">
+                        <DataGridTemplateColumn.CellTemplate>
+                            <DataTemplate>
+                                <TextBlock Text="{Binding FirstMenu}"/>
+                            </DataTemplate>
+                        </DataGridTemplateColumn.CellTemplate>
+                    </DataGridTemplateColumn>
+                    <DataGridTemplateColumn Header="SecondMenu"  Width="200" >
+                        <DataGridTemplateColumn.CellTemplate>
+                            <DataTemplate>
+                                <TextBlock Text="{Binding SecondMenu}"/>
+                            </DataTemplate>
+                        </DataGridTemplateColumn.CellTemplate>
+                    </DataGridTemplateColumn>
+
+                </DataGrid.Columns>
+                <DataGrid.GroupStyle>
+                    <GroupStyle >
+                        <GroupStyle.ContainerStyle>
+                            <Style TargetType="{x:Type GroupItem}">
+                                <Setter Property="Template">
+                                    <Setter.Value>
+                                        <ControlTemplate TargetType="{x:Type GroupItem}">
+                                            <Expander IsExpanded="False" Style="{StaticResource ExpanderStyle}" ExpandDirection="Down"  SnapsToDevicePixels="True" VerticalAlignment="Top">
+                                                <Expander.Header>
+                                                    <StackPanel Orientation="Horizontal">
+                                                        <TextBlock Text="{Binding Name}" Width="120"/>
+                                                        <TextBlock Text="    Count:"/>
+                                                        <TextBlock Text="{Binding ItemCount}"/>
+                                                    </StackPanel>
+                                                </Expander.Header>
+                                                <ItemsPresenter/>
+                                            </Expander>
+                                        </ControlTemplate>
+                                    </Setter.Value>
+                                </Setter>
+                            </Style>
+                        </GroupStyle.ContainerStyle>
+                    </GroupStyle>
+                </DataGrid.GroupStyle>
+                <DataGrid.RowStyle>
+                    <Style TargetType="{x:Type DataGridRow}">
+                        <Style.Triggers>
+                            <Trigger Property="ItemsControl.AlternationIndex"
+                         Value="0">
+                            <Setter Property="Background" Value="#EAEAEA" />
+                            </Trigger>
+                            <Trigger Property="ItemsControl.AlternationIndex"
+                         Value="1">
+                            <Setter Property="Background" Value="#CDCDC1" />
+                            </Trigger>
+                        </Style.Triggers>
+                    </Style>
+                </DataGrid.RowStyle>
+            </DataGrid>
+        </Grid>-->
+    <Canvas>
         <TreeView Name="checkView" Grid.Column="0" Margin="0,50,0,0" ItemsSource="{Binding VenusMenus}" Width="Auto">
             <TreeView.ItemTemplate>
                 <HierarchicalDataTemplate ItemsSource="{Binding MenuItem,Mode=OneTime}">
                     <StackPanel Orientation="Horizontal">
                         <CheckBox IsChecked="{Binding Path=IsShow}">
-                            <!--<i:Interaction.Triggers>
+                            <i:Interaction.Triggers>
                                 <i:EventTrigger EventName="Checked">
-                                   
+
                                     <i:InvokeCommandAction Command="{Binding Path=DataContext.MenuItem,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=TreeViewItem}}" CommandParameter="{Binding}"/>
                                 </i:EventTrigger>
-                            </i:Interaction.Triggers>-->
+                            </i:Interaction.Triggers>
                         </CheckBox>
                         <TextBlock Foreground="White" FontSize="15" Text="{Binding Path=Id}" HorizontalAlignment="Center" />
                     </StackPanel>
@@ -29,5 +108,6 @@
             </TreeView.ItemTemplate>
         </TreeView>
         <Button Content="Save" Command="{Binding SaveCommand}" Grid.Row="1" Width="100" Height="20" HorizontalAlignment="Left"/>
-    </StackPanel>
+    </Canvas>
+
 </UserControl>

+ 1 - 1
Venus/Venus_MainPages/Views/TopView.xaml

@@ -28,7 +28,7 @@
     </UserControl.Resources>
 
     <Canvas Background="{StaticResource Login_BG}">
-        <TextBlock Style="{StaticResource textBlockStyle}" Text="JetPlasma" FontSize="45"     Canvas.Left="5" Canvas.Top="15"/>
+        <TextBox Style="{StaticResource textBoxStyle}" Text="{Binding Title}" FontSize="50" HorizontalContentAlignment="Center"    Canvas.Left="5" Canvas.Top="10" Width="230" IsReadOnly="True"/>
         <TextBlock Text="{Binding SoftwareVersion}" Foreground="White"    FontSize="20"  Canvas.Left="70" Canvas.Top="80" />
 
         <Grid Canvas.Left="240" Width="1620" Height="104">

+ 1 - 0
Venus/Venus_RT/Config/System.sccfg

@@ -23,6 +23,7 @@
 		<config default="1"  name="SystemType" nameView="SystemType" description="0 = Venus;1 = Kepler 2300;2 = Kepler 2200A;3 = Kepler 2200B;4 = Venus SE;5 = Venus DE;" max="9" min="0" paramter="" tag="" unit="min" type="Integer"/>
 		<config default="1000"  name="DataCollectionInterval" nameView="DataCollectionInterval" description="插入数据时间间隔" max="2000" min="200" paramter="" tag="" unit="ms" type="Integer"/>
 		<config default="0" name="PressureUnitType"  nameView="Pressure Unit Type" description="0=>mtorr,1=>Pa" max="1" min="0" paramter="" tag=""  unit="" type="Integer"/>
+		<config default="Kepler" name="Name" nameView="Name" description="Name" tag="" unit="" type="String" />
 		<configs name="SetUp" nameView="Set Up" visible="false">
 			<config default="true" name="EPDInstalled" nameView="Is EPD installed" description="EPD是否安装" max="" min="" paramter="" tag="" unit="" type="Bool" />
 		</configs>

+ 1 - 1
Venus/Venus_RT/Devices/RevtechMatch.cs

@@ -200,7 +200,7 @@ namespace Venus_RT.Devices
         {
             if (mode == EnumRfMatchTuneMode.Auto)
             {
-                SetPointCommandQueue.Add("MATCH:MODE AUTO\n");
+                SetPointCommandQueue.Add("MATCH:MODE HAUTO\n");
             }
             else if (mode == EnumRfMatchTuneMode.Manual)
             {

+ 1 - 1
Venus/Venus_RT/Modules/PMs/GasFlowRoutine.cs

@@ -52,7 +52,7 @@ namespace Venus_RT.Modules.PMs
                 return RState.Failed;
             }
 
-            if(_chamber.GetPVPosition() == 0)
+            if(_chamber.GetPVPosition() <= 0)
             {
                 Stop("钟摆阀没有打开");
                 return RState.Failed;

+ 55 - 0
Venus/Venus_Themes/CustomControls/Controls/Win32.cs

@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Venus_Themes.CustomControls
+{
+    public class Win32
+    {
+        [StructLayout(LayoutKind.Sequential)]
+        public struct POINT
+        {
+            public int X;
+            public int Y;
+
+            public POINT(int x, int y)
+            {
+                this.X = x;
+                this.Y = y;
+            }
+        }
+
+
+        /// <summary>  
+        /// 带有外边框和标题的windows的样式  
+        /// </summary>  
+        public const long WS_CAPTION = 0X00C0000L;
+
+        /// <summary>  
+        /// window的基本样式  
+        /// </summary>  
+        public static int GWL_STYLE = -16;
+        /// <summary>  
+        /// window的扩展样式  
+        /// </summary>  
+        public static int GWL_EXSTYLE = -20;
+
+        public static Int32 WS_EX_LAYERED = 0x00080000;
+        public static Int32 WS_EX_TRANSPARENT = 0x00000020;
+
+        [DllImport("user32.dll", CharSet = CharSet.Auto)]
+        public static extern bool GetCursorPos(out POINT pt);
+
+        [DllImport("user32.dll", CharSet = CharSet.Auto)]
+        public static extern Int32 GetWindowLong(IntPtr hWnd, Int32 nIndex);
+
+        [DllImport("user32.dll", CharSet = CharSet.Auto)]
+        public static extern Int32 SetWindowLong(IntPtr hWnd, Int32 nIndex, int newVal);
+
+        [DllImport("gdi32")]
+        public static extern int DeleteObject(IntPtr obj);
+    }
+}

+ 17 - 0
Venus/Venus_Themes/CustomControls/Controls/WindowButtonBase.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Venus_Themes.CustomControls
+{
+    public class WindowButtonBase : System.Windows.Controls.Button
+    {
+        static WindowButtonBase()
+        {
+            DefaultStyleKeyProperty.OverrideMetadata(typeof(WindowButtonBase), new FrameworkPropertyMetadata(typeof(WindowButtonBase)));
+        }
+    }
+}

+ 23 - 0
Venus/Venus_Themes/CustomControls/Controls/WindowButtonClose.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Venus_Themes.CustomControls
+{
+    public class WindowButtonClose : System.Windows.Controls.Button
+    {
+        static WindowButtonClose()
+        {
+            DefaultStyleKeyProperty.OverrideMetadata(typeof(WindowButtonClose), new FrameworkPropertyMetadata(typeof(WindowButtonClose)));
+        }
+        protected override void OnClick()
+        {
+            System.Windows.Window win = System.Windows.Window.GetWindow(this);
+            win.Close();
+            base.OnClick();
+        }
+    }
+}

+ 22 - 0
Venus/Venus_Themes/CustomControls/Controls/WindowButtonMax.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Venus_Themes.CustomControls
+{
+    public class WindowButtonMax : WindowButtonBase
+    {
+        protected override void OnClick()
+        {
+            System.Windows.Window win = System.Windows.Window.GetWindow(this);
+            if (win.WindowState != System.Windows.WindowState.Maximized)
+            {
+                win.WindowState = System.Windows.WindowState.Maximized;
+            }
+            base.OnClick();
+        }
+    }
+}

+ 21 - 0
Venus/Venus_Themes/CustomControls/Controls/WindowButtonMin.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Venus_Themes.CustomControls
+{
+    public class WindowButtonMin : System.Windows.Controls.Button
+    {
+        protected override void OnClick()
+        {
+            System.Windows.Window win = System.Windows.Window.GetWindow(this);
+            if (win.WindowState != System.Windows.WindowState.Minimized)
+            {
+                win.WindowState = System.Windows.WindowState.Minimized;
+            }
+        }
+    }
+}

+ 22 - 0
Venus/Venus_Themes/CustomControls/Controls/WindowButtonNormal.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Venus_Themes.CustomControls
+{
+    public class WindowButtonNormal : WindowButtonBase
+    {
+        protected override void OnClick()
+        {
+            System.Windows.Window win = System.Windows.Window.GetWindow(this);
+            if (win.WindowState != System.Windows.WindowState.Normal)
+            {
+                win.WindowState = System.Windows.WindowState.Normal;
+            }
+            base.OnClick();
+        }
+    }
+}

+ 243 - 0
Venus/Venus_Themes/CustomControls/Controls/WindowTopArea.cs

@@ -0,0 +1,243 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
+
+
+namespace Venus_Themes.CustomControls
+{
+    public class WindowTopArea : System.Windows.Controls.Border
+    {
+        static WindowTopArea()
+        {
+            DefaultStyleKeyProperty.OverrideMetadata(typeof(WindowTopArea), new FrameworkPropertyMetadata(typeof(WindowTopArea)));
+        }
+
+        private new bool CaptureMouse = false;
+        private enum ResizePosition
+        { None, Left, TopLeft, Top, TopRight, Right, BottomRight, Bottom, BottomLeft }
+
+        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
+        {
+            Window win = Window.GetWindow(this);
+            if (e.ClickCount == 1 && e.LeftButton == MouseButtonState.Pressed)
+            {
+                win.DragMove();
+            }
+            else if (e.ClickCount == 2)
+            {
+                win.SizeToContent = SizeToContent.Manual;
+                win.WindowState = win.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
+            }
+            base.OnMouseLeftButtonDown(e);
+            e.Handled = true;
+        }
+
+        protected override void OnInitialized(EventArgs e)
+        {
+            //SetWindowNoBorder();
+            //SetWindowResizer();
+            base.OnInitialized(e);
+        }
+
+        #region 窗体大小变化
+        public void SetWindowResizer()
+        {
+            Window win = Window.GetWindow(this);
+            ResizePosition ResPosition = ResizePosition.None;
+            int Resizer = 5;
+            win.MouseMove += new MouseEventHandler(
+                    delegate (object target, MouseEventArgs args)
+                    {
+                        try
+                        {
+                            //do resize
+                            if (win.WindowState == WindowState.Normal)
+                            {
+                                Point MS = args.GetPosition(win);
+                                if (args.LeftButton == MouseButtonState.Pressed)
+                                {
+                                    Win32.POINT pos = new Win32.POINT();
+                                    Win32.GetCursorPos(out pos);
+                                    #region 改变窗体大小
+                                    switch (ResPosition)
+                                    {
+                                        case ResizePosition.Left:
+                                            //左边                          
+                                            Mouse.SetCursor(Cursors.SizeWE);
+                                            Point transPointLeft = win.PointToScreen(new Point(0, 0));
+                                            win.Left += pos.X - transPointLeft.X;
+                                            win.Width += transPointLeft.X - pos.X;
+                                            break;
+                                        case ResizePosition.Right:
+                                            //右边
+                                            Mouse.SetCursor(Cursors.SizeWE);
+                                            Point transPointRight = win.PointToScreen(new Point(win.Width, 0));
+                                            win.Width += pos.X - transPointRight.X;
+                                            break;
+                                        case ResizePosition.Top:
+                                            //顶部
+                                            Mouse.SetCursor(Cursors.SizeNS);
+                                            Point transPointTop = win.PointToScreen(new Point(0, 0));
+                                            win.Top += pos.Y - transPointTop.Y;
+                                            win.Height += transPointTop.Y - pos.Y;
+                                            break;
+                                        case ResizePosition.Bottom:
+                                            //底部
+                                            Mouse.SetCursor(Cursors.SizeNS);
+                                            Point transPointBottom = win.PointToScreen(new Point(0, win.Height));
+                                            win.Height += (pos.Y - transPointBottom.Y);
+                                            break;
+                                        case ResizePosition.TopLeft:
+                                            //左上
+                                            Mouse.SetCursor(Cursors.SizeNWSE);
+                                            Point transPointTopLeft = win.PointToScreen(new Point(0, 0));
+                                            win.Left += pos.X - transPointTopLeft.X;
+                                            win.Top += pos.Y - transPointTopLeft.Y;
+                                            win.Width += transPointTopLeft.X - pos.X;
+                                            win.Height += transPointTopLeft.Y - pos.Y;
+                                            break;
+                                        case ResizePosition.BottomLeft:
+                                            //左下
+                                            Mouse.SetCursor(Cursors.SizeNESW);
+                                            Point transPointBottomLeft = win.PointToScreen(new Point(0, win.Height));
+                                            win.Left += pos.X - transPointBottomLeft.X;
+                                            win.Width += transPointBottomLeft.X - pos.X;
+                                            win.Height += pos.Y - transPointBottomLeft.Y;
+                                            break;
+                                        case ResizePosition.TopRight:
+                                            //右上
+                                            Mouse.SetCursor(Cursors.SizeNESW);
+                                            Point transPointTopRight = win.PointToScreen(new Point(win.Width, 0));
+                                            win.Top += pos.Y - transPointTopRight.Y;
+                                            win.Width = transPointTopRight.Y - pos.X;
+                                            win.Height = transPointTopRight.Y - pos.Y;
+                                            break;
+                                        case ResizePosition.BottomRight:
+                                            //右下
+                                            Mouse.SetCursor(Cursors.SizeNWSE);
+                                            Point transPointBottomRight = win.PointToScreen(new Point(win.Width, win.Height));
+                                            win.Width += pos.X - transPointBottomRight.X;
+                                            win.Height += pos.Y - transPointBottomRight.Y;
+                                            break;
+                                        case ResizePosition.None:
+                                        default:
+                                            Mouse.SetCursor(Cursors.Arrow);
+                                            break;
+                                    }
+                                    #endregion
+                                }
+                                else if (MS.X <= Resizer + 5 && MS.Y <= Resizer + 5)
+                                {
+                                    //左上 (不执行)
+                                    Mouse.SetCursor(Cursors.SizeNWSE);
+                                    ResPosition = ResizePosition.TopLeft;
+                                }
+                                else if (MS.X <= Resizer && MS.Y >= win.ActualHeight - Resizer)
+                                {
+                                    //左下
+                                    Mouse.SetCursor(Cursors.SizeNESW);
+                                    ResPosition = ResizePosition.BottomLeft;
+                                }
+                                else if (MS.X >= win.ActualWidth - Resizer - 5 && MS.Y <= Resizer + 5)
+                                {
+                                    //右上(不执行)
+                                    Mouse.SetCursor(Cursors.SizeNESW);
+                                    ResPosition = ResizePosition.TopRight;
+                                }
+                                else if (MS.X >= win.ActualWidth - Resizer && MS.Y >= win.ActualHeight - Resizer)
+                                {
+                                    //右下
+                                    Mouse.SetCursor(Cursors.SizeNWSE);
+                                    ResPosition = ResizePosition.BottomRight;
+                                }
+                                else if (MS.X <= Resizer)
+                                {
+                                    //左边
+                                    Mouse.SetCursor(Cursors.SizeWE);
+                                    ResPosition = ResizePosition.Left;
+                                }
+                                else if (MS.Y <= Resizer + 5)
+                                {
+                                    //顶部(不执行)
+                                    Mouse.SetCursor(Cursors.SizeNS);
+                                    ResPosition = ResizePosition.Top;
+                                }
+                                else if (MS.X >= win.ActualWidth - Resizer)
+                                {
+                                    //右边
+                                    Mouse.SetCursor(Cursors.SizeWE);
+                                    ResPosition = ResizePosition.Right;
+                                }
+                                else if (MS.Y >= win.ActualHeight - Resizer)
+                                {
+                                    //底部
+                                    Mouse.SetCursor(Cursors.SizeNS);
+                                    ResPosition = ResizePosition.Bottom;
+                                }
+                                else
+                                {
+                                    //无
+                                    Mouse.SetCursor(Cursors.Arrow);
+                                    ResPosition = ResizePosition.None;
+                                }
+                            }
+                        }
+                        catch
+                        {
+                            ResPosition = ResizePosition.None;
+                            win.ReleaseMouseCapture();
+                        }
+                        args.Handled = CaptureMouse;
+                    }
+                );
+            win.MouseLeftButtonDown += new MouseButtonEventHandler(
+                    delegate (object target, MouseButtonEventArgs args)
+                    {
+                        if (win.WindowState == WindowState.Normal)
+                        {
+                            //获取当前鼠标点击点相对于Dvap.Shell窗体的位置
+                            Point pos = args.GetPosition(win);
+                            if (ResPosition != ResizePosition.None)
+                            {
+                                CaptureMouse = win.CaptureMouse();
+                            }
+                            args.Handled = CaptureMouse;
+                        }
+                    }
+                );
+            win.MouseLeftButtonUp += new MouseButtonEventHandler(
+                    delegate (object target, MouseButtonEventArgs args)
+                    {
+                        if (win.WindowState == WindowState.Normal)
+                        {
+                            ResPosition = ResizePosition.None;
+                            if (CaptureMouse)
+                            {
+                                win.ReleaseMouseCapture();
+                                CaptureMouse = false;
+                            }
+                            args.Handled = CaptureMouse;
+                        }
+                    }
+                );
+        }
+        #endregion
+
+        private void SetWindowNoBorder()
+        {
+            Window win = Window.GetWindow(this);
+            // 获取窗体句柄  
+            IntPtr hwnd = new System.Windows.Interop.WindowInteropHelper(win).Handle;
+
+            // 获得窗体的 样式  
+            long oldstyle = Win32.GetWindowLong(hwnd, Win32.GWL_STYLE);
+
+            // 更改窗体的样式为无边框窗体  
+            Win32.SetWindowLong(hwnd, Win32.GWL_STYLE, (int)(oldstyle & ~Win32.WS_CAPTION));
+        }
+    }
+}

+ 44 - 0
Venus/Venus_Themes/Styles/CustomWindowStyle.xaml

@@ -0,0 +1,44 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:ui="clr-namespace:Venus_Themes.CustomControls"
+                    xmlns:local="Venus_Themes.Style">
+    <Style TargetType="{x:Type Window}" x:Key="ShellWindow">
+        <Setter Property="Background" Value="#2B5A97"></Setter>
+        <Setter Property="WindowStyle" Value="None"></Setter>
+        <Setter Property="AllowsTransparency" Value="False"></Setter>
+        <Setter Property="Template" >
+            <Setter.Value>
+                <ControlTemplate TargetType="Window">
+                    <Border BorderBrush="#333" BorderThickness="1" Background="#eee">
+                        <Grid>
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="25"></RowDefinition>
+                                <RowDefinition Height="*"></RowDefinition>
+                            </Grid.RowDefinitions>
+                            <ui:WindowTopArea Background="#1E7FC3">
+                                <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
+                                    <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center">
+                                        <Path Data="{StaticResource Icon_Auto}" Stretch="Fill" Stroke="White" Width="12" Height="12"></Path>
+                                        <TextBlock Text="{TemplateBinding Title}" Foreground="White" Margin="5 2" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="12"></TextBlock>
+                                    </StackPanel>
+                                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
+                                        <ui:WindowButtonMin Background="Transparent" BorderThickness="0">
+                                            <TextBlock Text="➖" Foreground="White"  Width="16" Height="16"/>
+                                        </ui:WindowButtonMin>
+                                        <ui:WindowButtonClose>
+                                            <TextBlock Text="✖" Foreground="White"  Width="16" Height="16"/>
+                                        </ui:WindowButtonClose>
+
+                                    </StackPanel>
+                                </Grid>
+                            </ui:WindowTopArea>
+                            <AdornerDecorator Grid.Row="1">
+                                <ContentPresenter></ContentPresenter>
+                            </AdornerDecorator>
+                        </Grid>
+                    </Border>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+</ResourceDictionary>

+ 70 - 0
Venus/Venus_Themes/Styles/WindowElementStyle.xaml

@@ -0,0 +1,70 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:controls="clr-namespace:Venus_Themes.CustomControls"
+                    xmlns:local="Venus_Themes.Style">
+    <Style TargetType="{x:Type controls:WindowButtonBase}">
+        <Setter Property="Margin" Value="0 0 1 0"></Setter>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type controls:WindowButtonBase}">
+                    <Border  x:Name="bg" Background="Transparent" Width="25" Height="25">
+                        <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center"  Opacity="1"></ContentPresenter>
+                    </Border>
+                    <!--<ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter Property="Background" Value="#333" TargetName="bg"></Setter>
+                            <Setter Property="Opacity" Value="1" TargetName="content"></Setter>
+                        </Trigger>
+                    </ControlTemplate.Triggers>-->
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
+    <Style TargetType="{x:Type controls:WindowButtonClose}">
+        <Setter Property="Margin" Value="0 0 1 0"></Setter>
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type controls:WindowButtonClose}">
+                    <Border  x:Name="bg" Background="Transparent" Width="25" Height="25">
+                        <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center"  Opacity="0.5" RenderTransformOrigin="0.5 0.5">
+                            <ContentPresenter.RenderTransform>
+                                <RotateTransform x:Name="angleRotateTransform" ></RotateTransform>
+                            </ContentPresenter.RenderTransform>
+                        </ContentPresenter>
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter Property="Background" Value="Red" TargetName="bg"></Setter>
+                            <Setter Property="Opacity" Value="1" TargetName="content"></Setter>
+                            <Trigger.EnterActions>
+                                <BeginStoryboard>
+                                    <Storyboard>
+                                        <DoubleAnimation Storyboard.TargetName="angleRotateTransform" Storyboard.TargetProperty="Angle"
+                                                         From="0" To="90" Duration="0:0:0.5">
+                                            <DoubleAnimation.EasingFunction>
+                                                <BackEase EasingMode="EaseInOut"></BackEase>
+                                            </DoubleAnimation.EasingFunction>
+                                        </DoubleAnimation>
+                                    </Storyboard>
+                                </BeginStoryboard>
+                            </Trigger.EnterActions>
+                            <Trigger.ExitActions>
+                                <BeginStoryboard>
+                                    <Storyboard>
+                                        <DoubleAnimation Storyboard.TargetName="angleRotateTransform" Storyboard.TargetProperty="Angle"
+                                                         From="90" To="0" Duration="0:0:0.5">
+                                            <DoubleAnimation.EasingFunction>
+                                                <BackEase EasingMode="EaseInOut"></BackEase>
+                                            </DoubleAnimation.EasingFunction>
+                                        </DoubleAnimation>
+                                    </Storyboard>
+                                </BeginStoryboard>
+                            </Trigger.ExitActions>
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+</ResourceDictionary>

File diff suppressed because it is too large
+ 128 - 1
Venus/Venus_Themes/Themes/Generic.xaml


+ 15 - 0
Venus/Venus_Themes/Venus_Themes.csproj

@@ -96,6 +96,13 @@
     <Compile Include="Converters\VisibilityToReverse.cs" />
     <Compile Include="CustomControls\AduRadioButtonIcon.cs" />
     <Compile Include="CustomControls\CommonValveControl.cs" />
+    <Compile Include="CustomControls\Controls\Win32.cs" />
+    <Compile Include="CustomControls\Controls\WindowButtonBase.cs" />
+    <Compile Include="CustomControls\Controls\WindowButtonClose.cs" />
+    <Compile Include="CustomControls\Controls\WindowButtonMax.cs" />
+    <Compile Include="CustomControls\Controls\WindowButtonMin.cs" />
+    <Compile Include="CustomControls\Controls\WindowButtonNormal.cs" />
+    <Compile Include="CustomControls\Controls\WindowTopArea.cs" />
     <Compile Include="CustomControls\GuangChuanRobot.cs" />
     <Compile Include="CustomControls\CustomRobot.cs" />
     <Compile Include="CustomControls\MultiComboBox.cs" />
@@ -231,6 +238,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Styles\CustomWindowStyle.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Styles\RadioButton.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -287,6 +298,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
+    <Page Include="Styles\WindowElementStyle.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Themes\Generic.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>

+ 2 - 0
Venus/Venus_UI/App.xaml

@@ -25,6 +25,8 @@
                 <ResourceDictionary Source="pack://application:,,,/Venus_Themes;component/Themes/Generic.xaml"/>
                 <ResourceDictionary Source="/Venus_Themes;component/Languages/StringResources.en-US.xaml"/>
                 <ResourceDictionary Source="/Venus_Themes;component/Languages/StringResources.zh-CN.xaml"/>
+                <ResourceDictionary Source="pack://application:,,,/Venus_Themes;component/Styles/WindowElementStyle.xaml"></ResourceDictionary>
+                <ResourceDictionary Source="pack://application:,,,/Venus_Themes;component/Styles/CustomWindowStyle.xaml"></ResourceDictionary>
 
                 <!--<ResourceDictionary Source="/RecipeEditorControl;component/Resources/StringResources.zh-CN.xaml" />
                 <ResourceDictionary Source="/RecipeEditorControl;component/Resources/StringResources.en-US.xaml" />-->

+ 3 - 3
Venus/Venus_UI/Views/ShellView.xaml

@@ -4,11 +4,11 @@
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:wnd="http://OpenSEMI.Ctrlib.com/presentation"
-        WindowState="Maximized"
+        
         WindowStartupLocation="CenterScreen"
         xmlns:prism="http://prismlibrary.com/"
         mc:Ignorable="d"
-        Title="" Height="450" Width="800" Loaded="CustomWnd_Loaded" Closed="CustomWnd_Closed">
+        Title="JetPlasma" Style="{StaticResource ShellWindow}"   Loaded="CustomWnd_Loaded" Closed="CustomWnd_Closed">
     <Window.Resources>
        
 
@@ -146,7 +146,7 @@
         
         <Grid.RowDefinitions>
             <RowDefinition Height="104"/>
-            <RowDefinition/>
+            <RowDefinition />
             <RowDefinition Height="50"/>
         </Grid.RowDefinitions>
 

+ 252 - 36
Venus/Venus_UI/Views/ShellView.xaml.cs

@@ -27,6 +27,8 @@ using Venus_Themes.UserControls;
 using OpenSEMI.Ctrlib.Controls;
 using OpenSEMI.ClientBase;
 using MECF.Framework.Common.Equipment;
+using WinInterop = System.Windows.Interop;
+using System.Runtime.InteropServices;
 
 namespace Venus_UI.Views
 {
@@ -38,10 +40,10 @@ namespace Venus_UI.Views
         IRegionManager m_regionManager;
         IRegionNavigationService m_regionNavigationService;
         List<VenusMenu> VenusMenu;
-        List<TabControl>  centerTabViews=new List<TabControl> ();
-        List<Button> buttonList=new List<Button> ();
+        List<TabControl> centerTabViews = new List<TabControl>();
+        List<Button> buttonList = new List<Button>();
         DispatcherTimer timer = new DispatcherTimer();
-
+        private bool IsMaxed = false;
         public ShellView(IRegionManager regionManager, IRegionNavigationService regionNavigationService)
         {
 
@@ -63,13 +65,27 @@ namespace Venus_UI.Views
             UIEvents.LLEDoorRaiseChangedEvent += UIEvents_LLEDoorRaiseChangedEvent;
 
             UIEvents.ChamberCreateDeleteWaferEvent += UIEvents_ChamberCreateDeleteWaferEvent;
+
+            this.SourceInitialized += (o, e) =>
+            {
+                System.IntPtr handler = (new WinInterop.WindowInteropHelper(this)).Handle;
+                WinInterop.HwndSource.FromHwnd(handler).AddHook(new WinInterop.HwndSourceHook(WindowProc));
+            };
+
+            this.MaxHeight = SystemParameters.WorkArea.Height;
+            ResizeMode = ResizeMode.CanMinimize;
+            this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
+
+
+
+
         }
         void timer_Tick(object sender, EventArgs e)
         {
             if (Anychange.needchange)
             {
                 Anystationchange(Anychange.menuname, Anychange.args);
-                Anychange.needchange=false;
+                Anychange.needchange = false;
             }
         }
         private void Instance_SlotRightClickChangedEvent(OpenSEMI.Ctrlib.Controls.Slot slot)
@@ -121,13 +137,13 @@ namespace Venus_UI.Views
                 //from robot to robot is illegal. Must be stop
                 if (e.TranferFrom.ModuleID == e.TranferTo.ModuleID && (e.TranferTo.ModuleID == ModuleName.EfemRobot.ToString() || e.TranferTo.ModuleID == ModuleName.TMRobot.ToString()))
                 {
-                    
+
                 }
                 else
                     InvokeClient.Instance.Service.DoOperation("System.MoveWafer",
                         e.TranferFrom.ModuleID, e.TranferFrom.SlotID, e.TranferTo.ModuleID, e.TranferTo.SlotID, alignflag, angel, coolingflag, coolingtime, "");
-                    
-                    
+
+
 
             }
             else
@@ -143,12 +159,18 @@ namespace Venus_UI.Views
 
         private void CustomWnd_Loaded(object sender, RoutedEventArgs e)
         {
-            VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/UIMenu.json");            
+            var h1 = SystemParameters.WorkArea.Height;
+            var h2 = SystemParameters.PrimaryScreenHeight;
+
+            //this.ResizeMode = ResizeMode.CanResize;
+            //System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / SystemParameters.PrimaryScreenWidth
+
+            VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/UIMenu.json");
             int index = 0;
             for (int i = 0; i < VenusMenu.Count; i++)
             {
                 if (VenusMenu[i].IsShow == false)
-                { 
+                {
                     continue;
                 }
                 string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
@@ -171,39 +193,23 @@ namespace Venus_UI.Views
                 {
                     aduRadioButtonIcon.IsChecked = true;
                 }
-                IconElement.SetPathData(aduRadioButtonIcon,(Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
+                IconElement.SetPathData(aduRadioButtonIcon, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
                 aduRadioButtonIcon.Content = VenusMenu[i].Name;
                 aduRadioButtonIcon.Click += AduRadioButtonIcon_Click;
                 aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6AD7FF"));
                 aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.Black));
                 aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
                 //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
-                
+
 
                 aduRadioButtonIcon.Width = 180;
-                aduRadioButtonIcon.Height= 40;
-                
+                aduRadioButtonIcon.Height = 40;
+
                 //aduRadioButtonIcon.Foreground=Brushes.White;
                 aduRadioButtonIcon.Tag = index;
                 index += 1;
                 Bottom_Frame.Children.Add(aduRadioButtonIcon);
-                //if (VenusMenu[i].Id == "PMC")
-                //{
-                //    AduRadioButtonIcon aduRadioButtonIcon2 = new AduRadioButtonIcon();
-                   
-                //    IconElement.SetPathData(aduRadioButtonIcon2, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
-                //    aduRadioButtonIcon2.Content = "PMD";
-                //    //aduRadioButtonIcon2.Click += AduRadioButtonIcon_Click;
-                //    aduRadioButtonIcon2.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#6AD7FF"));
-                //    aduRadioButtonIcon2.SelectColor = new SolidColorBrush((Colors.Black));
-                //    aduRadioButtonIcon2.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
-                //    //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
-
-
-                //    aduRadioButtonIcon2.Width = 180;
-                //    aduRadioButtonIcon2.Height = 40;
-                //    Bottom_Frame.Children.Add(aduRadioButtonIcon2);
-                //}
+
                 TabControl tabControl = new TabControl();
                 for (int j = 0; j < VenusMenu[i].MenuItem.Count; j++)
                 {
@@ -212,7 +218,7 @@ namespace Venus_UI.Views
                         continue;
                     }
                     string className;
-                    if ((VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD")&& VenusMenu[i].MenuItem[j].Id== "Operation")
+                    if ((VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD") && VenusMenu[i].MenuItem[j].Id == "Operation")
                     {
                         JetChamber jetChamber = (JetChamber)(Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{VenusMenu[i].Id}.ChamberType")));
                         className = $"Venus_MainPages.Views.Over{jetChamber.ToString()}View";
@@ -224,20 +230,19 @@ namespace Venus_UI.Views
 
                     Type t = Type.GetType($"{className},Venus_MainPages");
                     var obj = System.Activator.CreateInstance(t);
-                    
 
-                    if (VenusMenu[i].Id=="PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM" || VenusMenu[i].Id == "SETM")
-                    {                     
+
+                    if (VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM" || VenusMenu[i].Id == "SETM")
+                    {
                         MethodInfo methodInfo = t.GetMethod("Init", new Type[] { typeof(string) });
                         methodInfo?.Invoke(obj, new object[] { VenusMenu[i].Id });
                     }
                     tabControl.Items.Add(new TabItem() { Header = VenusMenu[i].MenuItem[j].Name, Content = obj });
                 }
-                centerTabViews.Add(tabControl);               
+                centerTabViews.Add(tabControl);
             }
             Main_Frame.Content = centerTabViews[0];
             ModuleManager.Initialize();
-
         }
 
         public void Anystationchange(string menuviewItem, WaferHistoryWafer queryFilter)
@@ -300,5 +305,216 @@ namespace Venus_UI.Views
         {
             InvokeClient.Instance.Service.DoOperation($"TM.SetEFEMSlitDoor", obj.ModuleName, obj.IsOpen == "Open" ? true : false);
         }
+
+        #region 调用api功能部分
+        void win_SourceInitialized(object sender, EventArgs e)
+        {
+            System.IntPtr handle = (new WinInterop.WindowInteropHelper(this)).Handle;
+            WinInterop.HwndSource.FromHwnd(handle).AddHook(new WinInterop.HwndSourceHook(WindowProc));
+        }
+
+        private static System.IntPtr WindowProc(
+              System.IntPtr hwnd,
+              int msg,
+              System.IntPtr wParam,
+              System.IntPtr lParam,
+              ref bool handled)
+        {
+            switch (msg)
+            {
+                case 0x0024:
+                    WmGetMinMaxInfo(hwnd, lParam);
+                    handled = true;
+                    break;
+            }
+
+            return (System.IntPtr)0;
+        }
+
+        private static void WmGetMinMaxInfo(System.IntPtr hwnd, System.IntPtr lParam)
+        {
+
+            MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
+
+            // Adjust the maximized size and position to fit the work area of the correct monitor
+            int MONITOR_DEFAULTTONEAREST = 0x00000002;
+            System.IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
+
+            if (monitor != System.IntPtr.Zero)
+            {
+
+                MONITORINFO monitorInfo = new MONITORINFO();
+                GetMonitorInfo(monitor, monitorInfo);
+                RECT rcWorkArea = monitorInfo.rcWork;
+                RECT rcMonitorArea = monitorInfo.rcMonitor;
+                mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left);
+                mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top);
+                mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left);
+                mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top);
+            }
+
+            Marshal.StructureToPtr(mmi, lParam, true);
+        }
+
+
+        /// <summary>
+        /// POINT aka POINTAPI
+        /// </summary>
+        [StructLayout(LayoutKind.Sequential)]
+        public struct POINT
+        {
+            /// <summary>
+            /// x coordinate of point.
+            /// </summary>
+            public int x;
+            /// <summary>
+            /// y coordinate of point.
+            /// </summary>
+            public int y;
+
+            /// <summary>
+            /// Construct a point of coordinates (x,y).
+            /// </summary>
+            public POINT(int x, int y)
+            {
+                this.x = x;
+                this.y = y;
+            }
+        }
+
+        [StructLayout(LayoutKind.Sequential)]
+        public struct MINMAXINFO
+        {
+            public POINT ptReserved;
+            public POINT ptMaxSize;
+            public POINT ptMaxPosition;
+            public POINT ptMinTrackSize;
+            public POINT ptMaxTrackSize;
+        };
+
+
+
+        /// <summary>
+        /// </summary>
+        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
+        public class MONITORINFO
+        {
+            /// <summary>
+            /// </summary>            
+            public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
+
+            /// <summary>
+            /// </summary>            
+            public RECT rcMonitor = new RECT();
+
+            /// <summary>
+            /// </summary>            
+            public RECT rcWork = new RECT();
+
+            /// <summary>
+            /// </summary>            
+            public int dwFlags = 0;
+        }
+
+
+        /// <summary> Win32 </summary>
+        [StructLayout(LayoutKind.Sequential, Pack = 0)]
+        public struct RECT
+        {
+            /// <summary> Win32 </summary>
+            public int left;
+            /// <summary> Win32 </summary>
+            public int top;
+            /// <summary> Win32 </summary>
+            public int right;
+            /// <summary> Win32 </summary>
+            public int bottom;
+
+            /// <summary> Win32 </summary>
+            public static readonly RECT Empty = new RECT();
+
+            /// <summary> Win32 </summary>
+            public int Width
+            {
+                get { return Math.Abs(right - left); }  // Abs needed for BIDI OS
+            }
+            /// <summary> Win32 </summary>
+            public int Height
+            {
+                get { return bottom - top; }
+            }
+
+            /// <summary> Win32 </summary>
+            public RECT(int left, int top, int right, int bottom)
+            {
+                this.left = left;
+                this.top = top;
+                this.right = right;
+                this.bottom = bottom;
+            }
+
+
+            /// <summary> Win32 </summary>
+            public RECT(RECT rcSrc)
+            {
+                this.left = rcSrc.left;
+                this.top = rcSrc.top;
+                this.right = rcSrc.right;
+                this.bottom = rcSrc.bottom;
+            }
+
+            /// <summary> Win32 </summary>
+            public bool IsEmpty
+            {
+                get
+                {
+                    // BUGBUG : On Bidi OS (hebrew arabic) left > right
+                    return left >= right || top >= bottom;
+                }
+            }
+            /// <summary> Return a user friendly representation of this struct </summary>
+            public override string ToString()
+            {
+                if (this == RECT.Empty) { return "RECT {Empty}"; }
+                return "RECT { left : " + left + " / top : " + top + " / right : " + right + " / bottom : " + bottom + " }";
+            }
+
+            /// <summary> Determine if 2 RECT are equal (deep compare) </summary>
+            public override bool Equals(object obj)
+            {
+                if (!(obj is Rect)) { return false; }
+                return (this == (RECT)obj);
+            }
+
+            /// <summary>Return the HashCode for this struct (not garanteed to be unique)</summary>
+            public override int GetHashCode()
+            {
+                return left.GetHashCode() + top.GetHashCode() + right.GetHashCode() + bottom.GetHashCode();
+            }
+
+
+            /// <summary> Determine if 2 RECT are equal (deep compare)</summary>
+            public static bool operator ==(RECT rect1, RECT rect2)
+            {
+                return (rect1.left == rect2.left && rect1.top == rect2.top && rect1.right == rect2.right && rect1.bottom == rect2.bottom);
+            }
+
+            /// <summary> Determine if 2 RECT are different(deep compare)</summary>
+            public static bool operator !=(RECT rect1, RECT rect2)
+            {
+                return !(rect1 == rect2);
+            }
+        }
+
+        [DllImport("user32")]
+        internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [DllImport("User32")]
+        internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
+        #endregion
+
     }
 }