Guest User

Untitled

a guest
Jul 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. // **************************************************
  2. // Custom code for AbcCodeForm
  3. // Created: 7/18/2018 8:02:42 PM
  4. // **************************************************
  5. using System;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Diagnostics;
  9. using System.Windows.Forms;
  10. using Erp.Adapters;
  11. using Erp.UI;
  12. using Ice.Lib;
  13. using Ice.Adapters;
  14. using Ice.Lib.Customization;
  15. using Ice.Lib.ExtendedProps;
  16. using Ice.Lib.Framework;
  17. using Ice.Lib.Searches;
  18. using Ice.UI.FormFunctions;
  19.  
  20. // need this one
  21. using System.Runtime.InteropServices;
  22.  
  23. public static class TaskbarProgress
  24. {
  25. public enum TaskbarStates
  26. {
  27. NoProgress = 0,
  28. Indeterminate = 0x1,
  29. Normal = 0x2,
  30. Error = 0x4,
  31. Paused = 0x8
  32. }
  33.  
  34. [ComImport()]
  35. [Guid("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")]
  36. [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
  37. private interface ITaskbarList3
  38. {
  39. // ITaskbarList
  40. [PreserveSig]
  41. void HrInit();
  42. [PreserveSig]
  43. void AddTab(IntPtr hwnd);
  44. [PreserveSig]
  45. void DeleteTab(IntPtr hwnd);
  46. [PreserveSig]
  47. void ActivateTab(IntPtr hwnd);
  48. [PreserveSig]
  49. void SetActiveAlt(IntPtr hwnd);
  50.  
  51. // ITaskbarList2
  52. [PreserveSig]
  53. void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
  54.  
  55. // ITaskbarList3
  56. [PreserveSig]
  57. void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal);
  58. [PreserveSig]
  59. void SetProgressState(IntPtr hwnd, TaskbarStates state);
  60. }
  61.  
  62. [ComImport()]
  63. [Guid("56fdf344-fd6d-11d0-958a-006097c9a090")]
  64. [ClassInterface(ClassInterfaceType.None)]
  65. private class TaskbarInstance
  66. {
  67. }
  68.  
  69. private static ITaskbarList3 taskbarInstance = (ITaskbarList3)new TaskbarInstance();
  70. private static bool taskbarSupported = Environment.OSVersion.Version >= new Version(6, 1);
  71.  
  72. public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
  73. {
  74. if (taskbarSupported) taskbarInstance.SetProgressState(windowHandle, taskbarState);
  75. }
  76.  
  77. public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
  78. {
  79. if (taskbarSupported) taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
  80. }
  81. }
  82.  
  83. public class Script
  84. {
  85.  
  86.  
  87. public void InitializeCustomCode()
  88. {
  89.  
  90. this.epiButtonC1.Click += new System.EventHandler(this.epiButtonC1_Click);
  91.  
  92. }
  93.  
  94. public void DestroyCustomCode()
  95. {
  96.  
  97. this.epiButtonC1.Click -= new System.EventHandler(this.epiButtonC1_Click);
  98.  
  99. }
  100.  
  101.  
  102. private void epiButtonC1_Click(object sender, System.EventArgs args)
  103. {
  104. // ** Place Event Handling Code Here **
  105. TaskbarProgress.SetValue(AbcCodeForm.Handle, 50, 100);
  106. TaskbarProgress.SetState(AbcCodeForm.Handle, TaskbarProgress.TaskbarStates.Error);
  107. }
  108. }
Add Comment
Please, Sign In to add comment