# HG changeset patch
# User sl
# Date 1409417106 -7200
# Node ID 0c0ee86760ea5edbaf14c45306eedb91e72ac690
# Parent b5a0fa4770d3dc8b82bae5599fc6bcd00151b470
Adding support for display type selection.
diff -r b5a0fa4770d3 -r 0c0ee86760ea Server/App.config
--- a/Server/App.config Tue Aug 26 19:24:04 2014 +0200
+++ b/Server/App.config Sat Aug 30 18:45:06 2014 +0200
@@ -25,6 +25,9 @@
False
+
+ 1
+
diff -r b5a0fa4770d3 -r 0c0ee86760ea Server/Display.cs
--- a/Server/Display.cs Tue Aug 26 19:24:04 2014 +0200
+++ b/Server/Display.cs Sat Aug 30 18:45:06 2014 +0200
@@ -5,13 +5,15 @@
using System.Threading.Tasks;
//
using System.Runtime.InteropServices;
+//using System.Runtime.Serialization;
namespace SharpDisplayManager
{
+
///
/// Provide access to our display hardware through MiniDisplay API.
///
- class Display
+ public class Display
{
//Constructor
@@ -163,10 +165,14 @@
//Our display device handle
IntPtr iDevice;
+
+ //[Serializable]
public enum TMiniDisplayType
{
EMiniDisplayAutoDetect, /*Not yet implemented*/
+ //[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
EMiniDisplayFutabaGP1212A01,
+ //[EnumMember(Value = "EMiniDisplayFutabaGP1212A01")]
EMiniDisplayFutabaGP1212A02
};
diff -r b5a0fa4770d3 -r 0c0ee86760ea Server/MainForm.Designer.cs
--- a/Server/MainForm.Designer.cs Tue Aug 26 19:24:04 2014 +0200
+++ b/Server/MainForm.Designer.cs Sat Aug 30 18:45:06 2014 +0200
@@ -45,6 +45,7 @@
this.buttonStartClient = new System.Windows.Forms.Button();
this.treeViewClients = new System.Windows.Forms.TreeView();
this.tabPageDisplay = new System.Windows.Forms.TabPage();
+ this.comboBoxDisplayType = new System.Windows.Forms.ComboBox();
this.buttonSuspend = new System.Windows.Forms.Button();
this.checkBoxConnectOnStartup = new System.Windows.Forms.CheckBox();
this.trackBarBrightness = new System.Windows.Forms.TrackBar();
@@ -286,6 +287,7 @@
//
// tabPageDisplay
//
+ this.tabPageDisplay.Controls.Add(this.comboBoxDisplayType);
this.tabPageDisplay.Controls.Add(this.buttonSuspend);
this.tabPageDisplay.Controls.Add(this.checkBoxConnectOnStartup);
this.tabPageDisplay.Controls.Add(this.trackBarBrightness);
@@ -302,6 +304,20 @@
this.tabPageDisplay.Text = "Display";
this.tabPageDisplay.UseVisualStyleBackColor = true;
//
+ // comboBoxDisplayType
+ //
+ this.comboBoxDisplayType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBoxDisplayType.FormattingEnabled = true;
+ this.comboBoxDisplayType.Items.AddRange(new object[] {
+ "Auto Detect",
+ "Futaba GP1212A01A",
+ "Futaba GP1212A02A"});
+ this.comboBoxDisplayType.Location = new System.Drawing.Point(187, 9);
+ this.comboBoxDisplayType.Name = "comboBoxDisplayType";
+ this.comboBoxDisplayType.Size = new System.Drawing.Size(181, 21);
+ this.comboBoxDisplayType.TabIndex = 17;
+ this.comboBoxDisplayType.SelectedIndexChanged += new System.EventHandler(this.comboBoxDisplayType_SelectedIndexChanged);
+ //
// buttonSuspend
//
this.buttonSuspend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -624,6 +640,7 @@
private System.Windows.Forms.Button buttonAlignRight;
private System.Windows.Forms.Button buttonAlignCenter;
private System.Windows.Forms.Button buttonAlignLeft;
+ private System.Windows.Forms.ComboBox comboBoxDisplayType;
}
}
diff -r b5a0fa4770d3 -r 0c0ee86760ea Server/MainForm.cs
--- a/Server/MainForm.cs Tue Aug 26 19:24:04 2014 +0200
+++ b/Server/MainForm.cs Sat Aug 30 18:45:06 2014 +0200
@@ -48,6 +48,7 @@
checkBoxShowBorders.Checked = Properties.Settings.Default.DisplayShowBorders;
checkBoxConnectOnStartup.Checked = Properties.Settings.Default.DisplayConnectOnStartup;
checkBoxReverseScreen.Checked = Properties.Settings.Default.DisplayReverseScreen;
+ comboBoxDisplayType.SelectedIndex = Properties.Settings.Default.DisplayType;
//
tableLayoutPanel.CellBorderStyle = (checkBoxShowBorders.Checked ? TableLayoutPanelCellBorderStyle.Single : TableLayoutPanelCellBorderStyle.None);
//We have a bug when drawing minimized and reusing our bitmap
@@ -66,9 +67,7 @@
if (Properties.Settings.Default.DisplayConnectOnStartup)
{
- iDisplay.Open(Display.TMiniDisplayType.EMiniDisplayAutoDetect);
- UpdateStatus();
- iDisplay.RequestPowerSupplyStatus();
+ OpenDisplayConnection();
}
}
@@ -271,9 +270,11 @@
}
- private void buttonOpen_Click(object sender, EventArgs e)
+ private void OpenDisplayConnection()
{
- if (iDisplay.Open(Display.TMiniDisplayType.EMiniDisplayAutoDetect))
+ CloseDisplayConnection();
+
+ if (iDisplay.Open((Display.TMiniDisplayType)Properties.Settings.Default.DisplayType))
{
UpdateStatus();
iDisplay.RequestPowerSupplyStatus();
@@ -283,13 +284,22 @@
UpdateStatus();
toolStripStatusLabelConnect.Text = "Connection error";
}
+ }
+ private void CloseDisplayConnection()
+ {
+ iDisplay.Close();
+ UpdateStatus();
+ }
+
+ private void buttonOpen_Click(object sender, EventArgs e)
+ {
+ OpenDisplayConnection();
}
private void buttonClose_Click(object sender, EventArgs e)
{
- iDisplay.Close();
- UpdateStatus();
+ CloseDisplayConnection();
}
private void buttonClear_Click(object sender, EventArgs e)
@@ -784,6 +794,13 @@
marqueeLabelBottom.TextAlign = ContentAlignment.MiddleRight;
}
+ private void comboBoxDisplayType_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ Properties.Settings.Default.DisplayType = comboBoxDisplayType.SelectedIndex;
+ Properties.Settings.Default.Save();
+ OpenDisplayConnection();
+ }
+
}
///
diff -r b5a0fa4770d3 -r 0c0ee86760ea Server/Properties/Settings.Designer.cs
--- a/Server/Properties/Settings.Designer.cs Tue Aug 26 19:24:04 2014 +0200
+++ b/Server/Properties/Settings.Designer.cs Sat Aug 30 18:45:06 2014 +0200
@@ -82,5 +82,17 @@
this["DisplayReverseScreen"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("1")]
+ public int DisplayType {
+ get {
+ return ((int)(this["DisplayType"]));
+ }
+ set {
+ this["DisplayType"] = value;
+ }
+ }
}
}
diff -r b5a0fa4770d3 -r 0c0ee86760ea Server/Properties/Settings.settings
--- a/Server/Properties/Settings.settings Tue Aug 26 19:24:04 2014 +0200
+++ b/Server/Properties/Settings.settings Sat Aug 30 18:45:06 2014 +0200
@@ -17,5 +17,8 @@
False
+
+ 1
+
\ No newline at end of file
diff -r b5a0fa4770d3 -r 0c0ee86760ea Server/SharpDisplayManager.csproj
--- a/Server/SharpDisplayManager.csproj Tue Aug 26 19:24:04 2014 +0200
+++ b/Server/SharpDisplayManager.csproj Sat Aug 30 18:45:06 2014 +0200
@@ -74,6 +74,7 @@
+
@@ -83,6 +84,7 @@
+
@@ -99,6 +101,7 @@
+