ContextMenus.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. using PicView.Native;
  2. using System.IO;
  3. using System.Windows;
  4. using System.Windows.Controls;
  5. using System.Windows.Media;
  6. using static PicView.Copy_Paste;
  7. using static PicView.DeleteFiles;
  8. using static PicView.Fields;
  9. using static PicView.FileLists;
  10. using static PicView.Helper;
  11. using static PicView.Navigation;
  12. using static PicView.Open_Save;
  13. using static PicView.RecentFiles;
  14. using static PicView.SvgIcons;
  15. using static PicView.Wallpaper;
  16. using static PicView.Interface;
  17. namespace PicView
  18. {
  19. internal static class ContextMenus
  20. {
  21. internal static void AddContextMenus()
  22. {
  23. #region Add ContextMenus
  24. // Add main contextmenu
  25. cm = new ContextMenu();
  26. var scbf = (SolidColorBrush)Application.Current.Resources["MainColorFadedBrush"];
  27. ///////////////////////////
  28. ///////////////////////////
  29. /// Open \\\\
  30. ///////////////////////////
  31. ///////////////////////////
  32. var opencm = new MenuItem
  33. {
  34. Header = "Open",
  35. InputGestureText = "Ctrl + O"
  36. };
  37. var opencmIcon = new System.Windows.Shapes.Path
  38. {
  39. Data = Geometry.Parse("M1717 931q0-35-53-35h-1088q-40 0-85.5 21.5t-71.5 52.5l-294 363q-18 24-18 40 0 35 53 35h1088q40 0 86-22t71-53l294-363q18-22 18-39zm-1141-163h768v-160q0-40-28-68t-68-28h-576q-40 0-68-28t-28-68v-64q0-40-28-68t-68-28h-320q-40 0-68 28t-28 68v853l256-315q44-53 116-87.5t140-34.5zm1269 163q0 62-46 120l-295 363q-43 53-116 87.5t-140 34.5h-1088q-92 0-158-66t-66-158v-960q0-92 66-158t158-66h320q92 0 158 66t66 158v32h544q92 0 158 66t66 158v160h192q54 0 99 24.5t67 70.5q15 32 15 68z"),
  40. Stretch = Stretch.Fill
  41. };
  42. opencmIcon.Width = opencmIcon.Height = 12;
  43. opencmIcon.Fill = scbf;
  44. opencm.Icon = opencmIcon;
  45. opencm.Click += (s, x) => Open();
  46. cm.Items.Add(opencm);
  47. ///////////////////////////
  48. ///////////////////////////
  49. /// Save \\\\
  50. ///////////////////////////
  51. ///////////////////////////
  52. var savecm = new MenuItem()
  53. {
  54. Header = "Save",
  55. InputGestureText = "Ctrl + S"
  56. };
  57. var savecmIcon = new System.Windows.Shapes.Path
  58. {
  59. Data = Geometry.Parse("M512 1536h768v-384h-768v384zm896 0h128v-896q0-14-10-38.5t-20-34.5l-281-281q-10-10-34-20t-39-10v416q0 40-28 68t-68 28h-576q-40 0-68-28t-28-68v-416h-128v1280h128v-416q0-40 28-68t68-28h832q40 0 68 28t28 68v416zm-384-928v-320q0-13-9.5-22.5t-22.5-9.5h-192q-13 0-22.5 9.5t-9.5 22.5v320q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5-9.5t9.5-22.5zm640 32v928q0 40-28 68t-68 28h-1344q-40 0-68-28t-28-68v-1344q0-40 28-68t68-28h928q40 0 88 20t76 48l280 280q28 28 48 76t20 88z"),
  60. Stretch = Stretch.Fill
  61. };
  62. savecmIcon.Width = savecmIcon.Height = 12;
  63. savecmIcon.Fill = scbf;
  64. savecm.Icon = savecmIcon;
  65. savecm.Click += (s, x) => SaveFiles();
  66. cm.Items.Add(savecm);
  67. ///////////////////////////
  68. ///////////////////////////
  69. /// Print \\\\
  70. ///////////////////////////
  71. ///////////////////////////
  72. var printcm = new MenuItem
  73. {
  74. Header = "Print",
  75. InputGestureText = "Ctrl + P"
  76. };
  77. var printcmIcon = new System.Windows.Shapes.Path
  78. {
  79. Data = Geometry.Parse("M448 1536h896v-256h-896v256zm0-640h896v-384h-160q-40 0-68-28t-28-68v-160h-640v640zm1152 64q0-26-19-45t-45-19-45 19-19 45 19 45 45 19 45-19 19-45zm128 0v416q0 13-9.5 22.5t-22.5 9.5h-224v160q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-160h-224q-13 0-22.5-9.5t-9.5-22.5v-416q0-79 56.5-135.5t135.5-56.5h64v-544q0-40 28-68t68-28h672q40 0 88 20t76 48l152 152q28 28 48 76t20 88v256h64q79 0 135.5 56.5t56.5 135.5z"),
  80. Stretch = Stretch.Fill
  81. };
  82. printcmIcon.Width = printcmIcon.Height = 12;
  83. printcmIcon.Fill = scbf;
  84. printcm.Icon = printcmIcon;
  85. printcm.Click += (s, x) => Print(PicPath);
  86. cm.Items.Add(printcm);
  87. ///////////////////////////
  88. ///////////////////////////
  89. /// Recent Files \\\\
  90. ///////////////////////////
  91. ///////////////////////////
  92. cm.Items.Add(new Separator());
  93. var recentcm = new MenuItem
  94. {
  95. Header = "Recent files"
  96. };
  97. var recentcmIcon = new System.Windows.Shapes.Path
  98. {
  99. Data = Geometry.Parse("M288,48H136c-22.092,0-40,17.908-40,40v336c0,22.092,17.908,40,40,40h240c22.092,0,40-17.908,40-40V176L288,48z M272,192 V80l112, 112H272z"),
  100. Stretch = Stretch.Fill
  101. };
  102. recentcmIcon.Width = recentcmIcon.Height = 12;
  103. recentcmIcon.Fill = scbf;
  104. recentcm.Icon = recentcmIcon;
  105. cm.Items.Add(recentcm);
  106. ///////////////////////////
  107. ///////////////////////////
  108. /// Sort Files \\\\
  109. ///////////////////////////
  110. ///////////////////////////
  111. var sortcm = new MenuItem
  112. {
  113. Header = "Sort files by"
  114. };
  115. var sortcmIcon = new System.Windows.Shapes.Path
  116. {
  117. Data = Geometry.Parse("M666 481q-60 92-137 273-22-45-37-72.5t-40.5-63.5-51-56.5-63-35-81.5-14.5h-224q-14 0-23-9t-9-23v-192q0-14 9-23t23-9h224q250 0 410 225zm1126 799q0 14-9 23l-320 320q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-192q-32 0-85 .5t-81 1-73-1-71-5-64-10.5-63-18.5-58-28.5-59-40-55-53.5-56-69.5q59-93 136-273 22 45 37 72.5t40.5 63.5 51 56.5 63 35 81.5 14.5h256v-192q0-14 9-23t23-9q12 0 24 10l319 319q9 9 9 23zm0-896q0 14-9 23l-320 320q-9 9-23 9-13 0-22.5-9.5t-9.5-22.5v-192h-256q-48 0-87 15t-69 45-51 61.5-45 77.5q-32 62-78 171-29 66-49.5 111t-54 105-64 100-74 83-90 68.5-106.5 42-128 16.5h-224q-14 0-23-9t-9-23v-192q0-14 9-23t23-9h224q48 0 87-15t69-45 51-61.5 45-77.5q32-62 78-171 29-66 49.5-111t54-105 64-100 74-83 90-68.5 106.5-42 128-16.5h256v-192q0-14 9-23t23-9q12 0 24 10l319 319q9 9 9 23z"),
  118. Stretch = Stretch.Fill
  119. };
  120. sortcmIcon.Width = sortcmIcon.Height = 12;
  121. sortcmIcon.Fill = scbf;
  122. sortcm.Icon = sortcmIcon;
  123. ///////////////////////////
  124. /// File Name \\\\
  125. ///////////////////////////
  126. var sortcmChild0 = new RadioButton
  127. {
  128. Content = "File name"
  129. };
  130. sortcmChild0.Click += (s, x) =>
  131. {
  132. Properties.Settings.Default.SortPreference = 0;
  133. if (!string.IsNullOrWhiteSpace(PicPath))
  134. Pics = FileList(Path.GetDirectoryName(PicPath));
  135. };
  136. sortcm.Items.Add(sortcmChild0);
  137. ///////////////////////////
  138. /// File Size \\\\
  139. ///////////////////////////
  140. var sortcmChild1 = new RadioButton
  141. {
  142. Content = "File Size"
  143. };
  144. sortcmChild1.Click += (s, x) =>
  145. {
  146. Properties.Settings.Default.SortPreference = 1;
  147. if (!string.IsNullOrWhiteSpace(PicPath))
  148. Pics = FileList(Path.GetDirectoryName(PicPath));
  149. };
  150. sortcm.Items.Add(sortcmChild1);
  151. ///////////////////////////
  152. /// Creatin Time \\\\
  153. ///////////////////////////
  154. var sortcmChild2 = new RadioButton
  155. {
  156. Content = "Creation time"
  157. };
  158. sortcmChild2.Click += (s, x) =>
  159. {
  160. Properties.Settings.Default.SortPreference = 2;
  161. if (!string.IsNullOrWhiteSpace(PicPath))
  162. Pics = FileList(Path.GetDirectoryName(PicPath));
  163. };
  164. sortcm.Items.Add(sortcmChild2);
  165. ///////////////////////////
  166. /// File extension \\\\
  167. ///////////////////////////
  168. var sortcmChild3 = new RadioButton
  169. {
  170. Content = "File extension"
  171. };
  172. sortcmChild3.Click += (s, x) =>
  173. {
  174. Properties.Settings.Default.SortPreference = 3;
  175. if (!string.IsNullOrWhiteSpace(PicPath))
  176. Pics = FileList(Path.GetDirectoryName(PicPath));
  177. };
  178. sortcm.Items.Add(sortcmChild3);
  179. ///////////////////////////
  180. /// Last Access Time \\\\
  181. ///////////////////////////
  182. var sortcmChild4 = new RadioButton
  183. {
  184. Content = "Last access time"
  185. };
  186. sortcmChild4.Click += (s, x) =>
  187. {
  188. Properties.Settings.Default.SortPreference = 4;
  189. if (!string.IsNullOrWhiteSpace(PicPath))
  190. Pics = FileList(Path.GetDirectoryName(PicPath));
  191. };
  192. sortcm.Items.Add(sortcmChild4);
  193. ///////////////////////////
  194. /// Last Write Time \\\\
  195. ///////////////////////////
  196. var sortcmChild5 = new RadioButton
  197. {
  198. Content = "Last write time"
  199. };
  200. sortcmChild5.Click += (s, x) =>
  201. {
  202. Properties.Settings.Default.SortPreference = 5;
  203. if (!string.IsNullOrWhiteSpace(PicPath))
  204. Pics = FileList(Path.GetDirectoryName(PicPath));
  205. };
  206. sortcm.Items.Add(sortcmChild5);
  207. ///////////////////////////
  208. /// Random \\\\
  209. ///////////////////////////
  210. var sortcmChild6 = new RadioButton
  211. {
  212. Content = "Random"
  213. };
  214. sortcmChild6.Click += (s, x) =>
  215. {
  216. Properties.Settings.Default.SortPreference = 6;
  217. if (!string.IsNullOrWhiteSpace(PicPath))
  218. Pics = FileList(Path.GetDirectoryName(PicPath));
  219. };
  220. sortcm.Items.Add(sortcmChild6);
  221. cm.Items.Add(sortcm);
  222. ///////////////////////////
  223. ///////////////////////////
  224. /// Settings \\\\
  225. ///////////////////////////
  226. ///////////////////////////
  227. var settingscm = new MenuItem
  228. {
  229. Header = "Setings"
  230. };
  231. cm.Items.Add(settingscm);
  232. ///////////////////////////
  233. /// Looping \\\\
  234. ///////////////////////////
  235. var settingscmLoop = new MenuItem();
  236. var settingscmLoopHeader = new CheckBox {
  237. IsChecked = Properties.Settings.Default.Looping,
  238. Content = "Looping"
  239. };
  240. settingscmLoopHeader.Click += Settings.SetLooping;
  241. settingscmLoopHeader.Style = Application.Current.FindResource("Checkstyle") as Style;
  242. settingscmLoopHeader.FontSize = 13;
  243. settingscmLoop.Header = settingscmLoopHeader;
  244. settingscm.Items.Add(settingscmLoop);
  245. ///////////////////////////
  246. /// Scroll \\\\
  247. ///////////////////////////
  248. var settingscmScroll = new MenuItem();
  249. var settingscmScrollHeader = new CheckBox
  250. {
  251. IsChecked = Properties.Settings.Default.ScrollEnabled,
  252. Content = "Scrolling"
  253. };
  254. settingscmScrollHeader.Click += delegate { IsScrollEnabled = IsScrollEnabled ? false : true; };
  255. settingscmScrollHeader.Style = Application.Current.FindResource("Checkstyle") as Style;
  256. settingscmScrollHeader.FontSize = 13;
  257. settingscmScroll.Header = settingscmScrollHeader;
  258. settingscm.Items.Add(settingscmScroll);
  259. //settingscmScroll.Checked += delegate { IsScrollEnabled = IsScrollEnabled ? false : true; };
  260. cm.Items.Add(new Separator());
  261. ///////////////////////////
  262. ///////////////////////////
  263. /// Set as Wallpaper \\\\
  264. ///////////////////////////
  265. ///////////////////////////
  266. var wallcm = new MenuItem
  267. {
  268. Header = "Set as wallpaper"
  269. };
  270. wallcm.Click += (s, x) => SetWallpaper(PicPath, WallpaperStyle.Fill);
  271. var wallcmIcon = new System.Windows.Shapes.Path
  272. {
  273. Data = Geometry.Parse(CameraIconSVG),
  274. Stretch = Stretch.Fill
  275. };
  276. wallcmIcon.Width = wallcmIcon.Height = 12;
  277. wallcmIcon.Fill = scbf;
  278. wallcm.Icon = wallcmIcon;
  279. cm.Items.Add(wallcm);
  280. cm.Items.Add(new Separator());
  281. ///////////////////////////
  282. ///////////////////////////
  283. /// Locate on disk \\\\
  284. ///////////////////////////
  285. ///////////////////////////
  286. var lcdcm = new MenuItem
  287. {
  288. Header = "Locate on disk",
  289. InputGestureText = "F3",
  290. ToolTip = "Opens the current image on your drive"
  291. };
  292. lcdcm.Click += (s, x) => Open_In_Explorer();
  293. cm.Items.Add(lcdcm);
  294. ///////////////////////////
  295. ///////////////////////////
  296. /// File Details \\\\
  297. ///////////////////////////
  298. ///////////////////////////
  299. var fildecm = new MenuItem
  300. {
  301. Header = "File Details",
  302. InputGestureText = "Ctrl + I"
  303. };
  304. fildecm.Click += (s, x) => NativeMethods.ShowFileProperties(PicPath);
  305. cm.Items.Add(fildecm);
  306. cm.Items.Add(new Separator());
  307. ///////////////////////////
  308. ///////////////////////////
  309. /// Copy Picture \\\\
  310. ///////////////////////////
  311. ///////////////////////////
  312. var cppcm = new MenuItem
  313. {
  314. Header = "Copy picture",
  315. InputGestureText = "Ctrl + C"
  316. };
  317. var cppcmIcon = new System.Windows.Shapes.Path
  318. {
  319. Data = Geometry.Parse(CopyIconSVG),
  320. Stretch = Stretch.Fill
  321. };
  322. cppcmIcon.Width = cppcmIcon.Height = 12;
  323. cppcmIcon.Fill = scbf;
  324. cppcm.Icon = cppcmIcon;
  325. cppcm.Click += (s, x) => CopyPic();
  326. cm.Items.Add(cppcm);
  327. ///////////////////////////
  328. ///////////////////////////
  329. /// Cut Picture \\\\
  330. ///////////////////////////
  331. ///////////////////////////
  332. var cpccm = new MenuItem
  333. {
  334. Header = "Cut picture",
  335. InputGestureText = "Ctrl + X"
  336. };
  337. var cpccmIcon = new System.Windows.Shapes.Path();
  338. cpccmIcon.Data = Geometry.Parse(ScissorIconSVG);
  339. cpccmIcon.Stretch = Stretch.Fill;
  340. cpccmIcon.Width = cpccmIcon.Height = 12;
  341. cpccmIcon.Fill = scbf;
  342. cpccm.Icon = cpccmIcon;
  343. cpccm.Click += (s, x) => Cut(PicPath);
  344. cm.Items.Add(cpccm);
  345. ///////////////////////////
  346. ///////////////////////////
  347. /// Paste Picture \\\\
  348. ///////////////////////////
  349. ///////////////////////////
  350. var pastecm = new MenuItem
  351. {
  352. Header = "Paste picture",
  353. InputGestureText = "Ctrl + V"
  354. };
  355. var pastecmIcon = new System.Windows.Shapes.Path();
  356. pastecmIcon.Data = Geometry.Parse("M768 1664h896v-640h-416q-40 0-68-28t-28-68v-416h-384v1152zm256-1440v-64q0-13-9.5-22.5t-22.5-9.5h-704q-13 0-22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h704q13 0 22.5-9.5t9.5-22.5zm256 672h299l-299-299v299zm512 128v672q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-160h-544q-40 0-68-28t-28-68v-1344q0-40 28-68t68-28h1088q40 0 68 28t28 68v328q21 13 36 28l408 408q28 28 48 76t20 88z");
  357. pastecmIcon.Stretch = Stretch.Fill;
  358. pastecmIcon.Width = pastecmIcon.Height = 12;
  359. pastecmIcon.Fill = scbf;
  360. pastecm.Icon = pastecmIcon;
  361. pastecm.Click += (s, x) => Paste();
  362. cm.Items.Add(pastecm);
  363. ///////////////////////////
  364. ///////////////////////////
  365. /// Delete Picture \\\\
  366. ///////////////////////////
  367. ///////////////////////////
  368. var MovetoRecycleBin = new MenuItem
  369. {
  370. Header = "Delete picture",
  371. InputGestureText = "Delete"
  372. };
  373. var MovetoRecycleBinIcon = new System.Windows.Shapes.Path();
  374. MovetoRecycleBinIcon.Data = Geometry.Parse("M836 1169l-15 368-2 22-420-29q-36-3-67-31.5t-47-65.5q-11-27-14.5-55t4-65 12-55 21.5-64 19-53q78 12 509 28zm-387-586l180 379-147-92q-63 72-111.5 144.5t-72.5 125-39.5 94.5-18.5 63l-4 21-190-357q-17-26-18-56t6-47l8-18q35-63 114-188l-140-86zm1231 517l-188 359q-12 29-36.5 46.5t-43.5 20.5l-18 4q-71 7-219 12l8 164-230-367 211-362 7 173q170 16 283 5t170-33zm-785-924q-47 63-265 435l-317-187-19-12 225-356q20-31 60-45t80-10q24 2 48.5 12t42 21 41.5 33 36 34.5 36 39.5 32 35zm655 307l212 363q18 37 12.5 76t-27.5 74q-13 20-33 37t-38 28-48.5 22-47 16-51.5 14-46 12q-34-72-265-436l313-195zm-143-226l142-83-220 373-419-20 151-86q-34-89-75-166t-75.5-123.5-64.5-80-47-46.5l-17-13 405 1q31-3 58 10.5t39 28.5l11 15q39 61 112 190z");
  375. MovetoRecycleBinIcon.Stretch = Stretch.Fill;
  376. MovetoRecycleBinIcon.Width = MovetoRecycleBinIcon.Height = 12;
  377. MovetoRecycleBinIcon.Fill = scbf;
  378. MovetoRecycleBin.Icon = MovetoRecycleBinIcon;
  379. MovetoRecycleBin.Click += (s, x) => DeleteFile(PicPath, true);
  380. cm.Items.Add(MovetoRecycleBin);
  381. ///////////////////////////
  382. ///////////////////////////
  383. /// Close \\\\
  384. ///////////////////////////
  385. ///////////////////////////
  386. cm.Items.Add(new Separator());
  387. var clcm = new MenuItem
  388. {
  389. Header = "Close",
  390. InputGestureText = "Esc",
  391. StaysOpenOnClick = false
  392. };
  393. //var mclcmIcon = new System.Windows.Shapes.Path();
  394. //mclcmIcon.Data = Geometry.Parse("M443.6,387.1L312.4,255.4l131.5-130c5.4-5.4,5.4-14.2,0-19.6l-37.4-37.6c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4 L256,197.8L124.9,68.3c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4L68,105.9c-5.4,5.4-5.4,14.2,0,19.6l131.5,130L68.4,387.1 c-2.6,2.6-4.1,6.1-4.1,9.8c0,3.7,1.4,7.2,4.1,9.8l37.4,37.6c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1L256,313.1l130.7,131.1 c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1l37.4-37.6c2.6-2.6,4.1-6.1,4.1-9.8C447.7,393.2,446.2,389.7,443.6,387.1z");
  395. //mclcmIcon.Stretch = Stretch.Fill;
  396. //mclcmIcon.Width = mclcmIcon.Height = 12;
  397. //mclcmIcon.Fill = scbf;
  398. //clcm.Icon = mclcmIcon;
  399. //clcm.Click += (s, x) => Close();
  400. //cm.Items.Add(clcm);
  401. // Add to elements
  402. mainWindow.img.ContextMenu = mainWindow.bg.ContextMenu = cm;
  403. // Add left and right ContextMenus
  404. var cmLeft = new ContextMenu();
  405. var cmRight = new ContextMenu();
  406. var nextcm = new MenuItem
  407. {
  408. Header = "Next picture",
  409. InputGestureText = "ᗌ or D",
  410. ToolTip = "Go to Next image",
  411. StaysOpenOnClick = true
  412. };
  413. nextcm.Click += (s, x) => Pic();
  414. cmRight.Items.Add(nextcm);
  415. var prevcm = new MenuItem
  416. {
  417. Header = "Previous picture",
  418. InputGestureText = "ᗏ or A",
  419. ToolTip = "Go to previous image in folder",
  420. StaysOpenOnClick = true
  421. };
  422. prevcm.Click += (s, x) => Pic(false);
  423. cmLeft.Items.Add(prevcm);
  424. var firstcm = new MenuItem
  425. {
  426. Header = "First picture",
  427. InputGestureText = "Ctrl + D or Ctrl + ᗌ",
  428. ToolTip = "Go to first image in folder"
  429. };
  430. firstcm.Click += (s, x) => Pic(false, true);
  431. cmLeft.Items.Add(firstcm);
  432. var lastcm = new MenuItem
  433. {
  434. Header = "Last picture",
  435. InputGestureText = "Ctrl + A or Ctrl + ᗏ",
  436. ToolTip = "Go to last image in folder"
  437. };
  438. lastcm.Click += (s, x) => Pic(true, true);
  439. cmRight.Items.Add(lastcm);
  440. // Add to elements
  441. mainWindow.RightButton.ContextMenu = cmRight;
  442. mainWindow.LeftButton.ContextMenu = cmLeft;
  443. clickArrowRight.ContextMenu = cmRight;
  444. clickArrowLeft.ContextMenu = cmLeft;
  445. // Add Title contextMenu
  446. var cmTitle = new ContextMenu();
  447. var clTc = new MenuItem
  448. {
  449. Header = "Copy path to clipboard"
  450. };
  451. clTc.Click += (s, x) => CopyText();
  452. cmTitle.Items.Add(clTc);
  453. mainWindow.Bar.ContextMenu = cmTitle;
  454. switch (Properties.Settings.Default.SortPreference)
  455. {
  456. case 0:
  457. sortcmChild0.IsChecked = true;
  458. break;
  459. case 1:
  460. sortcmChild1.IsChecked = true;
  461. break;
  462. case 2:
  463. sortcmChild2.IsChecked = true;
  464. break;
  465. case 3:
  466. sortcmChild3.IsChecked = true;
  467. break;
  468. case 4:
  469. sortcmChild4.IsChecked = true;
  470. break;
  471. case 5:
  472. sortcmChild5.IsChecked = true;
  473. break;
  474. case 6:
  475. sortcmChild6.IsChecked = true;
  476. break;
  477. default:
  478. sortcmChild0.IsChecked = true;
  479. break;
  480. }
  481. #endregion Add ContextMenus
  482. cm.Opened += (tt, yy) => Recentcm_MouseEnter(recentcm);
  483. }
  484. }
  485. }