Adding support for display type selection.
1.1 --- a/Server/App.config Tue Aug 26 19:24:04 2014 +0200
1.2 +++ b/Server/App.config Sat Aug 30 18:45:06 2014 +0200
1.3 @@ -25,6 +25,9 @@
1.4 <setting name="DisplayReverseScreen" serializeAs="String">
1.5 <value>False</value>
1.6 </setting>
1.7 + <setting name="DisplayType" serializeAs="String">
1.8 + <value>1</value>
1.9 + </setting>
1.10 </SharpDisplayManager.Properties.Settings>
1.11 </userSettings>
1.12 </configuration>
2.1 --- a/Server/Display.cs Tue Aug 26 19:24:04 2014 +0200
2.2 +++ b/Server/Display.cs Sat Aug 30 18:45:06 2014 +0200
2.3 @@ -5,13 +5,15 @@
2.4 using System.Threading.Tasks;
2.5 //
2.6 using System.Runtime.InteropServices;
2.7 +//using System.Runtime.Serialization;
2.8
2.9 namespace SharpDisplayManager
2.10 {
2.11 +
2.12 /// <summary>
2.13 /// Provide access to our display hardware through MiniDisplay API.
2.14 /// </summary>
2.15 - class Display
2.16 + public class Display
2.17 {
2.18
2.19 //Constructor
2.20 @@ -163,10 +165,14 @@
2.21 //Our display device handle
2.22 IntPtr iDevice;
2.23
2.24 +
2.25 + //[Serializable]
2.26 public enum TMiniDisplayType
2.27 {
2.28 EMiniDisplayAutoDetect, /*Not yet implemented*/
2.29 + //[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
2.30 EMiniDisplayFutabaGP1212A01,
2.31 + //[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
2.32 EMiniDisplayFutabaGP1212A02
2.33 };
2.34
3.1 --- a/Server/MainForm.Designer.cs Tue Aug 26 19:24:04 2014 +0200
3.2 +++ b/Server/MainForm.Designer.cs Sat Aug 30 18:45:06 2014 +0200
3.3 @@ -45,6 +45,7 @@
3.4 this.buttonStartClient = new System.Windows.Forms.Button();
3.5 this.treeViewClients = new System.Windows.Forms.TreeView();
3.6 this.tabPageDisplay = new System.Windows.Forms.TabPage();
3.7 + this.comboBoxDisplayType = new System.Windows.Forms.ComboBox();
3.8 this.buttonSuspend = new System.Windows.Forms.Button();
3.9 this.checkBoxConnectOnStartup = new System.Windows.Forms.CheckBox();
3.10 this.trackBarBrightness = new System.Windows.Forms.TrackBar();
3.11 @@ -286,6 +287,7 @@
3.12 //
3.13 // tabPageDisplay
3.14 //
3.15 + this.tabPageDisplay.Controls.Add(this.comboBoxDisplayType);
3.16 this.tabPageDisplay.Controls.Add(this.buttonSuspend);
3.17 this.tabPageDisplay.Controls.Add(this.checkBoxConnectOnStartup);
3.18 this.tabPageDisplay.Controls.Add(this.trackBarBrightness);
3.19 @@ -302,6 +304,20 @@
3.20 this.tabPageDisplay.Text = "Display";
3.21 this.tabPageDisplay.UseVisualStyleBackColor = true;
3.22 //
3.23 + // comboBoxDisplayType
3.24 + //
3.25 + this.comboBoxDisplayType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
3.26 + this.comboBoxDisplayType.FormattingEnabled = true;
3.27 + this.comboBoxDisplayType.Items.AddRange(new object[] {
3.28 + "Auto Detect",
3.29 + "Futaba GP1212A01A",
3.30 + "Futaba GP1212A02A"});
3.31 + this.comboBoxDisplayType.Location = new System.Drawing.Point(187, 9);
3.32 + this.comboBoxDisplayType.Name = "comboBoxDisplayType";
3.33 + this.comboBoxDisplayType.Size = new System.Drawing.Size(181, 21);
3.34 + this.comboBoxDisplayType.TabIndex = 17;
3.35 + this.comboBoxDisplayType.SelectedIndexChanged += new System.EventHandler(this.comboBoxDisplayType_SelectedIndexChanged);
3.36 + //
3.37 // buttonSuspend
3.38 //
3.39 this.buttonSuspend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
3.40 @@ -624,6 +640,7 @@
3.41 private System.Windows.Forms.Button buttonAlignRight;
3.42 private System.Windows.Forms.Button buttonAlignCenter;
3.43 private System.Windows.Forms.Button buttonAlignLeft;
3.44 + private System.Windows.Forms.ComboBox comboBoxDisplayType;
3.45 }
3.46 }
3.47
4.1 --- a/Server/MainForm.cs Tue Aug 26 19:24:04 2014 +0200
4.2 +++ b/Server/MainForm.cs Sat Aug 30 18:45:06 2014 +0200
4.3 @@ -48,6 +48,7 @@
4.4 checkBoxShowBorders.Checked = Properties.Settings.Default.DisplayShowBorders;
4.5 checkBoxConnectOnStartup.Checked = Properties.Settings.Default.DisplayConnectOnStartup;
4.6 checkBoxReverseScreen.Checked = Properties.Settings.Default.DisplayReverseScreen;
4.7 + comboBoxDisplayType.SelectedIndex = Properties.Settings.Default.DisplayType;
4.8 //
4.9 tableLayoutPanel.CellBorderStyle = (checkBoxShowBorders.Checked ? TableLayoutPanelCellBorderStyle.Single : TableLayoutPanelCellBorderStyle.None);
4.10 //We have a bug when drawing minimized and reusing our bitmap
4.11 @@ -66,9 +67,7 @@
4.12
4.13 if (Properties.Settings.Default.DisplayConnectOnStartup)
4.14 {
4.15 - iDisplay.Open(Display.TMiniDisplayType.EMiniDisplayAutoDetect);
4.16 - UpdateStatus();
4.17 - iDisplay.RequestPowerSupplyStatus();
4.18 + OpenDisplayConnection();
4.19 }
4.20 }
4.21
4.22 @@ -271,9 +270,11 @@
4.23
4.24 }
4.25
4.26 - private void buttonOpen_Click(object sender, EventArgs e)
4.27 + private void OpenDisplayConnection()
4.28 {
4.29 - if (iDisplay.Open(Display.TMiniDisplayType.EMiniDisplayAutoDetect))
4.30 + CloseDisplayConnection();
4.31 +
4.32 + if (iDisplay.Open((Display.TMiniDisplayType)Properties.Settings.Default.DisplayType))
4.33 {
4.34 UpdateStatus();
4.35 iDisplay.RequestPowerSupplyStatus();
4.36 @@ -283,13 +284,22 @@
4.37 UpdateStatus();
4.38 toolStripStatusLabelConnect.Text = "Connection error";
4.39 }
4.40 + }
4.41
4.42 + private void CloseDisplayConnection()
4.43 + {
4.44 + iDisplay.Close();
4.45 + UpdateStatus();
4.46 + }
4.47 +
4.48 + private void buttonOpen_Click(object sender, EventArgs e)
4.49 + {
4.50 + OpenDisplayConnection();
4.51 }
4.52
4.53 private void buttonClose_Click(object sender, EventArgs e)
4.54 {
4.55 - iDisplay.Close();
4.56 - UpdateStatus();
4.57 + CloseDisplayConnection();
4.58 }
4.59
4.60 private void buttonClear_Click(object sender, EventArgs e)
4.61 @@ -784,6 +794,13 @@
4.62 marqueeLabelBottom.TextAlign = ContentAlignment.MiddleRight;
4.63 }
4.64
4.65 + private void comboBoxDisplayType_SelectedIndexChanged(object sender, EventArgs e)
4.66 + {
4.67 + Properties.Settings.Default.DisplayType = comboBoxDisplayType.SelectedIndex;
4.68 + Properties.Settings.Default.Save();
4.69 + OpenDisplayConnection();
4.70 + }
4.71 +
4.72 }
4.73
4.74 /// <summary>
5.1 --- a/Server/Properties/Settings.Designer.cs Tue Aug 26 19:24:04 2014 +0200
5.2 +++ b/Server/Properties/Settings.Designer.cs Sat Aug 30 18:45:06 2014 +0200
5.3 @@ -82,5 +82,17 @@
5.4 this["DisplayReverseScreen"] = value;
5.5 }
5.6 }
5.7 +
5.8 + [global::System.Configuration.UserScopedSettingAttribute()]
5.9 + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
5.10 + [global::System.Configuration.DefaultSettingValueAttribute("1")]
5.11 + public int DisplayType {
5.12 + get {
5.13 + return ((int)(this["DisplayType"]));
5.14 + }
5.15 + set {
5.16 + this["DisplayType"] = value;
5.17 + }
5.18 + }
5.19 }
5.20 }
6.1 --- a/Server/Properties/Settings.settings Tue Aug 26 19:24:04 2014 +0200
6.2 +++ b/Server/Properties/Settings.settings Sat Aug 30 18:45:06 2014 +0200
6.3 @@ -17,5 +17,8 @@
6.4 <Setting Name="DisplayReverseScreen" Type="System.Boolean" Scope="User">
6.5 <Value Profile="(Default)">False</Value>
6.6 </Setting>
6.7 + <Setting Name="DisplayType" Type="System.Int32" Scope="User">
6.8 + <Value Profile="(Default)">1</Value>
6.9 + </Setting>
6.10 </Settings>
6.11 </SettingsFile>
6.12 \ No newline at end of file
7.1 --- a/Server/SharpDisplayManager.csproj Tue Aug 26 19:24:04 2014 +0200
7.2 +++ b/Server/SharpDisplayManager.csproj Sat Aug 30 18:45:06 2014 +0200
7.3 @@ -74,6 +74,7 @@
7.4 <Reference Include="Microsoft.VisualBasic.PowerPacks.Vs, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
7.5 <Reference Include="System" />
7.6 <Reference Include="System.Core" />
7.7 + <Reference Include="System.Runtime.Serialization" />
7.8 <Reference Include="System.ServiceModel" />
7.9 <Reference Include="System.Xml.Linq" />
7.10 <Reference Include="System.Data.DataSetExtensions" />
7.11 @@ -83,6 +84,7 @@
7.12 <Reference Include="System.Drawing" />
7.13 <Reference Include="System.Windows.Forms" />
7.14 <Reference Include="System.Xml" />
7.15 + <Reference Include="System.Xml.Serialization" />
7.16 </ItemGroup>
7.17 <ItemGroup>
7.18 <Compile Include="CbtHook.cs" />
7.19 @@ -99,6 +101,7 @@
7.20 <Compile Include="Properties\AssemblyInfo.cs" />
7.21 <Compile Include="Servers.cs" />
7.22 <Compile Include="Services.cs" />
7.23 + <Compile Include="Settings.cs" />
7.24 <Compile Include="Win32API.cs" />
7.25 <Compile Include="WindowsHook.cs" />
7.26 <Compile Include="WndProcRetHook.cs" />