Przeglądaj źródła

Add version number display and logging, configurable via AssembyFileVersion in AssemblyInfo.cs

Brett Credo 8 lat temu
rodzic
commit
02b6cea76a

+ 2 - 2
BulkPrinting/BulkPrinting/Program.cs

@@ -26,7 +26,7 @@ namespace BulkPrinting
26 26
                     restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Information)
27 27
                 .CreateLogger();
28 28
 
29
-            Log.Information("Starting");
29
+            Log.Information("Version {0} starting", Application.ProductVersion);
30 30
 
31 31
             AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
32 32
 
@@ -36,7 +36,7 @@ namespace BulkPrinting
36 36
             Application.SetCompatibleTextRenderingDefault(false);
37 37
             Application.Run(new UserLoginForm());
38 38
 
39
-            Log.Information("Exiting");
39
+            Log.Information("Version {0} exiting", Application.ProductVersion);
40 40
         }
41 41
 
42 42
         private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)

+ 4 - 4
BulkPrinting/BulkPrinting/Properties/AssemblyInfo.cs

@@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
8 8
 [assembly: AssemblyTitle("BulkPrinting")]
9 9
 [assembly: AssemblyDescription("")]
10 10
 [assembly: AssemblyConfiguration("")]
11
-[assembly: AssemblyCompany("")]
11
+[assembly: AssemblyCompany("R-Group")]
12 12
 [assembly: AssemblyProduct("BulkPrinting")]
13
-[assembly: AssemblyCopyright("Copyright ©  2017")]
13
+[assembly: AssemblyCopyright("Copyright © 2018")]
14 14
 [assembly: AssemblyTrademark("")]
15 15
 [assembly: AssemblyCulture("")]
16 16
 
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
32 32
 // You can specify all the values or you can default the Build and Revision Numbers
33 33
 // by using the '*' as shown below:
34 34
 // [assembly: AssemblyVersion("1.0.*")]
35
-[assembly: AssemblyVersion("1.0.0.0")]
36
-[assembly: AssemblyFileVersion("1.0.0.0")]
35
+[assembly: AssemblyVersion("1.0.*")]
36
+[assembly: AssemblyFileVersion("1.1")]

+ 71 - 32
BulkPrinting/BulkPrinting/UserLoginForm.Designer.cs

@@ -43,29 +43,34 @@
43 43
             this.chkOffline = new System.Windows.Forms.CheckBox();
44 44
             this.chkRemember = new System.Windows.Forms.CheckBox();
45 45
             this.pictureBox1 = new System.Windows.Forms.PictureBox();
46
+            this.label6 = new System.Windows.Forms.Label();
47
+            this.lblVersion = new System.Windows.Forms.Label();
46 48
             ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
47 49
             this.SuspendLayout();
48 50
             // 
49 51
             // txtUsername
50 52
             // 
51
-            this.txtUsername.Location = new System.Drawing.Point(80, 86);
53
+            this.txtUsername.Location = new System.Drawing.Point(107, 106);
54
+            this.txtUsername.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
52 55
             this.txtUsername.Name = "txtUsername";
53
-            this.txtUsername.Size = new System.Drawing.Size(192, 20);
56
+            this.txtUsername.Size = new System.Drawing.Size(255, 22);
54 57
             this.txtUsername.TabIndex = 0;
55 58
             // 
56 59
             // txtUserID
57 60
             // 
58
-            this.txtUserID.Location = new System.Drawing.Point(80, 112);
61
+            this.txtUserID.Location = new System.Drawing.Point(107, 138);
62
+            this.txtUserID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
59 63
             this.txtUserID.Name = "txtUserID";
60
-            this.txtUserID.Size = new System.Drawing.Size(192, 20);
64
+            this.txtUserID.Size = new System.Drawing.Size(255, 22);
61 65
             this.txtUserID.TabIndex = 1;
62 66
             // 
63 67
             // txtPassword
64 68
             // 
65
-            this.txtPassword.Location = new System.Drawing.Point(80, 138);
69
+            this.txtPassword.Location = new System.Drawing.Point(107, 170);
70
+            this.txtPassword.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
66 71
             this.txtPassword.Name = "txtPassword";
67 72
             this.txtPassword.PasswordChar = '*';
