RightCardControl.xaml.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. using DraggAnimatedPanelExample;
  2. using GeekDesk.Constant;
  3. using GeekDesk.Control.Other;
  4. using GeekDesk.Control.Windows;
  5. using GeekDesk.Util;
  6. using GeekDesk.ViewModel;
  7. using HandyControl.Controls;
  8. using System;
  9. using System.Collections.ObjectModel;
  10. using System.Diagnostics;
  11. using System.IO;
  12. using System.Threading;
  13. using System.Windows;
  14. using System.Windows.Controls;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Animation;
  18. using System.Windows.Threading;
  19. namespace GeekDesk.Control.UserControls.PannelCard
  20. {
  21. /// <summary>
  22. /// RightCardControl.xaml 的交互逻辑
  23. /// </summary>
  24. public partial class RightCardControl : UserControl
  25. {
  26. private AppData appData = MainWindow.appData;
  27. ListBoxDragDropManager<IconInfo> dragMgr;
  28. //private Thread dropCheckThread = null;
  29. public RightCardControl()
  30. {
  31. InitializeComponent();
  32. this.Loaded += RightCardControl_Loaded;
  33. }
  34. private void RightCardControl_Loaded(object sender, RoutedEventArgs e)
  35. {
  36. this.dragMgr = new ListBoxDragDropManager<IconInfo>(this.IconListBox);
  37. }
  38. //#region 图标拖动
  39. //DelegateCommand<int[]> _swap;
  40. //public DelegateCommand<int[]> SwapCommand
  41. //{
  42. // get
  43. // {
  44. // if (_swap == null)
  45. // _swap = new DelegateCommand<int[]>(
  46. // (indexes) =>
  47. // {
  48. // DROP_ICON = true;
  49. // if (appData.AppConfig.IconSortType != SortType.CUSTOM
  50. // && (dropCheckThread == null || !dropCheckThread.IsAlive))
  51. // {
  52. // dropCheckThread = new Thread(() =>
  53. // {
  54. // do
  55. // {
  56. // DROP_ICON = false;
  57. // Thread.Sleep(1000);
  58. // } while (DROP_ICON);
  59. // MainWindow.appData.AppConfig.IconSortType = SortType.CUSTOM;
  60. // App.Current.Dispatcher.Invoke(() =>
  61. // {
  62. // if (MainWindow.mainWindow.Visibility == Visibility.Collapsed
  63. // || MainWindow.mainWindow.Opacity != 1)
  64. // {
  65. // Growl.WarningGlobal("已将图标排序规则重置为自定义!");
  66. // }
  67. // else
  68. // {
  69. // Growl.Warning("已将图标排序规则重置为自定义!", "MainWindowGrowl");
  70. // }
  71. // });
  72. // });
  73. // dropCheckThread.Start();
  74. // }
  75. // int fromS = indexes[0];
  76. // int to = indexes[1];
  77. // ObservableCollection<IconInfo> iconList = appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList;
  78. // var elementSource = iconList[to];
  79. // var dragged = iconList[fromS];
  80. // iconList.Remove(dragged);
  81. // iconList.Insert(to, dragged);
  82. // }
  83. // );
  84. // return _swap;
  85. // }
  86. //}
  87. //#endregion 图标拖动
  88. private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  89. {
  90. if (appData.AppConfig.DoubleOpen)
  91. {
  92. IconClick(sender, e);
  93. }
  94. }
  95. private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
  96. {
  97. if (!appData.AppConfig.DoubleOpen)
  98. {
  99. IconClick(sender, e);
  100. }
  101. }
  102. /// <summary>
  103. /// 图标点击事件
  104. /// </summary>
  105. /// <param name="sender"></param>
  106. /// <param name="e"></param>
  107. private void IconClick(object sender, MouseButtonEventArgs e)
  108. {
  109. if (appData.AppConfig.DoubleOpen && e.ClickCount >= 2)
  110. {
  111. IconInfo icon = (IconInfo)((Panel)sender).Tag;
  112. if (icon.AdminStartUp)
  113. {
  114. StartIconApp(icon, IconStartType.ADMIN_STARTUP);
  115. }
  116. else
  117. {
  118. StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
  119. }
  120. }
  121. else if (!appData.AppConfig.DoubleOpen && e.ClickCount == 1)
  122. {
  123. IconInfo icon = (IconInfo)((Panel)sender).Tag;
  124. if (icon.AdminStartUp)
  125. {
  126. StartIconApp(icon, IconStartType.ADMIN_STARTUP);
  127. }
  128. else
  129. {
  130. StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
  131. }
  132. }
  133. }
  134. /// <summary>
  135. /// 管理员方式启动
  136. /// </summary>
  137. /// <param name="sender"></param>
  138. /// <param name="e"></param>
  139. private void IconAdminStart(object sender, RoutedEventArgs e)
  140. {
  141. IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
  142. StartIconApp(icon, IconStartType.ADMIN_STARTUP);
  143. }
  144. /// <summary>
  145. /// 打开文件所在位置
  146. /// </summary>
  147. /// <param name="sender"></param>
  148. /// <param name="e"></param>
  149. private void ShowInExplore(object sender, RoutedEventArgs e)
  150. {
  151. IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
  152. StartIconApp(icon, IconStartType.SHOW_IN_EXPLORE);
  153. }
  154. private void StartIconApp(IconInfo icon, IconStartType type)
  155. {
  156. try
  157. {
  158. using (Process p = new Process())
  159. {
  160. string startArg = icon.StartArg;
  161. if (startArg != null && Constants.SYSTEM_ICONS.ContainsKey(startArg))
  162. {
  163. StartSystemApp(startArg, type);
  164. }
  165. else
  166. {
  167. p.StartInfo.FileName = icon.Path;
  168. if (!StringUtil.IsEmpty(startArg))
  169. {
  170. p.StartInfo.Arguments = startArg;
  171. }
  172. if (icon.IconType == IconType.OTHER)
  173. {
  174. if (!File.Exists(icon.Path) && !Directory.Exists(icon.Path))
  175. {
  176. HandyControl.Controls.Growl.WarningGlobal("程序启动失败(文件路径不存在或已删除)!");
  177. return;
  178. }
  179. p.StartInfo.WorkingDirectory = icon.Path.Substring(0, icon.Path.LastIndexOf("\\"));
  180. switch (type)
  181. {
  182. case IconStartType.ADMIN_STARTUP:
  183. //p.StartInfo.Arguments = "1";//启动参数
  184. p.StartInfo.Verb = "runas";
  185. //p.StartInfo.CreateNoWindow = false; //设置显示窗口
  186. p.StartInfo.UseShellExecute = true;//不使用操作系统外壳程序启动进程
  187. //p.StartInfo.ErrorDialog = false;
  188. if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
  189. {
  190. //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
  191. if (appData.AppConfig.MarginHide)
  192. {
  193. if (!MarginHide.IsMargin())
  194. {
  195. MainWindow.HideApp();
  196. }
  197. }
  198. else
  199. {
  200. MainWindow.HideApp();
  201. }
  202. }
  203. break;// c#好像不能case穿透
  204. case IconStartType.DEFAULT_STARTUP:
  205. if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
  206. {
  207. //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
  208. if (appData.AppConfig.MarginHide)
  209. {
  210. if (!MarginHide.IsMargin())
  211. {
  212. MainWindow.HideApp();
  213. }
  214. }
  215. else
  216. {
  217. MainWindow.HideApp();
  218. }
  219. }
  220. break;
  221. case IconStartType.SHOW_IN_EXPLORE:
  222. p.StartInfo.FileName = "Explorer.exe";
  223. p.StartInfo.Arguments = "/e,/select," + icon.Path;
  224. break;
  225. }
  226. }
  227. else
  228. {
  229. if (appData.AppConfig.AppHideType == AppHideType.START_EXE && !RunTimeStatus.LOCK_APP_PANEL)
  230. {
  231. //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
  232. if (appData.AppConfig.MarginHide)
  233. {
  234. if (!MarginHide.IS_HIDE)
  235. {
  236. MainWindow.HideApp();
  237. }
  238. }
  239. else
  240. {
  241. MainWindow.HideApp();
  242. }
  243. }
  244. }
  245. p.Start();
  246. }
  247. }
  248. icon.Count++;
  249. //隐藏搜索框
  250. if (RunTimeStatus.SEARCH_BOX_SHOW)
  251. {
  252. MainWindow.mainWindow.HidedSearchBox();
  253. }
  254. }
  255. catch (Exception e)
  256. {
  257. HandyControl.Controls.Growl.WarningGlobal("程序启动失败(不支持的启动方式)!");
  258. LogUtil.WriteErrorLog(e, "程序启动失败:path=" + icon.Path + ",type=" + type);
  259. }
  260. }
  261. private void StartSystemApp(string startArg, IconStartType type)
  262. {
  263. if (type == IconStartType.SHOW_IN_EXPLORE)
  264. {
  265. Growl.WarningGlobal("系统项目不支持打开文件位置操作!");
  266. return;
  267. }
  268. switch (startArg)
  269. {
  270. case "Calculator":
  271. Process.Start("calc.exe");
  272. break;
  273. case "Computer":
  274. Process.Start("explorer.exe");
  275. break;
  276. case "GroupPolicy":
  277. Process.Start("gpedit.msc");
  278. break;
  279. case "Notepad":
  280. Process.Start("notepad");
  281. break;
  282. case "Network":
  283. Process.Start("ncpa.cpl");
  284. break;
  285. case "RecycleBin":
  286. Process.Start("shell:RecycleBinFolder");
  287. break;
  288. case "Registry":
  289. Process.Start("regedit.exe");
  290. break;
  291. case "Mstsc":
  292. if (type == IconStartType.ADMIN_STARTUP)
  293. {
  294. Process.Start("mstsc", "-admin");
  295. }
  296. else
  297. {
  298. Process.Start("mstsc");
  299. }
  300. break;
  301. case "Control":
  302. Process.Start("Control");
  303. break;
  304. case "CMD":
  305. if (type == IconStartType.ADMIN_STARTUP)
  306. {
  307. using (Process process = new Process())
  308. {
  309. process.StartInfo.FileName = "cmd.exe";
  310. process.StartInfo.Verb = "runas";
  311. process.Start();
  312. }
  313. }
  314. else
  315. {
  316. Process.Start("cmd");
  317. }
  318. break;
  319. case "Services":
  320. Process.Start("services.msc");
  321. break;
  322. }
  323. //如果开启了贴边隐藏 则窗体不贴边才隐藏窗口
  324. if (appData.AppConfig.MarginHide)
  325. {
  326. if (!MarginHide.IS_HIDE)
  327. {
  328. MainWindow.HideApp();
  329. }
  330. }
  331. else
  332. {
  333. MainWindow.HideApp();
  334. }
  335. }
  336. /// <summary>
  337. /// 拖动添加项目
  338. /// </summary>
  339. /// <param name="sender"></param>
  340. /// <param name="e"></param>
  341. private void Wrap_Drop(object sender, DragEventArgs e)
  342. {
  343. Array dropObject = (System.Array)e.Data.GetData(DataFormats.FileDrop);
  344. if (dropObject == null) return;
  345. foreach (object obj in dropObject)
  346. {
  347. string path = (string)obj;
  348. IconInfo iconInfo = CommonCode.GetIconInfoByPath(path);
  349. MainWindow.appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Add(iconInfo);
  350. }
  351. CommonCode.SortIconList();
  352. CommonCode.SaveAppData(MainWindow.appData);
  353. }
  354. /// <summary>
  355. /// 从列表删除图标
  356. /// </summary>
  357. /// <param name="sender"></param>
  358. /// <param name="e"></param>
  359. private void RemoveIcon(object sender, RoutedEventArgs e)
  360. {
  361. appData.MenuList[appData.AppConfig.SelectedMenuIndex].IconList.Remove((IconInfo)((MenuItem)sender).Tag);
  362. }
  363. private void SystemContextMenu(object sender, RoutedEventArgs e)
  364. {
  365. IconInfo icon = (IconInfo)((MenuItem)sender).Tag;
  366. DirectoryInfo[] folders = new DirectoryInfo[1];
  367. folders[0] = new DirectoryInfo(icon.Path);
  368. ShellContextMenu scm = new ShellContextMenu();
  369. System.Drawing.Point p = System.Windows.Forms.Cursor.Position;
  370. p.X -= 80;
  371. p.Y -= 80;
  372. scm.ShowContextMenu(folders, p);
  373. }
  374. /// <summary>
  375. /// 弹出Icon属性修改面板
  376. /// </summary>
  377. /// <param name="sender"></param>
  378. /// <param name="e"></param>
  379. private void PropertyConfig(object sender, RoutedEventArgs e)
  380. {
  381. IconInfo info = (IconInfo)((MenuItem)sender).Tag;
  382. switch (info.IconType)
  383. {
  384. case IconType.URL:
  385. IconInfoUrlDialog urlDialog = new IconInfoUrlDialog(info);
  386. urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "IconInfoDialog");
  387. break;
  388. default:
  389. IconInfoDialog dialog = new IconInfoDialog(info);
  390. dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "IconInfoDialog");
  391. break;
  392. }
  393. }
  394. private void StackPanel_MouseEnter(object sender, MouseEventArgs e)
  395. {
  396. double width = appData.AppConfig.ImageWidth;
  397. double height = appData.AppConfig.ImageHeight;
  398. width += width * 0.15;
  399. height += height * 0.15;
  400. Thread t = new Thread(() =>
  401. {
  402. this.Dispatcher.BeginInvoke(new Action(() =>
  403. {
  404. ImgStoryBoard(sender, (int)width, (int)height, 1, true);
  405. }));
  406. });
  407. t.IsBackground = true;
  408. t.Start();
  409. }
  410. private void StackPanel_MouseLeave(object sender, MouseEventArgs e)
  411. {
  412. Thread t = new Thread(() =>
  413. {
  414. this.Dispatcher.BeginInvoke(new Action(() =>
  415. {
  416. ImgStoryBoard(sender, appData.AppConfig.ImageWidth, appData.AppConfig.ImageHeight, 260);
  417. }));
  418. });
  419. t.IsBackground = true;
  420. t.Start();
  421. }
  422. private void ImgStoryBoard(object sender, int height, int width, int milliseconds, bool checkRmStoryboard = false)
  423. {
  424. if (appData.AppConfig.PMModel) return;
  425. //int count = 0;
  426. //Panel sp = sender as Panel;
  427. //Image img = sp.Children[0] as Image;
  428. //int nowH = (int)img.Height;
  429. //bool isSmall = nowH > height;
  430. //if (!isSmall)
  431. //{
  432. // img.Height = height;
  433. // img.Width = width;
  434. // return;
  435. //}
  436. //double subLen = (double)Math.Abs(nowH - height) / (double)milliseconds;
  437. //new Thread(() =>
  438. //{
  439. // this.Dispatcher.Invoke(() =>
  440. // {
  441. // while (count < milliseconds)
  442. // {
  443. // if (!isSmall)
  444. // {
  445. // img.Height += subLen;
  446. // img.Width += subLen;
  447. // } else
  448. // {
  449. // //if (img.Height > 1)
  450. // //{
  451. // // img.Height -= 1;
  452. // // img.Width -= 1;
  453. // //}
  454. // Application.Current.Dispatcher.Invoke(DispatcherPriority.Background,
  455. // new Action(delegate {
  456. // img.Height -= subLen;
  457. // img.Width -= subLen;
  458. // }));
  459. // //img.Height -= subLen;
  460. // //img.Width -= subLen;
  461. // }
  462. // count++;
  463. // Thread.Sleep(1);
  464. // }
  465. // img.Height = height;
  466. // img.Width = width;
  467. // });
  468. //}).Start();
  469. Panel sp = sender as Panel;
  470. DependencyObject dos = sp.Parent;
  471. Image img = sp.Children[0] as Image;
  472. double afterHeight = img.Height;
  473. double afterWidth = img.Width;
  474. //动画定义
  475. Storyboard myStoryboard = new Storyboard();
  476. DoubleAnimation heightAnimation = new DoubleAnimation
  477. {
  478. From = afterHeight,
  479. To = height,
  480. Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
  481. };
  482. DoubleAnimation widthAnimation = new DoubleAnimation
  483. {
  484. From = afterWidth,
  485. To = width,
  486. Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds))
  487. };
  488. Timeline.SetDesiredFrameRate(heightAnimation, 60);
  489. Timeline.SetDesiredFrameRate(widthAnimation, 60);
  490. Storyboard.SetTarget(widthAnimation, img);
  491. Storyboard.SetTargetProperty(widthAnimation, new PropertyPath("Width"));
  492. Storyboard.SetTarget(heightAnimation, img);
  493. Storyboard.SetTargetProperty(heightAnimation, new PropertyPath("Height"));
  494. myStoryboard.Children.Add(heightAnimation);
  495. myStoryboard.Children.Add(widthAnimation);
  496. CheckRemoveStoryboard crs = new CheckRemoveStoryboard
  497. {
  498. sb = myStoryboard,
  499. sp = sp,
  500. heightAnimation = heightAnimation,
  501. widthAnimation = widthAnimation,
  502. img = img,
  503. isMouseOver = !checkRmStoryboard
  504. };
  505. heightAnimation.Completed += (s, e) =>
  506. {
  507. if (checkRmStoryboard)
  508. {
  509. ThreadStart ts = new ThreadStart(crs.Remove);
  510. System.Threading.Thread t = new System.Threading.Thread(ts);
  511. t.IsBackground = true;
  512. t.Start();
  513. }
  514. else
  515. {
  516. img.BeginAnimation(WidthProperty, null);
  517. img.BeginAnimation(HeightProperty, null);
  518. }
  519. };
  520. img.BeginAnimation(WidthProperty, widthAnimation);
  521. img.BeginAnimation(HeightProperty, heightAnimation);
  522. //###################################################################
  523. //myStoryboard.Completed += (s, e) =>
  524. //{
  525. // if (checkRmStoryboard)
  526. // {
  527. // ThreadStart ts = new ThreadStart(crs.Remove);
  528. // System.Threading.Thread t = new System.Threading.Thread(ts);
  529. // t.Start();
  530. // }
  531. // else
  532. // {
  533. // myStoryboard.Remove();
  534. // }
  535. //};
  536. //myStoryboard.Begin();
  537. }
  538. private class CheckRemoveStoryboard
  539. {
  540. public Storyboard sb;
  541. public Panel sp;
  542. public Image img;
  543. public DoubleAnimation heightAnimation;
  544. public DoubleAnimation widthAnimation;
  545. public bool isMouseOver;
  546. public void Remove()
  547. {
  548. while (true)
  549. {
  550. if (sp.IsMouseOver == isMouseOver)
  551. {
  552. App.Current.Dispatcher.Invoke((Action)(() =>
  553. {
  554. img.BeginAnimation(WidthProperty, null);
  555. img.BeginAnimation(HeightProperty, null);
  556. //heightAnimation.FillBehavior = FillBehavior.Stop;
  557. //widthAnimation.FillBehavior = FillBehavior.Stop;
  558. }));
  559. return;
  560. }
  561. else
  562. {
  563. System.Threading.Thread.Sleep(500);
  564. }
  565. }
  566. }
  567. }
  568. public void RemoveSB(Object sb)
  569. {
  570. Storyboard sb2 = sb as Storyboard;
  571. System.Threading.Thread.Sleep(500);
  572. sb2.Remove();
  573. }
  574. /// <summary>
  575. /// 添加URL项目
  576. /// </summary>
  577. /// <param name="sender"></param>
  578. /// <param name="e"></param>
  579. private void AddUrlIcon(object sender, RoutedEventArgs e)
  580. {
  581. IconInfoUrlDialog urlDialog = new IconInfoUrlDialog();
  582. urlDialog.dialog = HandyControl.Controls.Dialog.Show(urlDialog, "IconInfoDialog");
  583. }
  584. /// <summary>
  585. /// 添加系统项目
  586. /// </summary>
  587. /// <param name="sender"></param>
  588. /// <param name="e"></param>
  589. private void AddSystemIcon(object sender, RoutedEventArgs e)
  590. {
  591. SystemItemWindow.Show();
  592. }
  593. public void VisibilitySearchCard(Visibility vb)
  594. {
  595. VerticalCard.Visibility = vb;
  596. if (vb == Visibility.Visible)
  597. {
  598. WrapCard.Visibility = Visibility.Collapsed;
  599. }
  600. else
  601. {
  602. WrapCard.Visibility = Visibility.Visible;
  603. }
  604. }
  605. /// <summary>
  606. /// 搜索Card点击事件
  607. /// </summary>
  608. /// <param name="sender"></param>
  609. /// <param name="e"></param>
  610. private void VerticalCard_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  611. {
  612. //隐藏搜索框
  613. if (RunTimeStatus.SEARCH_BOX_SHOW)
  614. {
  615. MainWindow.mainWindow.HidedSearchBox();
  616. }
  617. }
  618. /// <summary>
  619. /// 设置光标
  620. /// </summary>
  621. /// <param name="sender"></param>
  622. /// <param name="e"></param>
  623. private void CursorPanel_MouseEnter(object sender, MouseEventArgs e)
  624. {
  625. this.Cursor = Cursors.Hand;
  626. }
  627. /// <summary>
  628. /// 设置光标
  629. /// </summary>
  630. /// <param name="sender"></param>
  631. /// <param name="e"></param>
  632. private void CursorPanel_MouseLeave(object sender, MouseEventArgs e)
  633. {
  634. this.Cursor = Cursors.Arrow;
  635. }
  636. /// <summary>
  637. /// 锁定/解锁主面板
  638. /// </summary>
  639. /// <param name="sender"></param>
  640. /// <param name="e"></param>
  641. private void LockAppPanel(object sender, RoutedEventArgs e)
  642. {
  643. RunTimeStatus.LOCK_APP_PANEL = !RunTimeStatus.LOCK_APP_PANEL;
  644. }
  645. private void WrapCard_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
  646. {
  647. if (RunTimeStatus.LOCK_APP_PANEL)
  648. {
  649. CardLockCM.Header = "解锁主面板";
  650. } else
  651. {
  652. CardLockCM.Header = "锁定主面板";
  653. }
  654. }
  655. public void SearchListBoxIndexAdd()
  656. {
  657. if (SearchListBox.Items.Count > 0)
  658. {
  659. if (SearchListBox.SelectedIndex < SearchListBox.Items.Count - 1)
  660. {
  661. SearchListBox.SelectedIndex += 1;
  662. }
  663. }
  664. }
  665. public void SearchListBoxIndexSub()
  666. {
  667. if (SearchListBox.Items.Count > 0)
  668. {
  669. if (SearchListBox.SelectedIndex > 0)
  670. {
  671. SearchListBox.SelectedIndex -= 1;
  672. }
  673. }
  674. }
  675. public void StartupSelectionItem()
  676. {
  677. if (SearchListBox.SelectedItem != null)
  678. {
  679. IconInfo icon = SearchListBox.SelectedItem as IconInfo;
  680. if (icon.AdminStartUp)
  681. {
  682. StartIconApp(icon, IconStartType.ADMIN_STARTUP);
  683. }
  684. else
  685. {
  686. StartIconApp(icon, IconStartType.DEFAULT_STARTUP);
  687. }
  688. }
  689. }
  690. private void SearchListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  691. {
  692. SearchListBox.ScrollIntoView(SearchListBox.SelectedItem);
  693. }
  694. }
  695. }