GP1212A02: Clock support.
authorsl
Sun, 31 Aug 2014 21:34:58 +0200
changeset 53f7ad2dce46a9
parent 52 b22b0127afa4
child 54 fdda7642776a
GP1212A02: Clock support.
Server/Display.cs
Server/MainForm.Designer.cs
Server/MainForm.cs
     1.1 --- a/Server/Display.cs	Sun Aug 31 18:33:05 2014 +0200
     1.2 +++ b/Server/Display.cs	Sun Aug 31 21:34:58 2014 +0200
     1.3 @@ -120,6 +120,21 @@
     1.4              return MiniDisplaySupportPowerOnOff(iDevice);
     1.5          }
     1.6  
     1.7 +        public void ShowClock()
     1.8 +        {
     1.9 +            MiniDisplayShowClock(iDevice);
    1.10 +        }
    1.11 +
    1.12 +        public void HideClock()
    1.13 +        {
    1.14 +            MiniDisplayHideClock(iDevice);
    1.15 +        }
    1.16 +
    1.17 +        public bool SupportClock()
    1.18 +        {
    1.19 +            return MiniDisplaySupportClock(iDevice);
    1.20 +        }
    1.21 +
    1.22          public bool PowerSupplyStatus()
    1.23          {
    1.24              bool res = MiniDisplayPowerSupplyStatus(iDevice);
    1.25 @@ -274,5 +289,16 @@
    1.26          [return: MarshalAs(UnmanagedType.I1)]
    1.27          public static extern bool MiniDisplaySupportPowerOnOff(IntPtr aDevice);
    1.28  
    1.29 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.30 +        public static extern void MiniDisplayShowClock(IntPtr aDevice);
    1.31 +
    1.32 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.33 +        public static extern void MiniDisplayHideClock(IntPtr aDevice);
    1.34 +
    1.35 +        [DllImport("MiniDisplay.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
    1.36 +        [return: MarshalAs(UnmanagedType.I1)]
    1.37 +        public static extern bool MiniDisplaySupportClock(IntPtr aDevice);
    1.38 +
    1.39 +
    1.40      }
    1.41  }
     2.1 --- a/Server/MainForm.Designer.cs	Sun Aug 31 18:33:05 2014 +0200
     2.2 +++ b/Server/MainForm.Designer.cs	Sun Aug 31 21:34:58 2014 +0200
     2.3 @@ -72,6 +72,8 @@
     2.4              this.buttonAddRow = new System.Windows.Forms.Button();
     2.5              this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel();
     2.6              this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel();
     2.7 +            this.buttonHideClock = new System.Windows.Forms.Button();
     2.8 +            this.buttonShowClock = new System.Windows.Forms.Button();
     2.9              this.panelDisplay.SuspendLayout();
    2.10              this.tableLayoutPanel.SuspendLayout();
    2.11              this.statusStrip.SuspendLayout();
    2.12 @@ -292,6 +294,8 @@
    2.13              // 
    2.14              // tabPageDisplay
    2.15              // 
    2.16 +            this.tabPageDisplay.Controls.Add(this.buttonShowClock);
    2.17 +            this.tabPageDisplay.Controls.Add(this.buttonHideClock);
    2.18              this.tabPageDisplay.Controls.Add(this.buttonPowerOff);
    2.19              this.tabPageDisplay.Controls.Add(this.buttonPowerOn);
    2.20              this.tabPageDisplay.Controls.Add(this.label1);
    2.21 @@ -622,13 +626,13 @@
    2.22              this.marqueeLabelTop.AutoEllipsis = true;
    2.23              this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent;
    2.24              this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill;
    2.25 -            this.marqueeLabelTop.Location = new System.Drawing.Point(1, 1);
    2.26 +            this.marqueeLabelTop.Location = new System.Drawing.Point(1, -187);
    2.27              this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0);
    2.28              this.marqueeLabelTop.Name = "marqueeLabelTop";
    2.29              this.marqueeLabelTop.OwnTimer = false;
    2.30              this.marqueeLabelTop.PixelsPerSecond = 64;
    2.31              this.marqueeLabelTop.Separator = "|";
    2.32 -            this.marqueeLabelTop.Size = new System.Drawing.Size(254, 1);
    2.33 +            this.marqueeLabelTop.Size = new System.Drawing.Size(254, 20);
    2.34              this.marqueeLabelTop.TabIndex = 2;
    2.35              this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789";
    2.36              this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    2.37 @@ -638,7 +642,7 @@
    2.38              // 
    2.39              this.marqueeLabelBottom.AutoEllipsis = true;
    2.40              this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill;
    2.41 -            this.marqueeLabelBottom.Location = new System.Drawing.Point(1, -19);
    2.42 +            this.marqueeLabelBottom.Location = new System.Drawing.Point(1, -61);
    2.43              this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0);
    2.44              this.marqueeLabelBottom.Name = "marqueeLabelBottom";
    2.45              this.marqueeLabelBottom.OwnTimer = false;
    2.46 @@ -650,6 +654,26 @@
    2.47              this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    2.48              this.marqueeLabelBottom.UseCompatibleTextRendering = true;
    2.49              // 
    2.50 +            // buttonHideClock
    2.51 +            // 
    2.52 +            this.buttonHideClock.Location = new System.Drawing.Point(293, 153);
    2.53 +            this.buttonHideClock.Name = "buttonHideClock";
    2.54 +            this.buttonHideClock.Size = new System.Drawing.Size(75, 23);
    2.55 +            this.buttonHideClock.TabIndex = 22;
    2.56 +            this.buttonHideClock.Text = "Hide Clock";
    2.57 +            this.buttonHideClock.UseVisualStyleBackColor = true;
    2.58 +            this.buttonHideClock.Click += new System.EventHandler(this.buttonHideClock_Click);
    2.59 +            // 
    2.60 +            // buttonShowClock
    2.61 +            // 
    2.62 +            this.buttonShowClock.Location = new System.Drawing.Point(293, 124);
    2.63 +            this.buttonShowClock.Name = "buttonShowClock";
    2.64 +            this.buttonShowClock.Size = new System.Drawing.Size(75, 23);
    2.65 +            this.buttonShowClock.TabIndex = 23;
    2.66 +            this.buttonShowClock.Text = "Show Clock";
    2.67 +            this.buttonShowClock.UseVisualStyleBackColor = true;
    2.68 +            this.buttonShowClock.Click += new System.EventHandler(this.buttonShowClock_Click);
    2.69 +            // 
    2.70              // MainForm
    2.71              // 
    2.72              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    2.73 @@ -726,6 +750,8 @@
    2.74          private System.Windows.Forms.Label label1;
    2.75          private System.Windows.Forms.Button buttonPowerOff;
    2.76          private System.Windows.Forms.Button buttonPowerOn;
    2.77 +        private System.Windows.Forms.Button buttonShowClock;
    2.78 +        private System.Windows.Forms.Button buttonHideClock;
    2.79      }
    2.80  }
    2.81  
     3.1 --- a/Server/MainForm.cs	Sun Aug 31 18:33:05 2014 +0200
     3.2 +++ b/Server/MainForm.cs	Sun Aug 31 21:34:58 2014 +0200
     3.3 @@ -384,6 +384,17 @@
     3.4                      buttonPowerOn.Enabled = false;
     3.5                      buttonPowerOff.Enabled = false;
     3.6                  }
     3.7 +
     3.8 +                if (iDisplay.SupportClock())
     3.9 +                {
    3.10 +                    buttonShowClock.Enabled = true;
    3.11 +                    buttonHideClock.Enabled = true;
    3.12 +                }
    3.13 +                else
    3.14 +                {
    3.15 +                    buttonShowClock.Enabled = false;
    3.16 +                    buttonHideClock.Enabled = false;
    3.17 +                }
    3.18              }
    3.19              else
    3.20              {
    3.21 @@ -394,6 +405,8 @@
    3.22                  trackBarBrightness.Enabled = false;
    3.23                  buttonPowerOn.Enabled = false;
    3.24                  buttonPowerOff.Enabled = false;
    3.25 +                buttonShowClock.Enabled = false;
    3.26 +                buttonHideClock.Enabled = false;
    3.27                  toolStripStatusLabelConnect.Text = "Disconnected";
    3.28                  toolStripStatusLabelPower.Text = "N/A";
    3.29              }
    3.30 @@ -883,6 +896,16 @@
    3.31              iDisplay.PowerOff();
    3.32          }
    3.33  
    3.34 +        private void buttonShowClock_Click(object sender, EventArgs e)
    3.35 +        {
    3.36 +            iDisplay.ShowClock();
    3.37 +        }
    3.38 +
    3.39 +        private void buttonHideClock_Click(object sender, EventArgs e)
    3.40 +        {
    3.41 +            iDisplay.HideClock();
    3.42 +        }
    3.43 +
    3.44      }
    3.45  
    3.46      /// <summary>