68
-            this.txtPassword.Size = new System.Drawing.Size(192, 20);
73
+            this.txtPassword.Size = new System.Drawing.Size(255, 22);
69 74
             this.txtPassword.TabIndex = 2;
70 75
             // 
71 76
             // btnLogin
@@ -74,9 +79,10 @@
74 79
             this.btnLogin.FlatAppearance.BorderColor = System.Drawing.Color.Black;
75 80
             this.btnLogin.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
76 81
             this.btnLogin.ForeColor = System.Drawing.Color.White;
77
-            this.btnLogin.Location = new System.Drawing.Point(12, 220);
82
+            this.btnLogin.Location = new System.Drawing.Point(21, 298);
83
+            this.btnLogin.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
78 84
             this.btnLogin.Name = "btnLogin";
79
-            this.btnLogin.Size = new System.Drawing.Size(75, 23);
85
+            this.btnLogin.Size = new System.Drawing.Size(100, 28);
80 86
             this.btnLogin.TabIndex = 6;
81 87
             this.btnLogin.Text = "Login";
82 88
             this.btnLogin.UseVisualStyleBackColor = false;
@@ -86,9 +92,10 @@
86 92
             // 
87 93
             this.label1.AutoSize = true;
88 94
             this.label1.ForeColor = System.Drawing.Color.White;
89
-            this.label1.Location = new System.Drawing.Point(13, 86);
95
+            this.label1.Location = new System.Drawing.Point(17, 106);
96
+            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
90 97
             this.label1.Name = "label1";
91
-            this.label1.Size = new System.Drawing.Size(55, 13);
98
+            this.label1.Size = new System.Drawing.Size(73, 17);
92 99
             this.label1.TabIndex = 5;
93 100
             this.label1.Text = "Username";
94 101
             this.label1.Click += new System.EventHandler(this.label1_Click);
@@ -97,9 +104,10 @@
97 104
             // 
98 105
             this.label2.AutoSize = true;
99 106
             this.label2.ForeColor = System.Drawing.Color.White;
100
-            this.label2.Location = new System.Drawing.Point(12, 112);
107
+            this.label2.Location = new System.Drawing.Point(16, 138);
108
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
101 109
             this.label2.Name = "label2";
102
-            this.label2.Size = new System.Drawing.Size(43, 13);
110
+            this.label2.Size = new System.Drawing.Size(55, 17);
103 111
             this.label2.TabIndex = 6;
104 112
             this.label2.Text = "User ID";
105 113
             this.label2.Click += new System.EventHandler(this.label2_Click);
@@ -108,18 +116,20 @@
108 116
             // 
109 117
             this.label3.AutoSize = true;
110 118
             this.label3.ForeColor = System.Drawing.Color.White;
111
-            this.label3.Location = new System.Drawing.Point(12, 138);
119
+            this.label3.Location = new System.Drawing.Point(16, 170);
120
+            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
112 121
             this.label3.Name = "label3";
113
-            this.label3.Size = new System.Drawing.Size(53, 13);
122
+            this.label3.Size = new System.Drawing.Size(69, 17);
114 123
             this.label3.TabIndex = 7;
115 124
             this.label3.Text = "Password";
116 125
             this.label3.Click += new System.EventHandler(this.label3_Click);
117 126
             // 
118 127
             // txtVendorID
119 128
             // 
120
-            this.txtVendorID.Location = new System.Drawing.Point(80, 165);
129
+            this.txtVendorID.Location = new System.Drawing.Point(107, 203);
130
+            this.txtVendorID.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
121 131
             this.txtVendorID.Name = "txtVendorID";
122
-            this.txtVendorID.Size = new System.Drawing.Size(192, 20);
132
+            this.txtVendorID.Size = new System.Drawing.Size(255, 22);
123 133
             this.txtVendorID.TabIndex = 3;
124 134
             this.txtVendorID.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtVendorID_KeyPress);
125 135
             // 
@@ -127,9 +137,10 @@
127 137
             // 
128 138
             this.label4.AutoSize = true;
129 139
             this.label4.ForeColor = System.Drawing.Color.White;
130
-            this.label4.Location = new System.Drawing.Point(12, 165);
140
+            this.label4.Location = new System.Drawing.Point(16, 203);
141
+            this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
131 142
             this.label4.Name = "label4";
