| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582 | 
							- using Prism.Regions;
 
- using System.Collections.Generic;
 
- using System.Windows;
 
- using Venus_Themes.CustomControls;
 
- using Venus_UI.Themes.Attach;
 
- using Venus_Unity;
 
- using System.Linq;
 
- using System;
 
- using Venus_MainPages.Views;
 
- using System.Windows.Controls;
 
- using System.Windows.Media;
 
- using Venus_Core;
 
- using System.Reflection;
 
- using Venus_MainPages.Unity;
 
- using MECF.Framework.Common.DataCenter;
 
- using MECF.Framework.Common.OperationCenter;
 
- using Venus_MainPages.ViewModels;
 
- using MECF.Framework.Common.CommonData;
 
- using System.Windows.Threading;
 
- using Venus_Themes.Unity;
 
- using MECF.Framework.Common.Equipment;
 
- using WinInterop = System.Windows.Interop;
 
- using System.Runtime.InteropServices;
 
- using Aitex.Core.RT.SCCore;
 
- using Venus_Themes.UserControls;
 
- using System.IO;
 
- using System.Windows.Media.Imaging;
 
- using System.Threading.Tasks;
 
- using Aitex.Core.UI.View.Frame;
 
- using System.Runtime.Serialization.Formatters.Binary;
 
- using System.CodeDom;
 
- namespace Venus_UI.Views
 
