GUI/SoundGraphDisplay.cs
branchMiniDisplay
changeset 435 9ffcd8ed8537
parent 434 480652d72031
child 436 e9aefd454d1e
     1.1 --- a/GUI/SoundGraphDisplay.cs	Sun Feb 03 19:06:01 2013 +0100
     1.2 +++ b/GUI/SoundGraphDisplay.cs	Mon Feb 04 00:47:01 2013 +0100
     1.3 @@ -13,6 +13,7 @@
     1.4  using System.Drawing;
     1.5  using System.Text;
     1.6  using System.Windows.Forms;
     1.7 +using System.Windows;
     1.8  using OpenHardwareMonitor.Hardware;
     1.9  using OpenHardwareMonitor.Utilities;
    1.10  using System.Runtime.InteropServices;
    1.11 @@ -51,11 +52,14 @@
    1.12   */
    1.13  static class SoundGraph
    1.14  {
    1.15 +
    1.16 +    const int WM_APP = 0x8000;
    1.17 +    public const int WM_DSP_PLUGIN_NOTIFY = WM_APP + 1121;
    1.18      /**DSPResult
    1.19      @brief	These enumeration values represent the returned result for iMON Display API function calls.\n
    1.20  			    All iMON Display API function calls return one of this result values.\n
    1.21  			    For meaning of each result, refer the comment of each line below*/
    1.22 -    public enum DSPResult : uint
    1.23 +    public enum DSPResult : int
    1.24      {
    1.25  	    DSP_SUCCEEDED = 0,				//// Function Call Succeeded Without Error
    1.26  	    DSP_E_FAIL,						//// Unspecified Failure
    1.27 @@ -75,7 +79,7 @@
    1.28      @brief	These enumeration values represent the result status for requesting Display Plug-in Mode to iMON.\n
    1.29  			    iMON Display API notifies one of this result values to the caller application after requesting Display Plug-in Mode to iMON.\n
    1.30  			    For more information, refer the comment of each line below*/
    1.31 -    public enum DSPNInitResult : uint
    1.32 +    public enum DSPNInitResult : int
    1.33      {
    1.34  	    DSPN_SUCCEEDED = 0,				//// Display Plug-in Mode is Initialized Successfully
    1.35  	    DSPN_ERR_IN_USED = 0x0100,		//// Display Plug-in is Already Used by Other Application
    1.36 @@ -90,7 +94,7 @@
    1.37      /**DSPType
    1.38      @brief	These enumeration values represent display type.\n
    1.39  			    Currently iMON Display API supports VFD and LCD products.*/
    1.40 -    public enum DSPType : uint
    1.41 +    public enum DSPType : int
    1.42      {
    1.43  	    DSPN_DSP_NONE	= 0,
    1.44  	    DSPN_DSP_VFD	= 0x01,			//// VFD products
    1.45 @@ -104,7 +108,7 @@
    1.46  			    The caller application should assign the message and the winodw handle to receivce message with IMON_Display_Init fucntion.\n
    1.47  			    These enumeration values are used with WPARAM parameter of the message.\n 
    1.48  			    For more information, see the explanation of each notification code below*/
    1.49 -    public enum DSPNotifyCode : uint
    1.50 +    public enum DSPNotifyCode : int
    1.51      {
    1.52  	    /**DSPNM_PLUGIN_SUCCEED
    1.53  	    @brief	When API succeeds to get the control for the display, API will post caller-specified message with DSPNM_PLUGIN_SUCCEED as WPARAM parameter.\n
    1.54 @@ -345,17 +349,17 @@
    1.55               */
    1.56          }
    1.57  
    1.58 -        private void Init(IntPtr aHWND)
    1.59 +        public void Init(IntPtr aHWND)
    1.60          {
    1.61 -            //iIMON_Display_Init
    1.62 +            iIMON_Display_Init(aHWND, SoundGraph.WM_DSP_PLUGIN_NOTIFY);
    1.63          }
    1.64  
    1.65 -        private void Uninit()
    1.66 +        public void Uninit()
    1.67          {
    1.68              iIMON_Display_Uninit();
    1.69          }
    1.70  
    1.71 -        private void SetText(string aUpperLine, string aLowerLine)
    1.72 +        public void SetText(string aUpperLine, string aLowerLine)
    1.73          {
    1.74  
    1.75          }
    1.76 @@ -379,5 +383,42 @@
    1.77          {
    1.78              get { return iSoundGraphDll!=IntPtr.Zero; }
    1.79          }
    1.80 +
    1.81 +        public void DisplayPluginMessage(int uErrCode, bool bError)
    1.82 +        {
    1.83 +	        if(bError)
    1.84 +	        {
    1.85 +                switch ((SoundGraph.DSPNInitResult)uErrCode)
    1.86 +		        {
    1.87 +                    case SoundGraph.DSPNInitResult.DSPN_ERR_IN_USED: 
    1.88 +                        Console.Write("Display Plug-in is Already Used by Other Application.\n"); break;
    1.89 +                    case SoundGraph.DSPNInitResult.DSPN_ERR_HW_DISCONNECTED: 
    1.90 +                        Console.Write("iMON HW is Not Connected."); break;
    1.91 +                    case SoundGraph.DSPNInitResult.DSPN_ERR_NOT_SUPPORTED_HW: 
    1.92 +                        Console.Write("The Connected iMON HW doesn't Support Display Plug-in.\n"); break;
    1.93 +                    case SoundGraph.DSPNInitResult.DSPN_ERR_PLUGIN_DISABLED: 
    1.94 +                        Console.Write("Display Plug-in Mode Option is Disabled.\n"); break;
    1.95 +                    case SoundGraph.DSPNInitResult.DSPN_ERR_IMON_NO_REPLY: 
    1.96 +                        Console.Write("The Latest iMON is Not Installed or iMON Not Running.\n"); break;
    1.97 +                    case SoundGraph.DSPNInitResult.DSPN_ERR_UNKNOWN: 
    1.98 +                        Console.Write("Unknown Failure.\n"); break;
    1.99 +		        }
   1.100 +    	    }
   1.101 +	        else
   1.102 +            {
   1.103 +                switch ((SoundGraph.DSPNotifyCode)uErrCode)
   1.104 +		        {
   1.105 +                    case SoundGraph.DSPNotifyCode.DSPNM_PLUGIN_SUCCEED: 
   1.106 +                        Console.Write("Plug-in Mode Inited Successfully.\n"); break;
   1.107 +                    case SoundGraph.DSPNotifyCode.DSPNM_IMON_RESTARTED: 
   1.108 +                        Console.Write("iMON Started and Plug-in Mode Inited.\n"); break;
   1.109 +                    case SoundGraph.DSPNotifyCode.DSPNM_HW_CONNECTED: 
   1.110 +                        Console.Write("iMON HW Connected and Plug-in Mode Inited.\n"); break;
   1.111 +		        }
   1.112 +	        }
   1.113 +	    
   1.114 +            //GetDlgItem(IDC_STATIC_INFO)->SetWindowText((LPCTSTR)strErrMsg);
   1.115 +        }
   1.116 +
   1.117      }
   1.118  }