132
-            this.label4.Size = new System.Drawing.Size(55, 13);
143
+            this.label4.Size = new System.Drawing.Size(71, 17);
133 144
             this.label4.TabIndex = 9;
134 145
             this.label4.Text = "Vendor ID";
135 146
             this.label4.Click += new System.EventHandler(this.label4_Click);
@@ -138,9 +149,10 @@
138 149
             // 
139 150
             this.label5.AutoSize = true;
140 151
             this.label5.ForeColor = System.Drawing.Color.White;
141
-            this.label5.Location = new System.Drawing.Point(12, 195);
152
+            this.label5.Location = new System.Drawing.Point(18, 240);
153
+            this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
142 154
             this.label5.Name = "label5";
143
-            this.label5.Size = new System.Drawing.Size(62, 13);
155
+            this.label5.Size = new System.Drawing.Size(82, 17);
144 156
             this.label5.TabIndex = 10;
145 157
             this.label5.Text = "Vendor Key";
146 158
             this.label5.Click += new System.EventHandler(this.label5_Click);
@@ -148,18 +160,20 @@
148 160
             // lblHDDSerial
149 161
             // 
150 162
             this.lblHDDSerial.AutoSize = true;
151
-            this.lblHDDSerial.Location = new System.Drawing.Point(81, 195);
163
+            this.lblHDDSerial.Location = new System.Drawing.Point(108, 240);
164
+            this.lblHDDSerial.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
152 165
             this.lblHDDSerial.Name = "lblHDDSerial";
153
-            this.lblHDDSerial.Size = new System.Drawing.Size(0, 13);
166
+            this.lblHDDSerial.Size = new System.Drawing.Size(0, 17);
154 167
             this.lblHDDSerial.TabIndex = 11;
155 168
             // 
156 169
             // chkOffline
157 170
             // 
158 171
             this.chkOffline.AutoSize = true;
159 172
             this.chkOffline.ForeColor = System.Drawing.Color.White;
160
-            this.chkOffline.Location = new System.Drawing.Point(99, 224);
173
+            this.chkOffline.Location = new System.Drawing.Point(137, 303);
174
+            this.chkOffline.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
161 175
             this.chkOffline.Name = "chkOffline";
162
-            this.chkOffline.Size = new System.Drawing.Size(56, 17);
176
+            this.chkOffline.Size = new System.Drawing.Size(71, 21);
163 177
             this.chkOffline.TabIndex = 5;
164 178
             this.chkOffline.Text = "Offline";
165 179
             this.chkOffline.UseVisualStyleBackColor = true;
@@ -169,9 +183,10 @@
169 183
             // 
170 184
             this.chkRemember.AutoSize = true;
171 185
             this.chkRemember.ForeColor = System.Drawing.Color.White;
172
-            this.chkRemember.Location = new System.Drawing.Point(162, 223);
186
+            this.chkRemember.Location = new System.Drawing.Point(216, 303);
187
+            this.chkRemember.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
173 188
             this.chkRemember.Name = "chkRemember";
174
-            this.chkRemember.Size = new System.Drawing.Size(95, 17);
189
+            this.chkRemember.Size = new System.Drawing.Size(122, 21);
175 190
             this.chkRemember.TabIndex = 4;
176 191
             this.chkRemember.Text = "Remember Me";
177 192
             this.chkRemember.UseVisualStyleBackColor = true;
@@ -180,20 +195,43 @@
180 195
             // pictureBox1
181 196
             // 
182 197
             this.pictureBox1.Image = global::BulkPrinting.Properties.Resources.rgroup_bulk_print_app_260x70;
183
-            this.pictureBox1.Location = new System.Drawing.Point(12, 6);
198
+            this.pictureBox1.Location = new System.Drawing.Point(16, 7);
199
+            this.pictureBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
184 200
             this.pictureBox1.Name = "pictureBox1";
185
-            this.pictureBox1.Size = new System.Drawing.Size(260, 71);
201
+            this.pictureBox1.Size = new System.Drawing.Size(347, 87);
186 202
             this.pictureBox1.TabIndex = 12;
187 203
             this.pictureBox1.TabStop = false;
188 204
             this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
189 205
             // 
