diff --git a/IOB-MAN/App.config b/IOB-MAN/App.config index 02dc44ed..073dc61f 100644 --- a/IOB-MAN/App.config +++ b/IOB-MAN/App.config @@ -4,9 +4,10 @@ - - - + + + \ No newline at end of file diff --git a/IOB-MAN/IOBManPanel.Designer.cs b/IOB-MAN/IOBManPanel.Designer.cs index df9ab084..121aa107 100644 --- a/IOB-MAN/IOBManPanel.Designer.cs +++ b/IOB-MAN/IOBManPanel.Designer.cs @@ -32,34 +32,47 @@ this.btnOpen = new System.Windows.Forms.Button(); this.btnClose = new System.Windows.Forms.Button(); this.MainTimer = new System.Windows.Forms.Timer(this.components); - this.lblNumChild = new System.Windows.Forms.Label(); this.dgvManagedItems = new System.Windows.Forms.DataGridView(); this.btnCloseAll = new System.Windows.Forms.Button(); this.btnRestartAll = new System.Windows.Forms.Button(); this.btnUpdateMode = new System.Windows.Forms.Button(); + this.statusStrip1 = new System.Windows.Forms.StatusStrip(); + this.tsslNumProc = new System.Windows.Forms.ToolStripStatusLabel(); + this.tsProgBar = new System.Windows.Forms.ToolStripProgressBar(); + this.panel1 = new System.Windows.Forms.Panel(); + this.btnMinimizeAll = new System.Windows.Forms.Button(); + this.panel2 = new System.Windows.Forms.Panel(); + this.btnMaximixeAll = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.dgvManagedItems)).BeginInit(); + this.statusStrip1.SuspendLayout(); + this.panel1.SuspendLayout(); this.SuspendLayout(); // // btnOpen // - this.btnOpen.Location = new System.Drawing.Point(11, 11); - this.btnOpen.Margin = new System.Windows.Forms.Padding(2); + this.btnOpen.BackColor = System.Drawing.Color.Green; + this.btnOpen.ForeColor = System.Drawing.Color.Yellow; + this.btnOpen.Location = new System.Drawing.Point(14, 17); + this.btnOpen.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnOpen.Name = "btnOpen"; - this.btnOpen.Size = new System.Drawing.Size(108, 27); + this.btnOpen.Size = new System.Drawing.Size(128, 32); this.btnOpen.TabIndex = 1; - this.btnOpen.Text = "Open"; - this.btnOpen.UseVisualStyleBackColor = true; + this.btnOpen.Text = "Open ALL"; + this.btnOpen.UseVisualStyleBackColor = false; this.btnOpen.Click += new System.EventHandler(this.btnOpen_Click); // // btnClose // - this.btnClose.Location = new System.Drawing.Point(133, 11); - this.btnClose.Margin = new System.Windows.Forms.Padding(2); + this.btnClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnClose.BackColor = System.Drawing.Color.Red; + this.btnClose.ForeColor = System.Drawing.Color.Yellow; + this.btnClose.Location = new System.Drawing.Point(892, 17); + this.btnClose.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnClose.Name = "btnClose"; - this.btnClose.Size = new System.Drawing.Size(108, 27); + this.btnClose.Size = new System.Drawing.Size(128, 32); this.btnClose.TabIndex = 70; this.btnClose.Text = "Close SEL"; - this.btnClose.UseVisualStyleBackColor = true; + this.btnClose.UseVisualStyleBackColor = false; this.btnClose.Click += new System.EventHandler(this.btnClose_Click); // // MainTimer @@ -67,80 +80,154 @@ this.MainTimer.Interval = 500; this.MainTimer.Tick += new System.EventHandler(this.MainTimer_Tick); // - // lblNumChild - // - this.lblNumChild.AutoSize = true; - this.lblNumChild.Location = new System.Drawing.Point(12, 40); - this.lblNumChild.Name = "lblNumChild"; - this.lblNumChild.Size = new System.Drawing.Size(16, 13); - this.lblNumChild.TabIndex = 73; - this.lblNumChild.Text = "..."; - this.lblNumChild.Click += new System.EventHandler(this.lblNumChild_Click); - // // dgvManagedItems // this.dgvManagedItems.AllowUserToAddRows = false; this.dgvManagedItems.AllowUserToDeleteRows = false; + this.dgvManagedItems.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.dgvManagedItems.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvManagedItems.Location = new System.Drawing.Point(11, 70); + this.dgvManagedItems.Location = new System.Drawing.Point(0, 69); + this.dgvManagedItems.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dgvManagedItems.Name = "dgvManagedItems"; this.dgvManagedItems.ReadOnly = true; - this.dgvManagedItems.Size = new System.Drawing.Size(647, 246); + this.dgvManagedItems.RowHeadersWidth = 51; + this.dgvManagedItems.Size = new System.Drawing.Size(709, 404); this.dgvManagedItems.TabIndex = 75; + this.dgvManagedItems.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvManagedItems_CellDoubleClick); this.dgvManagedItems.SelectionChanged += new System.EventHandler(this.dgvManagedItems_SelectionChanged); // // btnCloseAll // - this.btnCloseAll.Location = new System.Drawing.Point(552, 11); - this.btnCloseAll.Margin = new System.Windows.Forms.Padding(2); + this.btnCloseAll.BackColor = System.Drawing.Color.Red; + this.btnCloseAll.ForeColor = System.Drawing.Color.Yellow; + this.btnCloseAll.Location = new System.Drawing.Point(282, 17); + this.btnCloseAll.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnCloseAll.Name = "btnCloseAll"; - this.btnCloseAll.Size = new System.Drawing.Size(108, 27); + this.btnCloseAll.Size = new System.Drawing.Size(128, 32); this.btnCloseAll.TabIndex = 77; this.btnCloseAll.Text = "Close ALL"; - this.btnCloseAll.UseVisualStyleBackColor = true; + this.btnCloseAll.UseVisualStyleBackColor = false; this.btnCloseAll.Click += new System.EventHandler(this.button1_Click); // // btnRestartAll // - this.btnRestartAll.Location = new System.Drawing.Point(429, 11); - this.btnRestartAll.Margin = new System.Windows.Forms.Padding(2); + this.btnRestartAll.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128))))); + this.btnRestartAll.Location = new System.Drawing.Point(148, 17); + this.btnRestartAll.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnRestartAll.Name = "btnRestartAll"; - this.btnRestartAll.Size = new System.Drawing.Size(108, 27); + this.btnRestartAll.Size = new System.Drawing.Size(128, 32); this.btnRestartAll.TabIndex = 78; this.btnRestartAll.Text = "Restart ALL"; - this.btnRestartAll.UseVisualStyleBackColor = true; + this.btnRestartAll.UseVisualStyleBackColor = false; this.btnRestartAll.Click += new System.EventHandler(this.button2_Click); // // btnUpdateMode // - this.btnUpdateMode.Location = new System.Drawing.Point(280, 11); - this.btnUpdateMode.Margin = new System.Windows.Forms.Padding(2); + this.btnUpdateMode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnUpdateMode.BackColor = System.Drawing.SystemColors.GradientActiveCaption; + this.btnUpdateMode.Location = new System.Drawing.Point(758, 17); + this.btnUpdateMode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnUpdateMode.Name = "btnUpdateMode"; - this.btnUpdateMode.Size = new System.Drawing.Size(108, 27); + this.btnUpdateMode.Size = new System.Drawing.Size(128, 32); this.btnUpdateMode.TabIndex = 79; this.btnUpdateMode.Text = "Update mode"; - this.btnUpdateMode.UseVisualStyleBackColor = true; + this.btnUpdateMode.UseVisualStyleBackColor = false; + // + // statusStrip1 + // + this.statusStrip1.ImageScalingSize = new System.Drawing.Size(20, 20); + this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tsProgBar, + this.tsslNumProc}); + this.statusStrip1.Location = new System.Drawing.Point(0, 477); + this.statusStrip1.Name = "statusStrip1"; + this.statusStrip1.Size = new System.Drawing.Size(1032, 26); + this.statusStrip1.TabIndex = 82; + this.statusStrip1.Text = "statusStrip1"; + // + // tsslNumProc + // + this.tsslNumProc.Name = "tsslNumProc"; + this.tsslNumProc.Size = new System.Drawing.Size(18, 20); + this.tsslNumProc.Text = "..."; + // + // tsProgBar + // + this.tsProgBar.Name = "tsProgBar"; + this.tsProgBar.Size = new System.Drawing.Size(100, 18); + // + // panel1 + // + this.panel1.Controls.Add(this.btnMaximixeAll); + this.panel1.Controls.Add(this.btnMinimizeAll); + this.panel1.Controls.Add(this.btnOpen); + this.panel1.Controls.Add(this.btnRestartAll); + this.panel1.Controls.Add(this.btnCloseAll); + this.panel1.Controls.Add(this.btnUpdateMode); + this.panel1.Controls.Add(this.btnClose); + this.panel1.Dock = System.Windows.Forms.DockStyle.Top; + this.panel1.Location = new System.Drawing.Point(0, 0); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(1032, 62); + this.panel1.TabIndex = 83; + // + // btnMinimizeAll + // + this.btnMinimizeAll.BackColor = System.Drawing.SystemColors.ControlDarkDark; + this.btnMinimizeAll.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.btnMinimizeAll.Location = new System.Drawing.Point(550, 17); + this.btnMinimizeAll.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnMinimizeAll.Name = "btnMinimizeAll"; + this.btnMinimizeAll.Size = new System.Drawing.Size(128, 32); + this.btnMinimizeAll.TabIndex = 80; + this.btnMinimizeAll.Text = "Hide ALL"; + this.btnMinimizeAll.UseVisualStyleBackColor = false; + this.btnMinimizeAll.Click += new System.EventHandler(this.btnMinimizeAll_Click); + // + // panel2 + // + this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.panel2.Location = new System.Drawing.Point(716, 69); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(316, 405); + this.panel2.TabIndex = 84; + // + // btnMaximixeAll + // + this.btnMaximixeAll.BackColor = System.Drawing.SystemColors.Highlight; + this.btnMaximixeAll.ForeColor = System.Drawing.SystemColors.ControlLightLight; + this.btnMaximixeAll.Location = new System.Drawing.Point(416, 17); + this.btnMaximixeAll.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnMaximixeAll.Name = "btnMaximixeAll"; + this.btnMaximixeAll.Size = new System.Drawing.Size(128, 32); + this.btnMaximixeAll.TabIndex = 81; + this.btnMaximixeAll.Text = "Show ALL"; + this.btnMaximixeAll.UseVisualStyleBackColor = false; + this.btnMaximixeAll.Click += new System.EventHandler(this.btnMaximixeAll_Click); // // IOBManPanel // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.SystemColors.ControlLight; - this.ClientSize = new System.Drawing.Size(670, 409); - this.Controls.Add(this.btnUpdateMode); - this.Controls.Add(this.btnRestartAll); - this.Controls.Add(this.btnCloseAll); + this.ClientSize = new System.Drawing.Size(1032, 503); + this.Controls.Add(this.panel2); + this.Controls.Add(this.panel1); + this.Controls.Add(this.statusStrip1); this.Controls.Add(this.dgvManagedItems); - this.Controls.Add(this.lblNumChild); - this.Controls.Add(this.btnClose); - this.Controls.Add(this.btnOpen); this.IsMdiContainer = true; - this.Margin = new System.Windows.Forms.Padding(2); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "IOBManPanel"; this.Text = "IOB MANAGER"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IOBManPanel_FormClosing); this.Load += new System.EventHandler(this.IOBManPanel_Load_1); ((System.ComponentModel.ISupportInitialize)(this.dgvManagedItems)).EndInit(); + this.statusStrip1.ResumeLayout(false); + this.statusStrip1.PerformLayout(); + this.panel1.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -150,11 +237,17 @@ private System.Windows.Forms.Button btnOpen; private System.Windows.Forms.Button btnClose; private System.Windows.Forms.Timer MainTimer; - private System.Windows.Forms.Label lblNumChild; private System.Windows.Forms.DataGridView dgvManagedItems; private System.Windows.Forms.Button btnCloseAll; private System.Windows.Forms.Button btnRestartAll; private System.Windows.Forms.Button btnUpdateMode; - } + private System.Windows.Forms.StatusStrip statusStrip1; + private System.Windows.Forms.ToolStripStatusLabel tsslNumProc; + private System.Windows.Forms.ToolStripProgressBar tsProgBar; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button btnMinimizeAll; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Button btnMaximixeAll; + } } diff --git a/IOB-MAN/IOBManPanel.cs b/IOB-MAN/IOBManPanel.cs index 58e97ecf..6a169f21 100644 --- a/IOB-MAN/IOBManPanel.cs +++ b/IOB-MAN/IOBManPanel.cs @@ -2,12 +2,27 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Runtime.InteropServices; using System.Windows.Forms; namespace IOB_MAN { + + + public partial class IOBManPanel : Form { + #region area gestione hode/max finestre + + private const int SW_SHOWNORMAL = 1; + private const int SW_SHOWMINIMIZED = 2; + private const int SW_SHOWMAXIMIZED = 3; + [DllImport("user32.dll")] + private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); + + #endregion + + protected int countCheck = utils.CRI("chekMult"); /// /// Elenco ARGS (uno per child da avviare) /// @@ -25,11 +40,15 @@ namespace IOB_MAN { InitializeComponent(); myInit(); + updateStatus(); } private void myInit() { utils.lgInfo("Starting App"); + // init prog bar + tsProgBar.Maximum = 100; + tsProgBar.Step = 1; // gestione eventi binding source ElencoIOB.AddingNew += ElencoIOB_AddingNew; ElencoIOB.ListChanged += ElencoIOB_ListChanged; @@ -78,8 +97,7 @@ namespace IOB_MAN private void updateStatus() { // aggiorno labels - lblNumChild.Text = $"Avviati {ElencoIOB.Count} processi child"; - //dgvManagedItems.bind + tsslNumProc.Text = $"Avviati {ElencoIOB.Count} processi child"; } /// /// Chiama apertura + update status... @@ -105,7 +123,8 @@ namespace IOB_MAN psi = new ProcessStartInfo { FileName = TargetExe, - Arguments = item + Arguments = item, + WindowStyle = ProcessWindowStyle.Minimized }; //childProc.StartInfo = psi; @@ -211,9 +230,26 @@ namespace IOB_MAN /// private void MainTimer_Tick(object sender, EventArgs e) { - checkRunningchild(); - showUpdate(); + updateProgBar(); + countCheck--; + if (countCheck < 0) + { + countCheck = utils.CRI("chekMult"); + // se scaduto timer... + checkRunningchild(); + showUpdate(); + } } + + private void updateProgBar() + { + tsProgBar.PerformStep(); + if (tsProgBar.Value >= tsProgBar.Maximum) + { + tsProgBar.Value = 0; + } + } + /// /// Verifica se i proc child siano ancora in RUN /// @@ -323,6 +359,74 @@ namespace IOB_MAN { } + + + private void dgvManagedItems_CellDoubleClick(object sender, DataGridViewCellEventArgs e) + { + // seleziono riga... + int pid = -1; + if (e.RowIndex >= 0) + { + //dgvManagedItems.CurrentCell = dgvManagedItems.Rows[e.RowIndex].Cells[0]; + + dgvManagedItems.Rows[e.RowIndex].Selected = true; + using (var riga = dgvManagedItems.Rows[e.RowIndex]) + { + int.TryParse(riga.Cells["pID"].Value.ToString(), out pid); + if (pid >= 0) + { + // provo a vedere SE ci sia il processo e di conseguenza lo chiudo... + try + { + Process p = Process.GetProcessById(pid); + // cerco e chiudo quelli che mi interessano... + var windowsHandle = p.MainWindowHandle; + ShowWindowAsync(windowsHandle, SW_SHOWNORMAL); + } + catch + { + // errore era già chiuso.. + } + } + } + } + } + + private void btnMinimizeAll_Click(object sender, EventArgs e) + { + foreach (iobAdapt item in ElencoIOB.List) + { + try + { + Process p = Process.GetProcessById(item.pID); + // cerco e chiudo quelli che mi interessano... + var windowsHandle = p.MainWindowHandle; + ShowWindowAsync(windowsHandle, SW_SHOWMINIMIZED); + } + catch + { + // errore era già chiuso.. + } + } + } + + private void btnMaximixeAll_Click(object sender, EventArgs e) + { + foreach (iobAdapt item in ElencoIOB.List) + { + try + { + Process p = Process.GetProcessById(item.pID); + // cerco e chiudo quelli che mi interessano... + var windowsHandle = p.MainWindowHandle; + ShowWindowAsync(windowsHandle, SW_SHOWNORMAL); + } + catch + { + // errore era già chiuso.. + } + } + } } } diff --git a/IOB-MAN/IOBManPanel.resx b/IOB-MAN/IOBManPanel.resx index 414b3c46..4b7440da 100644 --- a/IOB-MAN/IOBManPanel.resx +++ b/IOB-MAN/IOBManPanel.resx @@ -120,4 +120,7 @@ 154, 17 + + 283, 17 + \ No newline at end of file