ShellView.xaml.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. using Prism.Regions;
  2. using System.Collections.Generic;
  3. using System.Windows;
  4. using Venus_Themes.CustomControls;
  5. using Venus_UI.Themes.Attach;
  6. using Venus_Unity;
  7. using System.Linq;
  8. using System;
  9. using Venus_MainPages.Views;
  10. using System.Windows.Controls;
  11. using System.Windows.Media;
  12. using Venus_Core;
  13. using System.Reflection;
  14. using Venus_MainPages.Unity;
  15. using MECF.Framework.Common.DataCenter;
  16. using MECF.Framework.Common.OperationCenter;
  17. using Venus_MainPages.ViewModels;
  18. using MECF.Framework.Common.CommonData;
  19. using System.Windows.Threading;
  20. using Venus_Themes.Unity;
  21. using MECF.Framework.Common.Equipment;
  22. using WinInterop = System.Windows.Interop;
  23. using System.Runtime.InteropServices;
  24. using Aitex.Core.RT.SCCore;
  25. using Venus_Themes.UserControls;
  26. using System.IO;
  27. using System.Windows.Media.Imaging;
  28. using System.Threading.Tasks;
  29. using Aitex.Core.UI.View.Frame;
  30. using System.Runtime.Serialization.Formatters.Binary;
  31. using System.CodeDom;
  32. namespace Venus_UI.Views
  33. {
  34. /// <summary>
  35. /// ShellView.xaml 的交互逻辑
  36. /// </summary>
  37. public partial class ShellView : Window
  38. {
  39. IRegionManager m_regionManager;
  40. IRegionNavigationService m_regionNavigationService;
  41. List<VenusMenu> VenusMenu;
  42. public List<TabControl> centerTabViews = new List<TabControl>();
  43. public List<AduRadioButtonIcon> buttonList = new List<AduRadioButtonIcon>();
  44. DispatcherTimer timer = new DispatcherTimer();
  45. //public DateTime Time
  46. //{
  47. //get { return DateTime.Now; }
  48. //}
  49. public static readonly DependencyProperty TimeProperty = DependencyProperty.Register(
  50. "Time", typeof(DateTime), typeof(ShellView));
  51. public DateTime Time
  52. {
  53. get { return (DateTime)this.GetValue(TimeProperty); }
  54. set { this.SetValue(TimeProperty, value); }
  55. }
  56. public ShellView(IRegionManager regionManager, IRegionNavigationService regionNavigationService)
  57. {
  58. InitializeComponent();
  59. m_regionManager = regionManager;
  60. m_regionNavigationService = regionNavigationService;
  61. m_regionManager.RegisterViewWithRegion("TopRegion", typeof(Venus_MainPages.Views.TopView));
  62. VenusGlobalEvents.SlotRightClickChangedEvent += Instance_SlotRightClickChangedEvent;
  63. VenusGlobalEvents.SlotWaferTransferEvent += Instance_SlotStartTransferEvent;
  64. timer.Tick += timer_Tick;
  65. timer.Interval = TimeSpan.FromSeconds(0.5);
  66. timer.Start();
  67. UIEvents.PMDoorRaiseChangedEvent += UIEvents_PMDoorRaiseChangedEvent;
  68. UIEvents.LLTDoorRaiseChangedEvent += UIEvents_LLTDoorRaiseChangedEvent;
  69. UIEvents.LLEDoorRaiseChangedEvent += UIEvents_LLEDoorRaiseChangedEvent;
  70. UIEvents.ChamberCreateDeleteWaferEvent += UIEvents_ChamberCreateDeleteWaferEvent;
  71. this.SourceInitialized += (o, e) =>
  72. {
  73. System.IntPtr handler = (new WinInterop.WindowInteropHelper(this)).Handle;
  74. WinInterop.HwndSource.FromHwnd(handler).AddHook(new WinInterop.HwndSourceHook(WindowProc));
  75. };
  76. this.MaxHeight = SystemParameters.WorkArea.Height;
  77. ResizeMode = ResizeMode.CanMinimize;
  78. this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
  79. }
  80. public ShellView()
  81. {
  82. }
  83. void timer_Tick(object sender, EventArgs e)
  84. {
  85. if (Anychange.needchange)
  86. {
  87. Anystationchange(Anychange.menuname, Anychange.args);
  88. Anychange.needchange = false;
  89. }
  90. Tag=DateTime.Now;
  91. }
  92. private void Instance_SlotRightClickChangedEvent(OpenSEMI.Ctrlib.Controls.Slot slot)
  93. {
  94. if (slot != null)
  95. {
  96. ContextMenu cm = ContextMenuManager.Instance.GetSlotMenus(slot);
  97. if (cm != null)
  98. {
  99. slot.ContextMenu = cm;
  100. }
  101. return;
  102. }
  103. }
  104. private void Instance_SlotStartTransferEvent(OpenSEMI.Ctrlib.Controls.DragDropEventArgs e)
  105. {
  106. string info = " from " + e.TranferFrom.ModuleID + " slot " + (e.TranferFrom.SlotID + 1).ToString() + " to " + e.TranferTo.ModuleID + " slot " + (e.TranferTo.SlotID + 1).ToString();
  107. string message = "Are you sure to transfer the wafer: \n" + info;
  108. WaferDialogViewModel vm = new WaferDialogViewModel();
  109. vm.ConfirmText = message;
  110. WaferDialogView dialog = new WaferDialogView()
  111. {
  112. Owner = Application.Current.MainWindow,
  113. };
  114. dialog.DataContext = vm;
  115. dialog.Height = 300;
  116. dialog.Width = 400;
  117. bool alignflag = false;
  118. bool coolingflag = false;
  119. double angel = 0;
  120. double coolingtime = 0;
  121. if (dialog.ShowDialog() == true)
  122. {
  123. alignflag = (bool)dialog.AlignFlag;
  124. coolingflag = (bool)dialog.CoolingFlag;
  125. if (alignflag && !string.IsNullOrEmpty(dialog.Angle))
  126. {
  127. angel = Convert.ToDouble(dialog.Angle);
  128. }
  129. if (coolingflag && !string.IsNullOrEmpty(dialog.CoolingTime))
  130. {
  131. coolingtime = Convert.ToDouble(dialog.CoolingTime);
  132. }
  133. //from robot to robot is illegal. Must be stop
  134. if (e.TranferFrom.ModuleID == e.TranferTo.ModuleID && (e.TranferTo.ModuleID == ModuleName.EfemRobot.ToString() || e.TranferTo.ModuleID == ModuleName.TMRobot.ToString()))
  135. {
  136. }
  137. else
  138. if(e.TranferTo.ModuleID == "VPA" || string.IsNullOrEmpty(e.TranferTo.ModuleID))
  139. InvokeClient.Instance.Service.DoOperation("System.MoveWafer",
  140. e.TranferFrom.ModuleID, e.TranferFrom.SlotID, "VPA", 0, true, 0, coolingflag, coolingtime, "");
  141. InvokeClient.Instance.Service.DoOperation("System.MoveWafer",
  142. e.TranferFrom.ModuleID, e.TranferFrom.SlotID, e.TranferTo.ModuleID, e.TranferTo.SlotID, alignflag, angel, coolingflag, coolingtime, "");
  143. }
  144. else
  145. {
  146. ModuleManager.OnFlashWafer(new FlashWaferInformation() { ModuleName = e.TranferFrom.ModuleID, SoltId = e.TranferFrom.SlotID });
  147. //ModuleManager.OnFlashWafer(new FlashWaferInformation() { ModuleName = e.TranferTo.ModuleID, SoltId = e.TranferTo.SlotID });
  148. }
  149. e.TranferFrom.ClearDragDropStatus();
  150. e.TranferTo.ClearDragDropStatus();
  151. }
  152. private void CustomWnd_Loaded(object sender, RoutedEventArgs e)
  153. {
  154. var h1 = SystemParameters.WorkArea.Height;
  155. var h2 = SystemParameters.PrimaryScreenHeight;
  156. //this.ResizeMode = ResizeMode.CanResize;
  157. //System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width / SystemParameters.PrimaryScreenWidth
  158. VenusMenu = SerializeHelper.Instance.ReadFromJsonFile<List<VenusMenu>>($"Config/UIMenu.json");
  159. int index = 0;
  160. for (int i = 0; i < VenusMenu.Count; i++)
  161. {
  162. if (VenusMenu[i].IsShow == false)
  163. {
  164. continue;
  165. }
  166. string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
  167. if (VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD" || VenusMenu[i].Id == "TM")
  168. {
  169. if (!allModules.Contains(VenusMenu[i].Id))
  170. {
  171. continue;
  172. }
  173. }
  174. //if (VenusMenu[i].Id == "SETM" && SC.GetStringValue("System.ChamberSelect") !="4" && SC.GetStringValue("System.ChamberSelect") != "5")
  175. //{
  176. // //不是SE DE
  177. // continue;
  178. //}
  179. AduRadioButtonIcon aduRadioButtonIcon = new AduRadioButtonIcon();
  180. Button button = new Button();
  181. if (i == 0)
  182. {
  183. aduRadioButtonIcon.IsChecked = true;
  184. }
  185. IconElement.SetPathData(aduRadioButtonIcon, (Geometry)aduRadioButtonIcon.FindResource($"Icon_{VenusMenu[i].Id}"));
  186. aduRadioButtonIcon.Content = VenusMenu[i].Name;
  187. aduRadioButtonIcon.Checked += AduRadioButtonIcon_Click;
  188. aduRadioButtonIcon.SelectBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#0076C4"));
  189. aduRadioButtonIcon.SelectColor = new SolidColorBrush((Colors.White));
  190. //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#94BCD7"));
  191. //aduRadioButtonIcon.DefaultBackground = new SolidColorBrush(Colors.DarkGray);
  192. aduRadioButtonIcon.Width = 180;
  193. //aduRadioButtonIcon.Height = 40;
  194. //aduRadioButtonIcon.Foreground=Brushes.White;
  195. aduRadioButtonIcon.Tag = index;
  196. buttonList.Add(aduRadioButtonIcon);
  197. index += 1;
  198. Bottom_Frame.Children.Add(aduRadioButtonIcon);
  199. TabControl tabControl = new TabControl();
  200. for (int j = 0; j < VenusMenu[i].MenuItem.Count; j++)
  201. {
  202. if (VenusMenu[i].MenuItem[j].IsShow == false)
  203. {
  204. continue;
  205. }
  206. string className;
  207. if ((VenusMenu[i].Id == "PMA" || VenusMenu[i].Id == "PMB" || VenusMenu[i].Id == "PMC" || VenusMenu[i].Id == "PMD") && VenusMenu[i].MenuItem[j].Id == "Operation")
  208. {
  209. JetChamber jetChamber = (JetChamber)(Convert.ToInt32(QueryDataClient.Instance.Service.GetConfig($"{VenusMenu[i].Id}.ChamberType")));
  210. className = $"Venus_MainPages.Views.Over{jetChamber.ToString()}View";
  211. }
  212. else
  213. {
  214. className = $"Venus_MainPages.Views.{VenusMenu[i].MenuItem[j].View}";
  215. }
  216. Type t = Type.GetType($"{className},Venus_MainPages");
  217. var obj = System.Activator.CreateInstance(t);
  218. 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")
  219. {
  220. MethodInfo methodInfo = t.GetMethod("Init", new Type[] { typeof(string) });
  221. methodInfo?.Invoke(obj, new object[] { VenusMenu[i].Id });
  222. }
  223. tabControl.Items.Add(new TabItem() { Header = VenusMenu[i].MenuItem[j].Name, Content = obj });
  224. }
  225. centerTabViews.Add(tabControl);
  226. }
  227. Main_Frame.Content = centerTabViews[0];
  228. ModuleManager.Initialize();
  229. }
  230. public void Anystationchange(string menuviewItem, WaferHistoryWafer queryFilter)
  231. {
  232. UserControl address = new ProcessHistoryView();
  233. ProcessHistoryViewModel vm = new ProcessHistoryViewModel() { };
  234. vm.searchlot(queryFilter.WaferGuid);
  235. //vm.OnDataGridSelectionChanged(vm.Recipes[0]);
  236. address.DataContext = vm;
  237. int s = 0;
  238. for (int i = 0; i < centerTabViews.Count; i++)
  239. {
  240. var item = centerTabViews[i];
  241. foreach (TabItem v in item.Items)
  242. {
  243. if (v.Header.ToString() == "Process History")
  244. {
  245. s = i;
  246. }
  247. }
  248. }
  249. if (s != 0)
  250. {
  251. centerTabViews[s].Items[2] = new TabItem() { Header = menuviewItem, Content = address };
  252. centerTabViews[s].SelectedIndex = 2;
  253. Main_Frame.Content = centerTabViews[s];
  254. }
  255. }
  256. private void AduRadioButtonIcon_Click(object sender, RoutedEventArgs e)
  257. {
  258. var currentButton = sender as AduRadioButtonIcon;
  259. Main_Frame.Content = centerTabViews[Convert.ToInt32(currentButton.Tag)];
  260. }
  261. private void CustomWnd_Closed(object sender, EventArgs e)
  262. {
  263. System.Diagnostics.Process.GetCurrentProcess().Kill();
  264. }
  265. private void UIEvents_ChamberCreateDeleteWaferEvent(WaferOperation obj)
  266. {
  267. if (obj.IsCreate == true)
  268. {
  269. InvokeClient.Instance.Service.DoOperation("CreateWafer", obj.ModuleName, 0);
  270. }
  271. else
  272. {
  273. InvokeClient.Instance.Service.DoOperation("DeleteWafer", obj.ModuleName, 0);
  274. }
  275. }
  276. private void UIEvents_PMDoorRaiseChangedEvent(DoorPara obj)
  277. {
  278. //var value = SC.GetValue<int>($"{obj?.ModuleName}.ChamberType");
  279. //var value=(JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{obj?.ModuleName}.ChamberType").ToString());
  280. JetChamber jetChamber = (JetChamber)Enum.Parse(typeof(JetChamber), QueryDataClient.Instance.Service.GetConfig($"{obj?.ModuleName}.ChamberType").ToString());
  281. if (jetChamber == JetChamber.Venus)
  282. {
  283. InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SetSlitDoor", obj.IsOpen == "Open" ? true : false);
  284. }
  285. else
  286. {
  287. InvokeClient.Instance.Service.DoOperation($"TM.SetMFSlitDoor", obj.ModuleName, obj.IsOpen == "Open" ? true : false);
  288. }
  289. //InvokeClient.Instance.Service.DoOperation($"{obj?.ModuleName}.SlitDoor.{obj?.IsOpen}");
  290. }
  291. private void UIEvents_LLTDoorRaiseChangedEvent(DoorPara obj)
  292. {
  293. InvokeClient.Instance.Service.DoOperation($"TM.SetMFSlitDoor", obj.ModuleName, obj.IsOpen == "Open" ? true : false);
  294. }
  295. private void UIEvents_LLEDoorRaiseChangedEvent(DoorPara obj)
  296. {
  297. InvokeClient.Instance.Service.DoOperation($"TM.SetEFEMSlitDoor", obj.ModuleName, obj.IsOpen == "Open" ? true : false);
  298. }
  299. #region 调用api功能部分
  300. void win_SourceInitialized(object sender, EventArgs e)
  301. {
  302. System.IntPtr handle = (new WinInterop.WindowInteropHelper(this)).Handle;
  303. WinInterop.HwndSource.FromHwnd(handle).AddHook(new WinInterop.HwndSourceHook(WindowProc));
  304. }
  305. private static System.IntPtr WindowProc(
  306. System.IntPtr hwnd,
  307. int msg,
  308. System.IntPtr wParam,
  309. System.IntPtr lParam,
  310. ref bool handled)
  311. {
  312. switch (msg)
  313. {
  314. case 0x0024:
  315. WmGetMinMaxInfo(hwnd, lParam);
  316. handled = true;
  317. break;
  318. }
  319. return (System.IntPtr)0;
  320. }
  321. private static void WmGetMinMaxInfo(System.IntPtr hwnd, System.IntPtr lParam)
  322. {
  323. MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
  324. // Adjust the maximized size and position to fit the work area of the correct monitor
  325. int MONITOR_DEFAULTTONEAREST = 0x00000002;
  326. System.IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
  327. if (monitor != System.IntPtr.Zero)
  328. {
  329. MONITORINFO monitorInfo = new MONITORINFO();
  330. GetMonitorInfo(monitor, monitorInfo);
  331. RECT rcWorkArea = monitorInfo.rcWork;
  332. RECT rcMonitorArea = monitorInfo.rcMonitor;
  333. mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left);
  334. mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top);
  335. mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left);
  336. mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top);
  337. }
  338. Marshal.StructureToPtr(mmi, lParam, true);
  339. }
  340. /// <summary>
  341. /// POINT aka POINTAPI
  342. /// </summary>
  343. [StructLayout(LayoutKind.Sequential)]
  344. public struct POINT
  345. {
  346. /// <summary>
  347. /// x coordinate of point.
  348. /// </summary>
  349. public int x;
  350. /// <summary>
  351. /// y coordinate of point.
  352. /// </summary>
  353. public int y;
  354. /// <summary>
  355. /// Construct a point of coordinates (x,y).
  356. /// </summary>
  357. public POINT(int x, int y)
  358. {
  359. this.x = x;
  360. this.y = y;
  361. }
  362. }
  363. [StructLayout(LayoutKind.Sequential)]
  364. public struct MINMAXINFO
  365. {
  366. public POINT ptReserved;
  367. public POINT ptMaxSize;
  368. public POINT ptMaxPosition;
  369. public POINT ptMinTrackSize;
  370. public POINT ptMaxTrackSize;
  371. };
  372. /// <summary>
  373. /// </summary>
  374. [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
  375. public class MONITORINFO
  376. {
  377. /// <summary>
  378. /// </summary>
  379. public int cbSize = Marshal.SizeOf(typeof(MONITORINFO));
  380. /// <summary>
  381. /// </summary>
  382. public RECT rcMonitor = new RECT();
  383. /// <summary>
  384. /// </summary>
  385. public RECT rcWork = new RECT();
  386. /// <summary>
  387. /// </summary>
  388. public int dwFlags = 0;
  389. }
  390. /// <summary> Win32 </summary>
  391. [StructLayout(LayoutKind.Sequential, Pack = 0)]
  392. public struct RECT
  393. {
  394. /// <summary> Win32 </summary>
  395. public int left;
  396. /// <summary> Win32 </summary>
  397. public int top;
  398. /// <summary> Win32 </summary>
  399. public int right;
  400. /// <summary> Win32 </summary>
  401. public int bottom;
  402. /// <summary> Win32 </summary>
  403. public static readonly RECT Empty = new RECT();
  404. /// <summary> Win32 </summary>
  405. public int Width
  406. {
  407. get { return Math.Abs(right - left); } // Abs needed for BIDI OS
  408. }
  409. /// <summary> Win32 </summary>
  410. public int Height
  411. {
  412. get { return bottom - top; }
  413. }
  414. /// <summary> Win32 </summary>
  415. public RECT(int left, int top, int right, int bottom)
  416. {
  417. this.left = left;
  418. this.top = top;
  419. this.right = right;
  420. this.bottom = bottom;
  421. }
  422. /// <summary> Win32 </summary>
  423. public RECT(RECT rcSrc)
  424. {
  425. this.left = rcSrc.left;
  426. this.top = rcSrc.top;
  427. this.right = rcSrc.right;
  428. this.bottom = rcSrc.bottom;
  429. }
  430. /// <summary> Win32 </summary>
  431. public bool IsEmpty
  432. {
  433. get
  434. {
  435. // BUGBUG : On Bidi OS (hebrew arabic) left > right
  436. return left >= right || top >= bottom;
  437. }
  438. }
  439. /// <summary> Return a user friendly representation of this struct </summary>
  440. public override string ToString()
  441. {
  442. if (this == RECT.Empty) { return "RECT {Empty}"; }
  443. return "RECT { left : " + left + " / top : " + top + " / right : " + right + " / bottom : " + bottom + " }";
  444. }
  445. /// <summary> Determine if 2 RECT are equal (deep compare) </summary>
  446. public override bool Equals(object obj)
  447. {
  448. if (!(obj is Rect)) { return false; }
  449. return (this == (RECT)obj);
  450. }
  451. /// <summary>Return the HashCode for this struct (not garanteed to be unique)</summary>
  452. public override int GetHashCode()
  453. {
  454. return left.GetHashCode() + top.GetHashCode() + right.GetHashCode() + bottom.GetHashCode();
  455. }
  456. /// <summary> Determine if 2 RECT are equal (deep compare)</summary>
  457. public static bool operator ==(RECT rect1, RECT rect2)
  458. {
  459. return (rect1.left == rect2.left && rect1.top == rect2.top && rect1.right == rect2.right && rect1.bottom == rect2.bottom);
  460. }
  461. /// <summary> Determine if 2 RECT are different(deep compare)</summary>
  462. public static bool operator !=(RECT rect1, RECT rect2)
  463. {
  464. return !(rect1 == rect2);
  465. }
  466. }
  467. [DllImport("user32")]
  468. internal static extern bool GetMonitorInfo(IntPtr hMonitor, MONITORINFO lpmi);
  469. /// <summary>
  470. ///
  471. /// </summary>
  472. [DllImport("User32")]
  473. internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
  474. #endregion
  475. #region 截屏
  476. private void SaveWindowContent(Window source, string fileName)
  477. {
  478. //FrameworkElement elem = source.Content as FrameworkElement;
  479. RenderTargetBitmap targetBitmap = new RenderTargetBitmap(
  480. 1920,
  481. 1030,
  482. 96d,
  483. 96d,
  484. PixelFormats.Default);
  485. targetBitmap.Render(source);
  486. BmpBitmapEncoder encoder = new BmpBitmapEncoder();
  487. encoder.Frames.Add(BitmapFrame.Create(targetBitmap));
  488. // save file to disk
  489. using (FileStream fs = File.Open(fileName, FileMode.OpenOrCreate))
  490. {
  491. encoder.Save(fs);
  492. }
  493. }
  494. #endregion
  495. private async void Window_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
  496. {
  497. //this.buttonList[2].IsChecked = true;
  498. //await Task.Delay(5);
  499. //SaveWindowContent(this, "test.jpg");
  500. //this.buttonList[0].IsChecked = true;
  501. }
  502. }
  503. }