206
+            // label6
207
+            // 
208
+            this.label6.AutoSize = true;
209
+            this.label6.ForeColor = System.Drawing.Color.White;
210
+            this.label6.Location = new System.Drawing.Point(18, 267);
211
+            this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
212
+            this.label6.Name = "label6";
213
+            this.label6.Size = new System.Drawing.Size(56, 17);
214
+            this.label6.TabIndex = 13;
215
+            this.label6.Text = "Version";
216
+            // 
217
+            // lblVersion
218
+            // 
219
+            this.lblVersion.AutoSize = true;
220
+            this.lblVersion.Location = new System.Drawing.Point(108, 267);
221
+            this.lblVersion.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
222
+            this.lblVersion.Name = "lblVersion";
223
+            this.lblVersion.Size = new System.Drawing.Size(0, 17);
224
+            this.lblVersion.TabIndex = 14;
225
+            // 
190 226
             // UserLoginForm
191 227
             // 
192 228
             this.AcceptButton = this.btnLogin;
193
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
229
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
194 230
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
195 231
             this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(7)))), ((int)(((byte)(63)))), ((int)(((byte)(145)))));
196
-            this.ClientSize = new System.Drawing.Size(284, 253);
232
+            this.ClientSize = new System.Drawing.Size(376, 333);
233
+            this.Controls.Add(this.lblVersion);
234
+            this.Controls.Add(this.label6);
197 235
             this.Controls.Add(this.pictureBox1);
198 236
             this.Controls.Add(this.chkRemember);
199 237
             this.Controls.Add(this.chkOffline);
@@ -211,10 +249,9 @@
211 249
             this.ForeColor = System.Drawing.Color.White;
212 250
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
213 251
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
252
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
214 253
             this.MaximizeBox = false;
215
-            this.MaximumSize = new System.Drawing.Size(300, 292);
216 254
             this.MinimizeBox = false;
217
-            this.MinimumSize = new System.Drawing.Size(300, 292);
218 255
             this.Name = "UserLoginForm";
219 256
             this.Text = "R-Group Bulk Printing";
220 257
             this.Load += new System.EventHandler(this.UserLoginForm_Load);
@@ -242,5 +279,7 @@
242 279
         private System.Windows.Forms.CheckBox chkOffline;
243 280
         private System.Windows.Forms.CheckBox chkRemember;
244 281
         private System.Windows.Forms.PictureBox pictureBox1;
282
+        private System.Windows.Forms.Label label6;
283
+        private System.Windows.Forms.Label lblVersion;
245 284
     }
246 285
 }

+ 8 - 7
BulkPrinting/BulkPrinting/UserLoginForm.cs

@@ -159,18 +159,19 @@ namespace BulkPrinting
159 159
 
160 160
         private void UserLoginForm_Load(object sender, EventArgs e)
161 161
         {
162
-            this.lblHDDSerial.Text = Globals.HDDSerialNumber;
163
-            this.txtUsername.Text = Utility.LoadSetting("Username");
164
-            this.txtUserID.Text = Utility.LoadSetting("UserID");
165
-            if (this.txtUsername.Text != "") {
162
+            lblVersion.Text = Application.ProductVersion; // Configurable via AssemblyFileVersion in AssemblyInfo.cs
163
+            lblHDDSerial.Text = Globals.HDDSerialNumber;
164
+            txtUsername.Text = Utility.LoadSetting("Username");
165
+            txtUserID.Text = Utility.LoadSetting("UserID");
166
+            if (txtUsername.Text != "") {
166 167
                 chkRemember.Checked = true;
167 168
             }
168
-            this.txtVendorID.Text = Utility.LoadSetting("VendorID");
169
-            if (this.txtVendorID.Text != "")
169
+            txtVendorID.Text = Utility.LoadSetting("VendorID");
170
+            if (txtVendorID.Text != "")
170 171
             {
171 172
                 txtVendorID.Enabled = false;
172 173
             }
173
-            this.CenterToScreen();
174
+            CenterToScreen();
174 175
         }
175 176
 
176 177
         private void txtVendorID_KeyPress(object sender, KeyPressEventArgs e)

+ 0 - 3
BulkPrinting/BulkPrinting/UserLoginForm.resx

@@ -117,9 +117,6 @@
117 117
   <resheader name="writer">
118 118
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 119
   </resheader>
120
-  <metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
121
-    <value>True</value>
122
-  </metadata>
123 120
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
124 121
   <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
125 122
     <value>