Timer interval can now be set and is persisted.
authorsl
Sat, 30 Aug 2014 19:24:47 +0200
changeset 47c9e3d1389d06
parent 46 0c0ee86760ea
child 48 9039acfde091
Timer interval can now be set and is persisted.
Server/App.config
Server/MainForm.Designer.cs
Server/MainForm.cs
Server/Properties/Settings.Designer.cs
Server/Properties/Settings.settings
     1.1 --- a/Server/App.config	Sat Aug 30 18:45:06 2014 +0200
     1.2 +++ b/Server/App.config	Sat Aug 30 19:24:47 2014 +0200
     1.3 @@ -28,6 +28,9 @@
     1.4              <setting name="DisplayType" serializeAs="String">
     1.5                  <value>1</value>
     1.6              </setting>
     1.7 +            <setting name="TimerInterval" serializeAs="String">
     1.8 +                <value>100</value>
     1.9 +            </setting>
    1.10          </SharpDisplayManager.Properties.Settings>
    1.11      </userSettings>
    1.12  </configuration>
     2.1 --- a/Server/MainForm.Designer.cs	Sat Aug 30 18:45:06 2014 +0200
     2.2 +++ b/Server/MainForm.Designer.cs	Sat Aug 30 19:24:47 2014 +0200
     2.3 @@ -31,8 +31,6 @@
     2.4              this.components = new System.ComponentModel.Container();
     2.5              this.panelDisplay = new System.Windows.Forms.Panel();
     2.6              this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
     2.7 -            this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel();
     2.8 -            this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel();
     2.9              this.fontDialog = new System.Windows.Forms.FontDialog();
    2.10              this.timer = new System.Windows.Forms.Timer(this.components);
    2.11              this.statusStrip = new System.Windows.Forms.StatusStrip();
    2.12 @@ -45,6 +43,7 @@
    2.13              this.buttonStartClient = new System.Windows.Forms.Button();
    2.14              this.treeViewClients = new System.Windows.Forms.TreeView();
    2.15              this.tabPageDisplay = new System.Windows.Forms.TabPage();
    2.16 +            this.maskedTextBoxTimerInterval = new System.Windows.Forms.MaskedTextBox();
    2.17              this.comboBoxDisplayType = new System.Windows.Forms.ComboBox();
    2.18              this.buttonSuspend = new System.Windows.Forms.Button();
    2.19              this.checkBoxConnectOnStartup = new System.Windows.Forms.CheckBox();
    2.20 @@ -68,6 +67,9 @@
    2.21              this.checkBoxReverseScreen = new System.Windows.Forms.CheckBox();
    2.22              this.buttonRemoveRow = new System.Windows.Forms.Button();
    2.23              this.buttonAddRow = new System.Windows.Forms.Button();
    2.24 +            this.label1 = new System.Windows.Forms.Label();
    2.25 +            this.marqueeLabelTop = new SharpDisplayManager.MarqueeLabel();
    2.26 +            this.marqueeLabelBottom = new SharpDisplayManager.MarqueeLabel();
    2.27              this.panelDisplay.SuspendLayout();
    2.28              this.tableLayoutPanel.SuspendLayout();
    2.29              this.statusStrip.SuspendLayout();
    2.30 @@ -164,39 +166,6 @@
    2.31              this.tableLayoutPanel.Size = new System.Drawing.Size(256, 64);
    2.32              this.tableLayoutPanel.TabIndex = 5;
    2.33              // 
    2.34 -            // marqueeLabelTop
    2.35 -            // 
    2.36 -            this.marqueeLabelTop.AutoEllipsis = true;
    2.37 -            this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent;
    2.38 -            this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill;
    2.39 -            this.marqueeLabelTop.Location = new System.Drawing.Point(1, 1);
    2.40 -            this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0);
    2.41 -            this.marqueeLabelTop.Name = "marqueeLabelTop";
    2.42 -            this.marqueeLabelTop.OwnTimer = false;
    2.43 -            this.marqueeLabelTop.PixelsPerSecond = 64;
    2.44 -            this.marqueeLabelTop.Separator = "|";
    2.45 -            this.marqueeLabelTop.Size = new System.Drawing.Size(254, 30);
    2.46 -            this.marqueeLabelTop.TabIndex = 2;
    2.47 -            this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789";
    2.48 -            this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    2.49 -            this.marqueeLabelTop.UseCompatibleTextRendering = true;
    2.50 -            // 
    2.51 -            // marqueeLabelBottom
    2.52 -            // 
    2.53 -            this.marqueeLabelBottom.AutoEllipsis = true;
    2.54 -            this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill;
    2.55 -            this.marqueeLabelBottom.Location = new System.Drawing.Point(1, 32);
    2.56 -            this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0);
    2.57 -            this.marqueeLabelBottom.Name = "marqueeLabelBottom";
    2.58 -            this.marqueeLabelBottom.OwnTimer = false;
    2.59 -            this.marqueeLabelBottom.PixelsPerSecond = 64;
    2.60 -            this.marqueeLabelBottom.Separator = "|";
    2.61 -            this.marqueeLabelBottom.Size = new System.Drawing.Size(254, 31);
    2.62 -            this.marqueeLabelBottom.TabIndex = 3;
    2.63 -            this.marqueeLabelBottom.Text = "abcdefghijklmnopqrst-0123456789";
    2.64 -            this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    2.65 -            this.marqueeLabelBottom.UseCompatibleTextRendering = true;
    2.66 -            // 
    2.67              // timer
    2.68              // 
    2.69              this.timer.Enabled = true;
    2.70 @@ -287,6 +256,8 @@
    2.71              // 
    2.72              // tabPageDisplay
    2.73              // 
    2.74 +            this.tabPageDisplay.Controls.Add(this.label1);
    2.75 +            this.tabPageDisplay.Controls.Add(this.maskedTextBoxTimerInterval);
    2.76              this.tabPageDisplay.Controls.Add(this.comboBoxDisplayType);
    2.77              this.tabPageDisplay.Controls.Add(this.buttonSuspend);
    2.78              this.tabPageDisplay.Controls.Add(this.checkBoxConnectOnStartup);
    2.79 @@ -304,6 +275,16 @@
    2.80              this.tabPageDisplay.Text = "Display";
    2.81              this.tabPageDisplay.UseVisualStyleBackColor = true;
    2.82              // 
    2.83 +            // maskedTextBoxTimerInterval
    2.84 +            // 
    2.85 +            this.maskedTextBoxTimerInterval.Location = new System.Drawing.Point(288, 42);
    2.86 +            this.maskedTextBoxTimerInterval.Mask = "000";
    2.87 +            this.maskedTextBoxTimerInterval.Name = "maskedTextBoxTimerInterval";
    2.88 +            this.maskedTextBoxTimerInterval.PromptChar = ' ';
    2.89 +            this.maskedTextBoxTimerInterval.Size = new System.Drawing.Size(24, 20);
    2.90 +            this.maskedTextBoxTimerInterval.TabIndex = 18;
    2.91 +            this.maskedTextBoxTimerInterval.TextChanged += new System.EventHandler(this.maskedTextBoxTimerInterval_TextChanged);
    2.92 +            // 
    2.93              // comboBoxDisplayType
    2.94              // 
    2.95              this.comboBoxDisplayType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    2.96 @@ -569,6 +550,48 @@
    2.97              this.buttonAddRow.UseVisualStyleBackColor = true;
    2.98              this.buttonAddRow.Click += new System.EventHandler(this.buttonAddRow_Click);
    2.99              // 
   2.100 +            // label1
   2.101 +            // 
   2.102 +            this.label1.AutoSize = true;
   2.103 +            this.label1.Location = new System.Drawing.Point(184, 45);
   2.104 +            this.label1.Name = "label1";
   2.105 +            this.label1.Size = new System.Drawing.Size(98, 13);
   2.106 +            this.label1.TabIndex = 19;
   2.107 +            this.label1.Text = "Timer interval (ms) :";
   2.108 +            // 
   2.109 +            // marqueeLabelTop
   2.110 +            // 
   2.111 +            this.marqueeLabelTop.AutoEllipsis = true;
   2.112 +            this.marqueeLabelTop.BackColor = System.Drawing.Color.Transparent;
   2.113 +            this.marqueeLabelTop.Dock = System.Windows.Forms.DockStyle.Fill;
   2.114 +            this.marqueeLabelTop.Location = new System.Drawing.Point(1, -9);
   2.115 +            this.marqueeLabelTop.Margin = new System.Windows.Forms.Padding(0);
   2.116 +            this.marqueeLabelTop.Name = "marqueeLabelTop";
   2.117 +            this.marqueeLabelTop.OwnTimer = false;
   2.118 +            this.marqueeLabelTop.PixelsPerSecond = 64;
   2.119 +            this.marqueeLabelTop.Separator = "|";
   2.120 +            this.marqueeLabelTop.Size = new System.Drawing.Size(254, 1);
   2.121 +            this.marqueeLabelTop.TabIndex = 2;
   2.122 +            this.marqueeLabelTop.Text = "ABCDEFGHIJKLMNOPQRST-0123456789";
   2.123 +            this.marqueeLabelTop.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   2.124 +            this.marqueeLabelTop.UseCompatibleTextRendering = true;
   2.125 +            // 
   2.126 +            // marqueeLabelBottom
   2.127 +            // 
   2.128 +            this.marqueeLabelBottom.AutoEllipsis = true;
   2.129 +            this.marqueeLabelBottom.Dock = System.Windows.Forms.DockStyle.Fill;
   2.130 +            this.marqueeLabelBottom.Location = new System.Drawing.Point(1, 2);
   2.131 +            this.marqueeLabelBottom.Margin = new System.Windows.Forms.Padding(0);
   2.132 +            this.marqueeLabelBottom.Name = "marqueeLabelBottom";
   2.133 +            this.marqueeLabelBottom.OwnTimer = false;
   2.134 +            this.marqueeLabelBottom.PixelsPerSecond = 64;
   2.135 +            this.marqueeLabelBottom.Separator = "|";
   2.136 +            this.marqueeLabelBottom.Size = new System.Drawing.Size(254, 20);
   2.137 +            this.marqueeLabelBottom.TabIndex = 3;
   2.138 +            this.marqueeLabelBottom.Text = "abcdefghijklmnopqrst-0123456789";
   2.139 +            this.marqueeLabelBottom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
   2.140 +            this.marqueeLabelBottom.UseCompatibleTextRendering = true;
   2.141 +            // 
   2.142              // MainForm
   2.143              // 
   2.144              this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
   2.145 @@ -641,6 +664,8 @@
   2.146          private System.Windows.Forms.Button buttonAlignCenter;
   2.147          private System.Windows.Forms.Button buttonAlignLeft;
   2.148          private System.Windows.Forms.ComboBox comboBoxDisplayType;
   2.149 +        private System.Windows.Forms.MaskedTextBox maskedTextBoxTimerInterval;
   2.150 +        private System.Windows.Forms.Label label1;
   2.151      }
   2.152  }
   2.153  
     3.1 --- a/Server/MainForm.cs	Sat Aug 30 18:45:06 2014 +0200
     3.2 +++ b/Server/MainForm.cs	Sat Aug 30 19:24:47 2014 +0200
     3.3 @@ -49,6 +49,8 @@
     3.4              checkBoxConnectOnStartup.Checked = Properties.Settings.Default.DisplayConnectOnStartup;
     3.5              checkBoxReverseScreen.Checked = Properties.Settings.Default.DisplayReverseScreen;
     3.6              comboBoxDisplayType.SelectedIndex = Properties.Settings.Default.DisplayType;
     3.7 +            timer.Interval = Properties.Settings.Default.TimerInterval;
     3.8 +            maskedTextBoxTimerInterval.Text = Properties.Settings.Default.TimerInterval.ToString();
     3.9              //
    3.10              tableLayoutPanel.CellBorderStyle = (checkBoxShowBorders.Checked ? TableLayoutPanelCellBorderStyle.Single : TableLayoutPanelCellBorderStyle.None);
    3.11              //We have a bug when drawing minimized and reusing our bitmap
    3.12 @@ -264,7 +266,7 @@
    3.13              }
    3.14  
    3.15              //Compute instant FPS
    3.16 -            toolStripStatusLabelFps.Text = (1.0/NewTickTime.Subtract(LastTickTime).TotalSeconds).ToString("F0") + " FPS";
    3.17 +            toolStripStatusLabelFps.Text = (1.0/NewTickTime.Subtract(LastTickTime).TotalSeconds).ToString("F0") + " / " + (1000/timer.Interval).ToString() + " FPS";
    3.18  
    3.19              LastTickTime = NewTickTime;
    3.20  
    3.21 @@ -801,6 +803,17 @@
    3.22              OpenDisplayConnection();
    3.23          }
    3.24  
    3.25 +
    3.26 +        private void maskedTextBoxTimerInterval_TextChanged(object sender, EventArgs e)
    3.27 +        {
    3.28 +            if (maskedTextBoxTimerInterval.Text != "")
    3.29 +            {
    3.30 +                timer.Interval = Convert.ToInt32(maskedTextBoxTimerInterval.Text);
    3.31 +                Properties.Settings.Default.TimerInterval = timer.Interval;
    3.32 +                Properties.Settings.Default.Save();
    3.33 +            }
    3.34 +        }
    3.35 +
    3.36      }
    3.37  
    3.38      /// <summary>
     4.1 --- a/Server/Properties/Settings.Designer.cs	Sat Aug 30 18:45:06 2014 +0200
     4.2 +++ b/Server/Properties/Settings.Designer.cs	Sat Aug 30 19:24:47 2014 +0200
     4.3 @@ -94,5 +94,17 @@
     4.4                  this["DisplayType"] = value;
     4.5              }
     4.6          }
     4.7 +        
     4.8 +        [global::System.Configuration.UserScopedSettingAttribute()]
     4.9 +        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    4.10 +        [global::System.Configuration.DefaultSettingValueAttribute("100")]
    4.11 +        public int TimerInterval {
    4.12 +            get {
    4.13 +                return ((int)(this["TimerInterval"]));
    4.14 +            }
    4.15 +            set {
    4.16 +                this["TimerInterval"] = value;
    4.17 +            }
    4.18 +        }
    4.19      }
    4.20  }
     5.1 --- a/Server/Properties/Settings.settings	Sat Aug 30 18:45:06 2014 +0200
     5.2 +++ b/Server/Properties/Settings.settings	Sat Aug 30 19:24:47 2014 +0200
     5.3 @@ -20,5 +20,8 @@
     5.4      <Setting Name="DisplayType" Type="System.Int32" Scope="User">
     5.5        <Value Profile="(Default)">1</Value>
     5.6      </Setting>
     5.7 +    <Setting Name="TimerInterval" Type="System.Int32" Scope="User">
     5.8 +      <Value Profile="(Default)">100</Value>
     5.9 +    </Setting>
    5.10    </Settings>
    5.11  </SettingsFile>
    5.12 \ No newline at end of file