From 2c06daf1e96075e79ad3c7992dcd83c9876577fa Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Sat, 15 Feb 2020 11:54:36 +0100 Subject: [PATCH] Inizio gestione demo mode --- LPA/LPA.csproj | 4 +- LPA/MainForm.Designer.cs | 96 ++++++++++++++++++++++++++++++++++++---- LPA/MainForm.cs | 36 ++++++++++++++- LPA/MainForm.resx | 3 ++ 4 files changed, 129 insertions(+), 10 deletions(-) diff --git a/LPA/LPA.csproj b/LPA/LPA.csproj index f50cfb2..8b9a6c1 100644 --- a/LPA/LPA.csproj +++ b/LPA/LPA.csproj @@ -236,7 +236,9 @@ - + + + diff --git a/LPA/MainForm.Designer.cs b/LPA/MainForm.Designer.cs index 8d45833..9f87c4c 100644 --- a/LPA/MainForm.Designer.cs +++ b/LPA/MainForm.Designer.cs @@ -50,12 +50,20 @@ this.lblQueueCount = new System.Windows.Forms.Label(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.longTimer = new System.Windows.Forms.Timer(this.components); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.backupConfToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.getServerConfToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.menuTestDemo = new System.Windows.Forms.ToolStripMenuItem(); + this.printDemoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.btnDemo = new System.Windows.Forms.Button(); this.statusStrip1.SuspendLayout(); this.tabControl1.SuspendLayout(); this.tabStatus.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dgvQueueStatus)).BeginInit(); this.tabSetup.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout(); + this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // // lbPrinters @@ -146,10 +154,10 @@ | System.Windows.Forms.AnchorStyles.Right))); this.tabControl1.Controls.Add(this.tabStatus); this.tabControl1.Controls.Add(this.tabSetup); - this.tabControl1.Location = new System.Drawing.Point(12, 59); + this.tabControl1.Location = new System.Drawing.Point(12, 85); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(761, 425); + this.tabControl1.Size = new System.Drawing.Size(761, 399); this.tabControl1.TabIndex = 10; // // tabStatus @@ -158,7 +166,7 @@ this.tabStatus.Location = new System.Drawing.Point(4, 22); this.tabStatus.Name = "tabStatus"; this.tabStatus.Padding = new System.Windows.Forms.Padding(3); - this.tabStatus.Size = new System.Drawing.Size(753, 399); + this.tabStatus.Size = new System.Drawing.Size(753, 373); this.tabStatus.TabIndex = 0; this.tabStatus.Text = "Status"; this.tabStatus.UseVisualStyleBackColor = true; @@ -172,7 +180,7 @@ this.dgvQueueStatus.Location = new System.Drawing.Point(3, 3); this.dgvQueueStatus.Name = "dgvQueueStatus"; this.dgvQueueStatus.RowHeadersWidth = 51; - this.dgvQueueStatus.Size = new System.Drawing.Size(747, 393); + this.dgvQueueStatus.Size = new System.Drawing.Size(747, 367); this.dgvQueueStatus.TabIndex = 0; // // tabSetup @@ -239,17 +247,19 @@ // this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.ColumnCount = 5; + this.tableLayoutPanel1.ColumnCount = 6; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 100F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 75F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 75F)); this.tableLayoutPanel1.Controls.Add(this.btnStart, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.label1, 4, 0); + this.tableLayoutPanel1.Controls.Add(this.lblQueueCount, 5, 0); this.tableLayoutPanel1.Controls.Add(this.btnStop, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.label1, 3, 0); - this.tableLayoutPanel1.Controls.Add(this.lblQueueCount, 4, 0); - this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 9); + this.tableLayoutPanel1.Controls.Add(this.btnDemo, 3, 0); + this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 35); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); @@ -260,6 +270,65 @@ // this.longTimer.Interval = 60000; // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.menuTestDemo}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(785, 24); + this.menuStrip1.TabIndex = 16; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.backupConfToolStripMenuItem, + this.getServerConfToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // backupConfToolStripMenuItem + // + this.backupConfToolStripMenuItem.Name = "backupConfToolStripMenuItem"; + this.backupConfToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.backupConfToolStripMenuItem.Text = "&Backup conf --> server"; + // + // getServerConfToolStripMenuItem + // + this.getServerConfToolStripMenuItem.Name = "getServerConfToolStripMenuItem"; + this.getServerConfToolStripMenuItem.Size = new System.Drawing.Size(195, 22); + this.getServerConfToolStripMenuItem.Text = "&Get server --> conf"; + // + // menuTestDemo + // + this.menuTestDemo.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.printDemoToolStripMenuItem}); + this.menuTestDemo.Name = "menuTestDemo"; + this.menuTestDemo.Size = new System.Drawing.Size(116, 20); + this.menuTestDemo.Text = "&Test - Demo mode"; + this.menuTestDemo.Visible = false; + // + // printDemoToolStripMenuItem + // + this.printDemoToolStripMenuItem.Name = "printDemoToolStripMenuItem"; + this.printDemoToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.printDemoToolStripMenuItem.Text = "&Print Demo"; + this.printDemoToolStripMenuItem.Click += new System.EventHandler(this.printDemoToolStripMenuItem_Click); + // + // btnDemo + // + this.btnDemo.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnDemo.Location = new System.Drawing.Point(514, 3); + this.btnDemo.Name = "btnDemo"; + this.btnDemo.Size = new System.Drawing.Size(94, 38); + this.btnDemo.TabIndex = 15; + this.btnDemo.Text = "Demo"; + this.btnDemo.UseVisualStyleBackColor = true; + this.btnDemo.Click += new System.EventHandler(this.btnDemo_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -268,6 +337,8 @@ this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.tabControl1); this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.menuStrip1); + this.MainMenuStrip = this.menuStrip1; this.Name = "MainForm"; this.Text = "Steamware LPA"; this.statusStrip1.ResumeLayout(false); @@ -278,6 +349,8 @@ this.tabSetup.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -305,6 +378,13 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Timer longTimer; private System.Windows.Forms.ToolStripStatusLabel lblUptime; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem backupConfToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem getServerConfToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem menuTestDemo; + private System.Windows.Forms.ToolStripMenuItem printDemoToolStripMenuItem; + private System.Windows.Forms.Button btnDemo; } } diff --git a/LPA/MainForm.cs b/LPA/MainForm.cs index 9ab6149..0608f57 100644 --- a/LPA/MainForm.cs +++ b/LPA/MainForm.cs @@ -59,7 +59,10 @@ namespace LPA /// Variabile appoggio semaforo divieto print x evitare accodamenti... 15 sec da last check... /// protected DateTime vetoPrint; - + /// + /// Modalità demo/test printing locale + /// + protected bool demoMode = false; #endregion #region init form @@ -136,6 +139,12 @@ namespace LPA btnStop.Enabled = spoolerRun; lblStatus.ForeColor = spoolerRun ? Color.Green : Color.OrangeRed; lblStatus.Text = spoolerRun ? "Running" : "Stopped"; + // se demo aggiungo... + if (demoMode) + { + lblStatus.Text += " TEST/DEMO MODE"; + } + menuTestDemo.Visible = demoMode; } /// /// Setup oggetto DGV @@ -446,6 +455,30 @@ namespace LPA } } + /// + /// Testing print demo da files locali + /// + /// + /// + private void printDemoToolStripMenuItem_Click(object sender, EventArgs e) + { + + } + + private void btnDemo_Click(object sender, EventArgs e) + { + string message = demoMode ? "Confermi di voler abbandonare la modalità test/Demo?" : "Attenzione! sei sicuro di voler attivare la modalità Test/Demo? il sistema funzionerà in modalità offline e configurate le code di stampa effettuerà test di stampa locale"; + string title = "Test / Demo mode"; + DialogResult result = MessageBox.Show(message, title, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); + if (result == DialogResult.Yes) + { + demoMode = !demoMode; + } + // update buttons... + btnDemo.Text = demoMode ? "Exit Demo" : "Demo"; + setupButtons(); + } + #endregion #region metodi di chiamata a server @@ -596,5 +629,6 @@ namespace LPA } } #endregion + } } diff --git a/LPA/MainForm.resx b/LPA/MainForm.resx index 6402115..0bb1033 100644 --- a/LPA/MainForm.resx +++ b/LPA/MainForm.resx @@ -129,4 +129,7 @@ 334, 17 + + 441, 17 + \ No newline at end of file