- {
 
-     /// <summary>
 
-     /// ShellView.xaml 的交互逻辑
 
-     /// </summary>
 
-     public partial class ShellView : Window
 
-     {
 
-         IRegionManager m_regionManager;
 
-         IRegionNavigationService m_regionNavigationService;
 
-         List<VenusMenu> VenusMenu;
 
-         public List<TabControl> centerTabViews = new List<TabControl>();
 
-         public List<AduRadioButtonIcon> buttonList = new List<AduRadioButtonIcon>();
 
-         DispatcherTimer timer = new DispatcherTimer();
 
-         //public DateTime Time
 
-         //{ 
 
-         //get { return DateTime.Now; }
 
-         //}
 
-         public static readonly DependencyProperty TimeProperty = DependencyProperty.Register(
 
-            "Time", typeof(DateTime), typeof(ShellView));
 
-         public DateTime Time
 
-         {
 
-             get { return (DateTime)this.GetValue(TimeProperty); }
 
-             set { this.SetValue(TimeProperty, value); }
 
-         }
 
-         public ShellView(IRegionManager regionManager, IRegionNavigationService regionNavigationService)
 
-         {
 
-             InitializeComponent();
 
-             m_regionManager = regionManager;
 
-             m_regionNavigationService = regionNavigationService;
 
-             m_regionManager.RegisterViewWithRegion("TopRegion", typeof(Venus_MainPages.Views.TopView));
 
-             VenusGlobalEvents.SlotRightClickChangedEvent += Instance_SlotRightClickChangedEvent;
 
-             VenusGlobalEvents.SlotWaferTransferEvent += Instance_SlotStartTransferEvent;
 
-             timer.Tick += timer_Tick;
 
-             timer.Interval = TimeSpan.FromSeconds(0.5);
 
-             timer.Start();
 
-             UIEvents.PMDoorRaiseChangedEvent += UIEvents_PMDoorRaiseChangedEvent;
 
-             UIEvents.LLTDoorRaiseChangedEvent += UIEvents_LLTDoorRaiseChangedEvent;
 
-             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;
 
-         }
 
-         public ShellView()
 
-         { 
 
-         
 
-         }
 
-         void timer_Tick(object sender, EventArgs e)
 
-         {
 
-             if (Anychange.needchange)
 
-             {
 
-                 Anystationchange(Anychange.menuname, Anychange.args);
 
-                 Anychange.needchange = false;
 
-             }
 
-             Tag=DateTime.Now;
 
-         }
 
-         private void Instance_SlotRightClickChangedEvent(OpenSEMI.Ctrlib.Controls.Slot slot)
 
-         {
 
-             if (slot != null)
 
-             {
 
-                 ContextMenu cm = ContextMenuManager.Instance.GetSlotMenus(slot);
 
-                 if (cm != null)
 
-                 {
 
-                     slot.ContextMenu = cm;
 
-                 }
 
-                 return;
 
-             }
 
-         }
 
-         private void Instance_SlotStartTransferEvent(OpenSEMI.Ctrlib.Controls.DragDropEventArgs e)
 
-         {
 
-             string info = " from " + e.TranferFrom.ModuleID + " slot " + (e.TranferFrom.SlotID + 1).ToString() + " to " + e.TranferTo.ModuleID + " slot " + (e.TranferTo.SlotID + 1).ToString();
 
-             string message = "Are you sure to transfer the wafer: \n" + info;
 
-             WaferDialogViewModel vm = new WaferDialogViewModel();
 
-             vm.ConfirmText = message;
 
-             WaferDialogView dialog = new WaferDialogView()
 
-             {
 
-                 Owner = Application.Current.MainWindow,
 
-             };
 
-             dialog.DataContext = vm;
 
-             dialog.Height = 300;
 
-             dialog.Width = 400;
 
-             bool alignflag = false;
 
-             bool coolingflag = false;
 
-             double angel = 0;
 
-             double coolingtime = 0;
 
-             if (dialog.ShowDialog() == true)
 
-             {
 
-                 alignflag = (bool)dialog.AlignFlag;
 
-                 coolingflag = (bool)dialog.CoolingFlag;
 
-                 if (alignflag && !string.IsNullOrEmpty(dialog.Angle))
 
-                 {
 
-                     angel = Convert.ToDouble(dialog.Angle);
 
-                 }
 
-                 if (coolingflag && !string.IsNullOrEmpty(dialog.CoolingTime))
 
-                 {
 
-                     coolingtime = Convert.ToDouble(dialog.CoolingTime);
 
-                 }
 
-                 //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
 
-             {
 
-                 ModuleManager.OnFlashWafer(new FlashWaferInformation() { ModuleName = e.TranferFrom.ModuleID, SoltId = e.TranferFrom.SlotID });
 
-                 //ModuleManager.OnFlashWafer(new FlashWaferInformation() { ModuleName = e.TranferTo.ModuleID, SoltId = e.TranferTo.SlotID });
 
-             }
 
-             e.TranferFrom.ClearDragDropStatus();
 
-             e.TranferTo.ClearDragDropStatus();
 
-         }
 
-         private void CustomWnd_Loaded(object sender, RoutedEventArgs e)
 
-         {
 
-             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(',');
 
-                 if (VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM")
 
-                 {
 
-                     if (!allModules.Contains(VenusMenu[i].Id))
 
-                     {
 
-                         continue;
 
-                     }
 
-                 }
 
-                 //if (VenusMenu[i].Id == "SETM" && SC.GetStringValue("System.ChamberSelect") !="4" && SC.GetStringValue("System.ChamberSelect") != "5")
 
-                 //{
 
-                 //    //不是SE DE
 
-                 //    continue;
 
-                 //}
 
-                 AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
 
-                 Button button = new Button();
 
-                 if (i == 0)
 
-                 {
 
-                     aduRadioButtonIcon.IsChecked = true;
 
-                 }
 
-                 IconElement.SetPathData(aduRadioButtonIcon, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
 
-                 aduRadioButtonIcon.Content = VenusMenu[i].Name;
 
-                 aduRadioButtonIcon.Checked += AduRadioButtonIcon_Click;
 
-                 aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0076C4"));
 
-                 aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.White));
 
-                 //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
 
-                 //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
 
-                 aduRadioButtonIcon.Width = 180;
 
-                 //aduRadioButtonIcon.Height = 40;
 
-                 //aduRadioButtonIcon.Foreground=Brushes.White;
 
-                 aduRadioButtonIcon.Tag = index;
 
-                 buttonList.Add(aduRadioButtonIcon);
 
-                 index += 1;
 
-                 Bottom_Frame.Children.Add(aduRadioButtonIcon);
 
-                 TabControl tabControl = new TabControl();
 
-                 for (int j = 0; j < VenusMenu[i].MenuItem.Count; j++)
 
-                 {
 
-                     if (VenusMenu[i].MenuItem[j].IsShow == false)
 
-                     {
 
-                         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")
 
-                     {
 
-                         JetChamber jetChamber = (JetChamber)(Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{VenusMenu[i].Id}.ChamberType")));
 
-                         className = $"Venus_MainPages.Views.Over{jetChamber.ToString()}View";
 
-                     }
 
-                     else
 
-                     {
 
-                         className = $"Venus_MainPages.Views.{VenusMenu[i].MenuItem[j].View}";
 
-                     }
 
-                     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")
 
-                     {
 
-                         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);
 
-             }
 
-             Main_Frame.Content = centerTabViews[0];
 
-             ModuleManager.Initialize();
 
-         }
 
-         public void Anystationchange(string menuviewItem, WaferHistoryWafer queryFilter)
 
-         {
 
-             UserControl address = new ProcessHistoryView();
 
-             ProcessHistoryViewModel vm = new ProcessHistoryViewModel() { };
 
-             vm.searchlot(queryFilter.WaferGuid);
 
-             //vm.OnDataGridSelectionChanged(vm.Recipes[0]);
 
-             address.DataContext = vm;
 
-             int s = 0;
 
-             for (int i = 0; i < centerTabViews.Count; i++)
 
-             {
 
-                 var item = centerTabViews[i];
 
-                 foreach (TabItem v in item.Items)
 
-                 {
 
-                     if (v.Header.ToString() == "Process History")
 
-                     {
 
-                         s = i;
 
-                     }
 
-                 }
 
-             }
 
-             if (s != 0)
 
-             {
 
-                 centerTabViews[s].Items[2] = new TabItem() { Header = menuviewItem, Content = address };
 
-                 centerTabViews[s].SelectedIndex = 2;
 
-                 Main_Frame.Content = centerTabViews[s];
 
-             }
 
-         }
 
-         private void AduRadioButtonIcon_Click(object sender, RoutedEventArgs e)
 
-         {
 
-             var currentButton = sender as AduRadioButtonIcon;
 
-             Main_Frame.Content = centerTabViews[Convert.ToInt32(currentButton.Tag)];
 
-         }
 
-         private void CustomWnd_Closed(object sender, EventArgs e)
 
-         {
 
-             System.Diagnostics.Process.GetCurrentProcess().Kill();
 
-         }
 
-         private void UIEvents_ChamberCreateDeleteWaferEvent(WaferOperation obj)
 
-         {
 
-             if (obj.IsCreate == true)
 
-             {
 
-                 InvokeClient.Instance.Service.DoOperation("CreateWafer", obj.ModuleName, 0);
 
-             }
 
-             else
 
-             {
 
-                 InvokeClient.Instance.Service.DoOperation("DeleteWafer", obj.ModuleName, 0);
 
-             }
 
-         }
 
-         private void UIEvents_PMDoorRaiseChangedEvent(DoorPara obj)
 
-         {
 
-             //var value = SC.GetValue<int>($"{obj?.ModuleName}.ChamberType");
 
-             //var value=(JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{obj?.ModuleName}.ChamberType").ToString());
 
-             JetChamber jetChamber = (JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{obj?.ModuleName}.ChamberType").ToString());
 
-             if (jetChamber == JetChamber.Venus)
 
-             {
 
-                 InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SetSlitDoor", obj.IsOpen == "Open" ? true : false);
 
-             }
 
-             else
 
-             {
 
-                 InvokeClient.Instance.Service.DoOperation($"TM.SetMFSlitDoor", obj.ModuleName, obj.IsOpen == "Open" ? true : false);
 
-             }
 
-             //InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SlitDoor.{obj?.IsOpen}");
 
-         }
 
-         private void UIEvents_LLTDoorRaiseChangedEvent(DoorPara obj)
 
-         {
 
-             InvokeClient.Instance.Service.DoOperation($"TM.SetMFSlitDoor", obj.ModuleName, obj.IsOpen == "Open" ? true : false);
 
-         }
 
-         private void UIEvents_LLEDoorRaiseChangedEvent(DoorPara obj)
 
-         {
 
-             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
 
-         #region 截屏
 
-         private void SaveWindowContent(Window source, string fileName)
 
-         {
 
-             //FrameworkElement elem = source.Content as FrameworkElement;
 
-             RenderTargetBitmap targetBitmap = new RenderTargetBitmap(
 
-                                        1920,
 
-                                        1080,
 
-                                        96d,
 
-                                        96d,
 
-                                        PixelFormats.Default);
 
-             targetBitmap.Render(source);
 
-             BmpBitmapEncoder encoder = new BmpBitmapEncoder();
 
-             encoder.Frames.Add(BitmapFrame.Create(targetBitmap));
 
-             // save file to disk
 
-             using (FileStream fs = File.Open(fileName, FileMode.OpenOrCreate))
 
-             {
 
-                 encoder.Save(fs);
 
-             }
 
-         }
 
-         #endregion
 
-         private   void Window_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
 
-         {
 
-             
 
-             //this.buttonList[1].IsChecked = true;
 
-             ////await Task.Delay(1000);
 
-             //SaveWindowContent(this, "test.png");
 
-             //this.buttonList[0].IsChecked = true;
 
-         }      
 
-     }
 
- }
 
 
  |