# HG changeset patch # User sl # Date 1409513698 -7200 # Node ID f7ad2dce46a9b485261393138187f39330c2f014 # Parent b22b0127afa4e965280b648b13a5569183a28ba4 GP1212A02: Clock support. diff -r b22b0127afa4 -r f7ad2dce46a9 Server/Display.cs --- a/Server/Display.cs Sun Aug 31 18:33:05 2014 +0200 +++ b/Server/Display.cs Sun Aug 31 21:34:58 2014 +0200 @@ -120,6 +120,21 @@ return MiniDisplaySupportPowerOnOff(iDevice); } + public void ShowClock() + { + MiniDisplayShowClock(iDevice); + } + + public void HideClock() + { + MiniDisplayHideClock(iDevice); + } + + public bool SupportClock() + { + return MiniDisplaySupportClock(iDevice); + } + public bool PowerSupplyStatus() { bool res = MiniDisplayPowerSupplyStatus(iDevice); @@ -274,5 +289,16 @@ [return: MarshalAs(UnmanagedType.I1)] public static extern bool MiniDisplaySupportPowerOnOff(IntPtr aDevice); + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern void MiniDisplayShowClock(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + public static extern void MiniDisplayHideClock(IntPtr aDevice); + + [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool MiniDisplaySupportClock(IntPtr aDevice); + + } } diff -r b22b0127afa4 -r f7ad2dce46a9 Server/MainForm.Designer.cs --- a/Server/MainForm.Designer.cs Sun Aug 31 18:33:05 2014 +0200 +++ b/Server/MainForm.Designer.cs Sun Aug 31 21:34:58 2014 +0200 @@ -72,6 +72,8 @@ this.buttonAddRow = new System.Windows.Forms.Button(); this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel(); this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel(); + this.buttonHideClock = new System.Windows.Forms.Button(); + this.buttonShowClock = new System.Windows.Forms.Button(); this.panelDisplay.SuspendLayout(); this.tableLayoutPanel.SuspendLayout(); this.statusStrip.SuspendLayout(); @@ -292,6 +294,8 @@ // // tabPageDisplay // + this.tabPageDisplay.Controls.Add(this.buttonShowClock); + this.tabPageDisplay.Controls.Add(this.buttonHideClock); this.tabPageDisplay.Controls.Add(this.buttonPowerOff); this.tabPageDisplay.Controls.Add(this.buttonPowerOn); this.tabPageDisplay.Controls.Add(this.label1); @@ -622,13 +626,13 @@ this.marqueeLabelTop.AutoEllipsis = true; this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent; this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill; - this.marqueeLabelTop.Location = new System.Drawing.Point(1, 1); + this.marqueeLabelTop.Location = new System.Drawing.Point(1, -187); this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0); this.marqueeLabelTop.Name = "marqueeLabelTop"; this.marqueeLabelTop.OwnTimer = false; this.marqueeLabelTop.PixelsPerSecond = 64; this.marqueeLabelTop.Separator = "|"; - this.marqueeLabelTop.Size = new System.Drawing.Size(254, 1); + this.marqueeLabelTop.Size = new System.Drawing.Size(254, 20); this.marqueeLabelTop.TabIndex = 2; this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789"; this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -638,7 +642,7 @@ // this.marqueeLabelBottom.AutoEllipsis = true; this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill; - this.marqueeLabelBottom.Location = new System.Drawing.Point(1, -19); + this.marqueeLabelBottom.Location = new System.Drawing.Point(1, -61); this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0); this.marqueeLabelBottom.Name = "marqueeLabelBottom"; this.marqueeLabelBottom.OwnTimer = false; @@ -650,6 +654,26 @@ this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.marqueeLabelBottom.UseCompatibleTextRendering = true; // + // buttonHideClock + // + this.buttonHideClock.Location = new System.Drawing.Point(293, 153); + this.buttonHideClock.Name = "buttonHideClock"; + this.buttonHideClock.Size = new System.Drawing.Size(75, 23); + this.buttonHideClock.TabIndex = 22; + this.buttonHideClock.Text = "Hide Clock"; + this.buttonHideClock.UseVisualStyleBackColor = true; + this.buttonHideClock.Click += new System.EventHandler(this.buttonHideClock_Click); + // + // buttonShowClock + // + this.buttonShowClock.Location = new System.Drawing.Point(293, 124); + this.buttonShowClock.Name = "buttonShowClock"; + this.buttonShowClock.Size = new System.Drawing.Size(75, 23); + this.buttonShowClock.TabIndex = 23; + this.buttonShowClock.Text = "Show Clock"; + this.buttonShowClock.UseVisualStyleBackColor = true; + this.buttonShowClock.Click += new System.EventHandler(this.buttonShowClock_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -726,6 +750,8 @@ private System.Windows.Forms.Label label1; private System.Windows.Forms.Button buttonPowerOff; private System.Windows.Forms.Button buttonPowerOn; + private System.Windows.Forms.Button buttonShowClock; + private System.Windows.Forms.Button buttonHideClock; } } diff -r b22b0127afa4 -r f7ad2dce46a9 Server/MainForm.cs --- a/Server/MainForm.cs Sun Aug 31 18:33:05 2014 +0200 +++ b/Server/MainForm.cs Sun Aug 31 21:34:58 2014 +0200 @@ -384,6 +384,17 @@ buttonPowerOn.Enabled = false; buttonPowerOff.Enabled = false; } + + if (iDisplay.SupportClock()) + { + buttonShowClock.Enabled = true; + buttonHideClock.Enabled = true; + } + else + { + buttonShowClock.Enabled = false; + buttonHideClock.Enabled = false; + } } else { @@ -394,6 +405,8 @@ trackBarBrightness.Enabled = false; buttonPowerOn.Enabled = false; buttonPowerOff.Enabled = false; + buttonShowClock.Enabled = false; + buttonHideClock.Enabled = false; toolStripStatusLabelConnect.Text = "Disconnected"; toolStripStatusLabelPower.Text = "N/A"; } @@ -883,6 +896,16 @@ iDisplay.PowerOff(); } + private void buttonShowClock_Click(object sender, EventArgs e) + { + iDisplay.ShowClock(); + } + + private void buttonHideClock_Click(object sender, EventArgs e) + { + iDisplay.HideClock(); + } + } ///