Server/MainForm.cs
changeset 135 2edc5da1796e
parent 126 791786747ba6
child 140 4dff57d255c9
     1.1 --- a/Server/MainForm.cs	Wed May 06 21:05:51 2015 +0200
     1.2 +++ b/Server/MainForm.cs	Wed May 06 21:56:21 2015 +0200
     1.3 @@ -43,6 +43,7 @@
     1.4  //
     1.5  using SharpDisplayClient;
     1.6  using SharpDisplay;
     1.7 +using MiniDisplayInterop;
     1.8  
     1.9  
    1.10  namespace SharpDisplayManager
    1.11 @@ -257,8 +258,8 @@
    1.12  		{
    1.13  			if (iDisplay.IsOpen())
    1.14  			{
    1.15 -				iDisplay.SetIconOnOff(Display.TMiniDisplayIconType.EMiniDisplayIconInternet, iNetworkManager.NetworkListManager.IsConnectedToInternet);
    1.16 -				iDisplay.SetIconOnOff(Display.TMiniDisplayIconType.EMiniDisplayIconNetworkSignal, iNetworkManager.NetworkListManager.IsConnected);
    1.17 +                iDisplay.SetIconOnOff(MiniDisplay.IconType.Internet, iNetworkManager.NetworkListManager.IsConnectedToInternet);
    1.18 +                iDisplay.SetIconOnOff(MiniDisplay.IconType.NetworkSignal, iNetworkManager.NetworkListManager.IsConnected);
    1.19  			}
    1.20  		}
    1.21  
    1.22 @@ -275,8 +276,8 @@
    1.23  			iUpdateCountSinceLastNetworkAnimation = iUpdateCountSinceLastNetworkAnimation % 4;
    1.24  
    1.25  			if (iDisplay.IsOpen() && iNetworkManager.NetworkListManager.IsConnected && iUpdateCountSinceLastNetworkAnimation==0)
    1.26 -			{				
    1.27 -				int iconCount=iDisplay.IconCount(Display.TMiniDisplayIconType.EMiniDisplayIconNetworkSignal);
    1.28 +			{
    1.29 +                int iconCount = iDisplay.IconCount(MiniDisplay.IconType.NetworkSignal);
    1.30  				if (iconCount <= 0)
    1.31  				{
    1.32  					//Prevents div by zero and other undefined behavior
    1.33 @@ -288,11 +289,11 @@
    1.34  				{
    1.35  					if (i < iLastNetworkIconIndex && !(i == 0 && iLastNetworkIconIndex > 3) && !(i == 1 && iLastNetworkIconIndex > 4))
    1.36  					{
    1.37 -						iDisplay.SetIconOn(Display.TMiniDisplayIconType.EMiniDisplayIconNetworkSignal,i);
    1.38 +                        iDisplay.SetIconOn(MiniDisplay.IconType.NetworkSignal, i);
    1.39  					}
    1.40  					else
    1.41  					{
    1.42 -						iDisplay.SetIconOff(Display.TMiniDisplayIconType.EMiniDisplayIconNetworkSignal,i);
    1.43 +                        iDisplay.SetIconOff(MiniDisplay.IconType.NetworkSignal, i);
    1.44  					}
    1.45  				}				
    1.46  			}
    1.47 @@ -393,7 +394,7 @@
    1.48  			if (iDisplay.IsOpen())
    1.49  			{
    1.50  				//First take care our our volume level icons
    1.51 -				int volumeIconCount = iDisplay.IconCount(Display.TMiniDisplayIconType.EMiniDisplayIconVolume);
    1.52 +                int volumeIconCount = iDisplay.IconCount(MiniDisplay.IconType.Volume);
    1.53  				if (volumeIconCount > 0)
    1.54  				{					
    1.55  					//Compute current volume level from system level and the number of segments in our display volume bar.
    1.56 @@ -411,23 +412,23 @@
    1.57  							if (i == segmentOnCount - 1 && roundedUp)
    1.58  							{
    1.59  								//Half brightness
    1.60 -								iDisplay.SetIconStatus(Display.TMiniDisplayIconType.EMiniDisplayIconVolume, i, (iDisplay.IconStatusCount(Display.TMiniDisplayIconType.EMiniDisplayIconVolume) - 1)/2);
    1.61 +                                iDisplay.SetIconStatus(MiniDisplay.IconType.Volume, i, (iDisplay.IconStatusCount(MiniDisplay.IconType.Volume) - 1) / 2);
    1.62  							}
    1.63  							else
    1.64  							{
    1.65  								//Full brightness
    1.66 -								iDisplay.SetIconStatus(Display.TMiniDisplayIconType.EMiniDisplayIconVolume, i, iDisplay.IconStatusCount(Display.TMiniDisplayIconType.EMiniDisplayIconVolume) - 1);
    1.67 +                                iDisplay.SetIconStatus(MiniDisplay.IconType.Volume, i, iDisplay.IconStatusCount(MiniDisplay.IconType.Volume) - 1);
    1.68  							}
    1.69  						}
    1.70  						else
    1.71  						{
    1.72 -							iDisplay.SetIconStatus(Display.TMiniDisplayIconType.EMiniDisplayIconVolume, i, 0);
    1.73 +                            iDisplay.SetIconStatus(MiniDisplay.IconType.Volume, i, 0);
    1.74  						}
    1.75  					}
    1.76  				}
    1.77  
    1.78  				//Take care our our mute icon
    1.79 -				iDisplay.SetIconOnOff(Display.TMiniDisplayIconType.EMiniDisplayIconMute, iMultiMediaDevice.AudioEndpointVolume.Mute);
    1.80 +                iDisplay.SetIconOnOff(MiniDisplay.IconType.Mute, iMultiMediaDevice.AudioEndpointVolume.Mute);
    1.81  			}
    1.82  
    1.83  		}
    1.84 @@ -479,7 +480,7 @@
    1.85  
    1.86  			for (int i = 0; i < count; i++)
    1.87  			{
    1.88 -				comboBoxDisplayType.Items.Add(Display.TypeName((Display.TMiniDisplayType)i));
    1.89 +				comboBoxDisplayType.Items.Add(Display.TypeName((MiniDisplay.Type)i));
    1.90  			}
    1.91  		}
    1.92  
    1.93 @@ -682,13 +683,13 @@
    1.94              {
    1.95                  switch (iDisplay.AttemptRequestCompletion())
    1.96                  {
    1.97 -                    case Display.TMiniDisplayRequest.EMiniDisplayRequestFirmwareRevision:
    1.98 +                    case MiniDisplay.Request.FirmwareRevision:
    1.99                          toolStripStatusLabelConnect.Text += " v" + iDisplay.FirmwareRevision();
   1.100                          //Issue next request then
   1.101                          iDisplay.RequestPowerSupplyStatus();
   1.102                          break;
   1.103  
   1.104 -                    case Display.TMiniDisplayRequest.EMiniDisplayRequestPowerSupplyStatus:
   1.105 +                    case MiniDisplay.Request.PowerSupplyStatus:
   1.106                          if (iDisplay.PowerSupplyStatus())
   1.107                          {
   1.108                              toolStripStatusLabelPower.Text = "ON";
   1.109 @@ -701,7 +702,7 @@
   1.110                          iDisplay.RequestDeviceId();
   1.111                          break;
   1.112  
   1.113 -                    case Display.TMiniDisplayRequest.EMiniDisplayRequestDeviceId:
   1.114 +                    case MiniDisplay.Request.DeviceId:
   1.115                          toolStripStatusLabelConnect.Text += " - " + iDisplay.DeviceId();
   1.116                          //No more request to issue
   1.117                          break;
   1.118 @@ -865,7 +866,7 @@
   1.119          {
   1.120              CloseDisplayConnection();
   1.121  
   1.122 -            if (!iDisplay.Open((Display.TMiniDisplayType)cds.DisplayType))
   1.123 +            if (!iDisplay.Open((MiniDisplay.Type)cds.DisplayType))
   1.124              {   
   1.125  				UpdateStatus();               
   1.126  				toolStripStatusLabelConnect.Text = "Connection error";
   1.127 @@ -1074,15 +1075,15 @@
   1.128  
   1.129  				
   1.130  				//Check if Volume Label is supported. To date only MDM166AA supports that crap :)
   1.131 -				checkBoxShowVolumeLabel.Enabled = iDisplay.IconCount(Display.TMiniDisplayIconType.EMiniDisplayIconVolumeLabel)>0;
   1.132 +				checkBoxShowVolumeLabel.Enabled = iDisplay.IconCount(MiniDisplay.IconType.VolumeLabel)>0;
   1.133  
   1.134  				if (cds.ShowVolumeLabel)
   1.135  				{
   1.136 -					iDisplay.SetIconOn(Display.TMiniDisplayIconType.EMiniDisplayIconVolumeLabel);
   1.137 +                    iDisplay.SetIconOn(MiniDisplay.IconType.VolumeLabel);
   1.138  				}
   1.139  				else
   1.140  				{
   1.141 -					iDisplay.SetIconOff(Display.TMiniDisplayIconType.EMiniDisplayIconVolumeLabel);
   1.142 +                    iDisplay.SetIconOff(MiniDisplay.IconType.VolumeLabel);
   1.143  				}
   1.144              }
   1.145              else