From 64c8f7ec60a67153c1df16b03bee49a232d1eae7 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 1 Sep 2020 13:15:19 +0200 Subject: [PATCH] Aggiunta metodi LOAD/SAVE x conf --- ELMA/ConfigMan.Designer.cs | 52 ++------ ELMA/ConfigMan.resx | 6 - ELMA/MainForm.Designer.cs | 267 +++++++++++++++++++++---------------- ELMA/MainForm.cs | 99 +++++++++++--- ELMA/MainForm.resx | 9 ++ 5 files changed, 251 insertions(+), 182 deletions(-) diff --git a/ELMA/ConfigMan.Designer.cs b/ELMA/ConfigMan.Designer.cs index c2f55fc..7f43cc2 100644 --- a/ELMA/ConfigMan.Designer.cs +++ b/ELMA/ConfigMan.Designer.cs @@ -36,10 +36,6 @@ this.txtUser = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); - this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); - this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); - this.btnLoad = new System.Windows.Forms.Button(); - this.btnSave = new System.Windows.Forms.Button(); this.txtBaseUrl = new System.Windows.Forms.TextBox(); this.label5 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); @@ -75,14 +71,14 @@ this.groupBox1.Controls.Add(this.label1); this.groupBox1.Location = new System.Drawing.Point(12, 41); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(775, 55); + this.groupBox1.Size = new System.Drawing.Size(385, 111); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "SQL Server"; // // txtPasswd // - this.txtPasswd.Location = new System.Drawing.Point(633, 19); + this.txtPasswd.Location = new System.Drawing.Point(70, 81); this.txtPasswd.Name = "txtPasswd"; this.txtPasswd.Size = new System.Drawing.Size(136, 20); this.txtPasswd.TabIndex = 5; @@ -90,7 +86,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(583, 22); + this.label3.Location = new System.Drawing.Point(20, 84); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(44, 13); this.label3.TabIndex = 4; @@ -98,7 +94,7 @@ // // txtUser // - this.txtUser.Location = new System.Drawing.Point(425, 19); + this.txtUser.Location = new System.Drawing.Point(70, 51); this.txtUser.Name = "txtUser"; this.txtUser.Size = new System.Drawing.Size(136, 20); this.txtUser.TabIndex = 3; @@ -106,7 +102,7 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(390, 22); + this.label2.Location = new System.Drawing.Point(35, 54); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(29, 13); this.label2.TabIndex = 2; @@ -122,35 +118,11 @@ this.label4.TabIndex = 3; this.label4.Text = "Active Config"; // - // openFileDialog1 - // - this.openFileDialog1.FileName = "openFileDialog1"; - // - // btnLoad - // - this.btnLoad.Location = new System.Drawing.Point(9, 176); - this.btnLoad.Name = "btnLoad"; - this.btnLoad.Size = new System.Drawing.Size(117, 23); - this.btnLoad.TabIndex = 4; - this.btnLoad.Text = "Load Config"; - this.btnLoad.UseVisualStyleBackColor = true; - this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click); - // - // btnSave - // - this.btnSave.Location = new System.Drawing.Point(132, 176); - this.btnSave.Name = "btnSave"; - this.btnSave.Size = new System.Drawing.Size(117, 23); - this.btnSave.TabIndex = 5; - this.btnSave.Text = "Save Config"; - this.btnSave.UseVisualStyleBackColor = true; - this.btnSave.Click += new System.EventHandler(this.btnSave_Click); - // // txtBaseUrl // this.txtBaseUrl.Location = new System.Drawing.Point(70, 33); this.txtBaseUrl.Name = "txtBaseUrl"; - this.txtBaseUrl.Size = new System.Drawing.Size(439, 20); + this.txtBaseUrl.Size = new System.Drawing.Size(306, 20); this.txtBaseUrl.TabIndex = 21; this.txtBaseUrl.Text = "https://localhost:44388"; // @@ -167,9 +139,9 @@ // this.groupBox2.Controls.Add(this.txtBaseUrl); this.groupBox2.Controls.Add(this.label5); - this.groupBox2.Location = new System.Drawing.Point(11, 102); + this.groupBox2.Location = new System.Drawing.Point(12, 158); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(776, 68); + this.groupBox2.Size = new System.Drawing.Size(385, 68); this.groupBox2.TabIndex = 22; this.groupBox2.TabStop = false; this.groupBox2.Text = "IIS Server"; @@ -188,10 +160,8 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 245); + this.ClientSize = new System.Drawing.Size(411, 237); this.Controls.Add(this.groupBox2); - this.Controls.Add(this.btnSave); - this.Controls.Add(this.btnLoad); this.Controls.Add(this.label4); this.Controls.Add(this.groupBox1); this.Name = "ConfigMan"; @@ -215,10 +185,6 @@ private System.Windows.Forms.TextBox txtUser; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label4; - private System.Windows.Forms.OpenFileDialog openFileDialog1; - private System.Windows.Forms.SaveFileDialog saveFileDialog1; - private System.Windows.Forms.Button btnLoad; - private System.Windows.Forms.Button btnSave; private System.Windows.Forms.TextBox txtBaseUrl; private System.Windows.Forms.Label label5; private System.Windows.Forms.GroupBox groupBox2; diff --git a/ELMA/ConfigMan.resx b/ELMA/ConfigMan.resx index cdb878b..1af7de1 100644 --- a/ELMA/ConfigMan.resx +++ b/ELMA/ConfigMan.resx @@ -117,10 +117,4 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 17, 17 - - - 157, 17 - \ No newline at end of file diff --git a/ELMA/MainForm.Designer.cs b/ELMA/MainForm.Designer.cs index 1eb25df..1f5d5c7 100644 --- a/ELMA/MainForm.Designer.cs +++ b/ELMA/MainForm.Designer.cs @@ -31,6 +31,16 @@ this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.ErrorsDGV = new System.Windows.Forms.DataGridView(); + this.sequenceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.timeUtcDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.hostDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.applicationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.errorIdDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.typeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.sourceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.userDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.statusCodeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.bsErrors = new System.Windows.Forms.BindingSource(this.components); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.lblApp = new System.Windows.Forms.ToolStripStatusLabel(); @@ -51,22 +61,17 @@ this.listApp = new System.Windows.Forms.ListBox(); this.timerUI = new System.Windows.Forms.Timer(this.components); this.timerMain = new System.Windows.Forms.Timer(this.components); - this.label1 = new System.Windows.Forms.Label(); - this.txtBaseUrl = new System.Windows.Forms.TextBox(); - this.sequenceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.timeUtcDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.hostDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.applicationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.errorIdDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.typeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.sourceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.userDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.statusCodeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.messageDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.currentConfigToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.loadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); ((System.ComponentModel.ISupportInitialize)(this.ErrorsDGV)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bsErrors)).BeginInit(); this.statusStrip1.SuspendLayout(); this.gboxFiltri.SuspendLayout(); + this.menuStrip1.SuspendLayout(); this.SuspendLayout(); // // ErrorsDGV @@ -91,15 +96,105 @@ this.statusCodeDataGridViewTextBoxColumn, this.messageDataGridViewTextBoxColumn}); this.ErrorsDGV.DataSource = this.bsErrors; - this.ErrorsDGV.Location = new System.Drawing.Point(12, 119); + this.ErrorsDGV.Location = new System.Drawing.Point(12, 135); this.ErrorsDGV.Name = "ErrorsDGV"; this.ErrorsDGV.ReadOnly = true; this.ErrorsDGV.RowHeadersWidth = 51; - this.ErrorsDGV.Size = new System.Drawing.Size(1048, 486); + this.ErrorsDGV.Size = new System.Drawing.Size(1048, 470); this.ErrorsDGV.TabIndex = 0; this.ErrorsDGV.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.ErrorsDGV_CellDoubleClick); this.ErrorsDGV.DoubleClick += new System.EventHandler(this.ErrorsDGV_DoubleClick); // + // sequenceDataGridViewTextBoxColumn + // + this.sequenceDataGridViewTextBoxColumn.DataPropertyName = "Sequence"; + this.sequenceDataGridViewTextBoxColumn.HeaderText = "Sequence"; + this.sequenceDataGridViewTextBoxColumn.MinimumWidth = 6; + this.sequenceDataGridViewTextBoxColumn.Name = "sequenceDataGridViewTextBoxColumn"; + this.sequenceDataGridViewTextBoxColumn.ReadOnly = true; + this.sequenceDataGridViewTextBoxColumn.Width = 125; + // + // timeUtcDataGridViewTextBoxColumn + // + this.timeUtcDataGridViewTextBoxColumn.DataPropertyName = "TimeUtc"; + this.timeUtcDataGridViewTextBoxColumn.HeaderText = "TimeUtc"; + this.timeUtcDataGridViewTextBoxColumn.MinimumWidth = 6; + this.timeUtcDataGridViewTextBoxColumn.Name = "timeUtcDataGridViewTextBoxColumn"; + this.timeUtcDataGridViewTextBoxColumn.ReadOnly = true; + this.timeUtcDataGridViewTextBoxColumn.Width = 125; + // + // hostDataGridViewTextBoxColumn + // + this.hostDataGridViewTextBoxColumn.DataPropertyName = "Host"; + this.hostDataGridViewTextBoxColumn.HeaderText = "Host"; + this.hostDataGridViewTextBoxColumn.MinimumWidth = 6; + this.hostDataGridViewTextBoxColumn.Name = "hostDataGridViewTextBoxColumn"; + this.hostDataGridViewTextBoxColumn.ReadOnly = true; + this.hostDataGridViewTextBoxColumn.Width = 125; + // + // applicationDataGridViewTextBoxColumn + // + this.applicationDataGridViewTextBoxColumn.DataPropertyName = "Application"; + this.applicationDataGridViewTextBoxColumn.HeaderText = "Application"; + this.applicationDataGridViewTextBoxColumn.MinimumWidth = 6; + this.applicationDataGridViewTextBoxColumn.Name = "applicationDataGridViewTextBoxColumn"; + this.applicationDataGridViewTextBoxColumn.ReadOnly = true; + this.applicationDataGridViewTextBoxColumn.Width = 125; + // + // errorIdDataGridViewTextBoxColumn + // + this.errorIdDataGridViewTextBoxColumn.DataPropertyName = "ErrorId"; + this.errorIdDataGridViewTextBoxColumn.HeaderText = "ErrorId"; + this.errorIdDataGridViewTextBoxColumn.MinimumWidth = 6; + this.errorIdDataGridViewTextBoxColumn.Name = "errorIdDataGridViewTextBoxColumn"; + this.errorIdDataGridViewTextBoxColumn.ReadOnly = true; + this.errorIdDataGridViewTextBoxColumn.Width = 125; + // + // typeDataGridViewTextBoxColumn + // + this.typeDataGridViewTextBoxColumn.DataPropertyName = "Type"; + this.typeDataGridViewTextBoxColumn.HeaderText = "Type"; + this.typeDataGridViewTextBoxColumn.MinimumWidth = 6; + this.typeDataGridViewTextBoxColumn.Name = "typeDataGridViewTextBoxColumn"; + this.typeDataGridViewTextBoxColumn.ReadOnly = true; + this.typeDataGridViewTextBoxColumn.Width = 125; + // + // sourceDataGridViewTextBoxColumn + // + this.sourceDataGridViewTextBoxColumn.DataPropertyName = "Source"; + this.sourceDataGridViewTextBoxColumn.HeaderText = "Source"; + this.sourceDataGridViewTextBoxColumn.MinimumWidth = 6; + this.sourceDataGridViewTextBoxColumn.Name = "sourceDataGridViewTextBoxColumn"; + this.sourceDataGridViewTextBoxColumn.ReadOnly = true; + this.sourceDataGridViewTextBoxColumn.Width = 125; + // + // userDataGridViewTextBoxColumn + // + this.userDataGridViewTextBoxColumn.DataPropertyName = "User"; + this.userDataGridViewTextBoxColumn.HeaderText = "User"; + this.userDataGridViewTextBoxColumn.MinimumWidth = 6; + this.userDataGridViewTextBoxColumn.Name = "userDataGridViewTextBoxColumn"; + this.userDataGridViewTextBoxColumn.ReadOnly = true; + this.userDataGridViewTextBoxColumn.Width = 125; + // + // statusCodeDataGridViewTextBoxColumn + // + this.statusCodeDataGridViewTextBoxColumn.DataPropertyName = "StatusCode"; + this.statusCodeDataGridViewTextBoxColumn.HeaderText = "StatusCode"; + this.statusCodeDataGridViewTextBoxColumn.MinimumWidth = 6; + this.statusCodeDataGridViewTextBoxColumn.Name = "statusCodeDataGridViewTextBoxColumn"; + this.statusCodeDataGridViewTextBoxColumn.ReadOnly = true; + this.statusCodeDataGridViewTextBoxColumn.Width = 125; + // + // messageDataGridViewTextBoxColumn + // + this.messageDataGridViewTextBoxColumn.DataPropertyName = "Message"; + this.messageDataGridViewTextBoxColumn.HeaderText = "Message"; + this.messageDataGridViewTextBoxColumn.MinimumWidth = 6; + this.messageDataGridViewTextBoxColumn.Name = "messageDataGridViewTextBoxColumn"; + this.messageDataGridViewTextBoxColumn.ReadOnly = true; + this.messageDataGridViewTextBoxColumn.Width = 125; + // // bsErrors // this.bsErrors.DataSource = typeof(AppData.ELMAH_Error); @@ -145,8 +240,6 @@ // this.gboxFiltri.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.gboxFiltri.Controls.Add(this.txtBaseUrl); - this.gboxFiltri.Controls.Add(this.label1); this.gboxFiltri.Controls.Add(this.btnDeleteSel); this.gboxFiltri.Controls.Add(this.chkUsers); this.gboxFiltri.Controls.Add(this.chkStatus); @@ -158,7 +251,7 @@ this.gboxFiltri.Controls.Add(this.listStatus); this.gboxFiltri.Controls.Add(this.listHost); this.gboxFiltri.Controls.Add(this.listApp); - this.gboxFiltri.Location = new System.Drawing.Point(12, 10); + this.gboxFiltri.Location = new System.Drawing.Point(12, 26); this.gboxFiltri.Margin = new System.Windows.Forms.Padding(2); this.gboxFiltri.Name = "gboxFiltri"; this.gboxFiltri.Padding = new System.Windows.Forms.Padding(2); @@ -303,112 +396,50 @@ this.timerMain.Interval = 10000; this.timerMain.Tick += new System.EventHandler(this.timerMain_Tick); // - // label1 + // menuStrip1 // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(807, 14); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(56, 13); - this.label1.TabIndex = 18; - this.label1.Text = "Base URL"; + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(1072, 24); + this.menuStrip1.TabIndex = 3; + this.menuStrip1.Text = "menuStrip1"; // - // txtBaseUrl + // fileToolStripMenuItem // - this.txtBaseUrl.Location = new System.Drawing.Point(810, 31); - this.txtBaseUrl.Name = "txtBaseUrl"; - this.txtBaseUrl.Size = new System.Drawing.Size(233, 20); - this.txtBaseUrl.TabIndex = 19; - this.txtBaseUrl.Text = "https://localhost:44388"; + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.currentConfigToolStripMenuItem, + this.loadToolStripMenuItem, + this.saveToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(55, 20); + this.fileToolStripMenuItem.Text = "C&onfig"; // - // sequenceDataGridViewTextBoxColumn + // currentConfigToolStripMenuItem // - this.sequenceDataGridViewTextBoxColumn.DataPropertyName = "Sequence"; - this.sequenceDataGridViewTextBoxColumn.HeaderText = "Sequence"; - this.sequenceDataGridViewTextBoxColumn.MinimumWidth = 6; - this.sequenceDataGridViewTextBoxColumn.Name = "sequenceDataGridViewTextBoxColumn"; - this.sequenceDataGridViewTextBoxColumn.ReadOnly = true; - this.sequenceDataGridViewTextBoxColumn.Width = 125; + this.currentConfigToolStripMenuItem.Name = "currentConfigToolStripMenuItem"; + this.currentConfigToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.currentConfigToolStripMenuItem.Text = "&Current Config"; + this.currentConfigToolStripMenuItem.Click += new System.EventHandler(this.currentConfigToolStripMenuItem_Click); // - // timeUtcDataGridViewTextBoxColumn + // loadToolStripMenuItem // - this.timeUtcDataGridViewTextBoxColumn.DataPropertyName = "TimeUtc"; - this.timeUtcDataGridViewTextBoxColumn.HeaderText = "TimeUtc"; - this.timeUtcDataGridViewTextBoxColumn.MinimumWidth = 6; - this.timeUtcDataGridViewTextBoxColumn.Name = "timeUtcDataGridViewTextBoxColumn"; - this.timeUtcDataGridViewTextBoxColumn.ReadOnly = true; - this.timeUtcDataGridViewTextBoxColumn.Width = 125; + this.loadToolStripMenuItem.Name = "loadToolStripMenuItem"; + this.loadToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.loadToolStripMenuItem.Text = "&Load"; + this.loadToolStripMenuItem.Click += new System.EventHandler(this.loadToolStripMenuItem_Click); // - // hostDataGridViewTextBoxColumn + // saveToolStripMenuItem // - this.hostDataGridViewTextBoxColumn.DataPropertyName = "Host"; - this.hostDataGridViewTextBoxColumn.HeaderText = "Host"; - this.hostDataGridViewTextBoxColumn.MinimumWidth = 6; - this.hostDataGridViewTextBoxColumn.Name = "hostDataGridViewTextBoxColumn"; - this.hostDataGridViewTextBoxColumn.ReadOnly = true; - this.hostDataGridViewTextBoxColumn.Width = 125; + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.saveToolStripMenuItem.Text = "&Save"; + this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); // - // applicationDataGridViewTextBoxColumn + // openFileDialog1 // - this.applicationDataGridViewTextBoxColumn.DataPropertyName = "Application"; - this.applicationDataGridViewTextBoxColumn.HeaderText = "Application"; - this.applicationDataGridViewTextBoxColumn.MinimumWidth = 6; - this.applicationDataGridViewTextBoxColumn.Name = "applicationDataGridViewTextBoxColumn"; - this.applicationDataGridViewTextBoxColumn.ReadOnly = true; - this.applicationDataGridViewTextBoxColumn.Width = 125; - // - // errorIdDataGridViewTextBoxColumn - // - this.errorIdDataGridViewTextBoxColumn.DataPropertyName = "ErrorId"; - this.errorIdDataGridViewTextBoxColumn.HeaderText = "ErrorId"; - this.errorIdDataGridViewTextBoxColumn.MinimumWidth = 6; - this.errorIdDataGridViewTextBoxColumn.Name = "errorIdDataGridViewTextBoxColumn"; - this.errorIdDataGridViewTextBoxColumn.ReadOnly = true; - this.errorIdDataGridViewTextBoxColumn.Width = 125; - // - // typeDataGridViewTextBoxColumn - // - this.typeDataGridViewTextBoxColumn.DataPropertyName = "Type"; - this.typeDataGridViewTextBoxColumn.HeaderText = "Type"; - this.typeDataGridViewTextBoxColumn.MinimumWidth = 6; - this.typeDataGridViewTextBoxColumn.Name = "typeDataGridViewTextBoxColumn"; - this.typeDataGridViewTextBoxColumn.ReadOnly = true; - this.typeDataGridViewTextBoxColumn.Width = 125; - // - // sourceDataGridViewTextBoxColumn - // - this.sourceDataGridViewTextBoxColumn.DataPropertyName = "Source"; - this.sourceDataGridViewTextBoxColumn.HeaderText = "Source"; - this.sourceDataGridViewTextBoxColumn.MinimumWidth = 6; - this.sourceDataGridViewTextBoxColumn.Name = "sourceDataGridViewTextBoxColumn"; - this.sourceDataGridViewTextBoxColumn.ReadOnly = true; - this.sourceDataGridViewTextBoxColumn.Width = 125; - // - // userDataGridViewTextBoxColumn - // - this.userDataGridViewTextBoxColumn.DataPropertyName = "User"; - this.userDataGridViewTextBoxColumn.HeaderText = "User"; - this.userDataGridViewTextBoxColumn.MinimumWidth = 6; - this.userDataGridViewTextBoxColumn.Name = "userDataGridViewTextBoxColumn"; - this.userDataGridViewTextBoxColumn.ReadOnly = true; - this.userDataGridViewTextBoxColumn.Width = 125; - // - // statusCodeDataGridViewTextBoxColumn - // - this.statusCodeDataGridViewTextBoxColumn.DataPropertyName = "StatusCode"; - this.statusCodeDataGridViewTextBoxColumn.HeaderText = "StatusCode"; - this.statusCodeDataGridViewTextBoxColumn.MinimumWidth = 6; - this.statusCodeDataGridViewTextBoxColumn.Name = "statusCodeDataGridViewTextBoxColumn"; - this.statusCodeDataGridViewTextBoxColumn.ReadOnly = true; - this.statusCodeDataGridViewTextBoxColumn.Width = 125; - // - // messageDataGridViewTextBoxColumn - // - this.messageDataGridViewTextBoxColumn.DataPropertyName = "Message"; - this.messageDataGridViewTextBoxColumn.HeaderText = "Message"; - this.messageDataGridViewTextBoxColumn.MinimumWidth = 6; - this.messageDataGridViewTextBoxColumn.Name = "messageDataGridViewTextBoxColumn"; - this.messageDataGridViewTextBoxColumn.ReadOnly = true; - this.messageDataGridViewTextBoxColumn.Width = 125; + this.openFileDialog1.FileName = "openFileDialog1"; // // MainForm // @@ -417,8 +448,10 @@ this.ClientSize = new System.Drawing.Size(1072, 630); this.Controls.Add(this.gboxFiltri); this.Controls.Add(this.statusStrip1); + this.Controls.Add(this.menuStrip1); this.Controls.Add(this.ErrorsDGV); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.MainMenuStrip = this.menuStrip1; this.Name = "MainForm"; this.Text = "Steamware Elma Log Monitor and Analysis"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); @@ -428,6 +461,8 @@ this.statusStrip1.PerformLayout(); this.gboxFiltri.ResumeLayout(false); this.gboxFiltri.PerformLayout(); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -458,8 +493,6 @@ private System.Windows.Forms.Timer timerUI; private System.Windows.Forms.Timer timerMain; private System.Windows.Forms.Button btnDeleteSel; - private System.Windows.Forms.TextBox txtBaseUrl; - private System.Windows.Forms.Label label1; private System.Windows.Forms.DataGridViewTextBoxColumn sequenceDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn timeUtcDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn hostDataGridViewTextBoxColumn; @@ -470,6 +503,12 @@ private System.Windows.Forms.DataGridViewTextBoxColumn userDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn statusCodeDataGridViewTextBoxColumn; private System.Windows.Forms.DataGridViewTextBoxColumn messageDataGridViewTextBoxColumn; + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem loadToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem currentConfigToolStripMenuItem; + private System.Windows.Forms.OpenFileDialog openFileDialog1; } } diff --git a/ELMA/MainForm.cs b/ELMA/MainForm.cs index 14aa75b..5e93f20 100644 --- a/ELMA/MainForm.cs +++ b/ELMA/MainForm.cs @@ -19,37 +19,36 @@ namespace ELMA { #region setup + ElmahModel model = new ElmahModel(); /// /// Oggetto conf setup /// - protected eSetup stdSetup; + protected eSetup stdSetup = new eSetup(); /// /// Setup file std /// - protected string setupFile = "setup.json"; + protected string setupFile = "curr.cset"; + + protected string confDir + { + get + { + //string basePath = System.Reflection.Assembly.GetExecutingAssembly().Location; + return $"{Directory.GetCurrentDirectory()}\\CONF\\"; + } + } /// /// Setup configurazione da std file /// private void setupConfig() { - eSetup stdSetup = new eSetup(); // cerco il file json di config - string basePath = Directory.GetCurrentDirectory(); - //string basePath = System.Reflection.Assembly.GetExecutingAssembly().Location; - string filePath = $"{basePath}\\CONF\\{setupFile}"; - if (File.Exists(filePath)) - { - try - { - stdSetup = JsonConvert.DeserializeObject(File.ReadAllText(filePath)); - } - catch - { } - } - if(string.IsNullOrEmpty(stdSetup.name)) + string filePath = $"{confDir}\\{setupFile}"; + loadConf(filePath); + if (string.IsNullOrEmpty(stdSetup.name)) { // se non lo trovo creo setu... stdSetup = new eSetup() @@ -59,9 +58,70 @@ namespace ELMA appBasePath = "/LM/W3SVC/1/ROOT", baseUrl = "https://localhost:44388" }; - // .. e lo salvo... - string rawData = JsonConvert.SerializeObject(stdSetup,Formatting.Indented); - File.WriteAllText(filePath, rawData); + saveConf(filePath); + } + } + /// + /// Carica la conf corrente + /// + /// + private void loadConf(string filePath) + { + if (File.Exists(filePath)) + { + try + { + stdSetup = JsonConvert.DeserializeObject(File.ReadAllText(filePath)); + } + catch + { } + } + } + + /// + /// Salva conf corrente sul file indicato + /// + /// + private void saveConf(string filePath) + { + // .. e lo salvo... + string rawData = JsonConvert.SerializeObject(stdSetup, Formatting.Indented); + File.WriteAllText(filePath, rawData); + } + + private void currentConfigToolStripMenuItem_Click(object sender, EventArgs e) + { + + } + + private void loadToolStripMenuItem_Click(object sender, EventArgs e) + { + // salvo la conf corrente... + OpenFileDialog oFileDialog = new OpenFileDialog(); + oFileDialog.DefaultExt = "jset"; + oFileDialog.Filter = "Conf files (*.jset)|*.jset|All files (*.*)|*.*"; + oFileDialog.InitialDirectory = confDir; + oFileDialog.RestoreDirectory = true; + if (oFileDialog.ShowDialog() == DialogResult.OK) + { + // carico + loadConf(oFileDialog.FileName); + } + } + + private void saveToolStripMenuItem_Click(object sender, EventArgs e) + { + // salvo la conf corrente... + SaveFileDialog sFileDialog = new SaveFileDialog(); + sFileDialog.DefaultExt= "jset"; + sFileDialog.Filter = "Conf files (*.jset)|*.jset|All files (*.*)|*.*"; + sFileDialog.InitialDirectory = confDir; + sFileDialog.RestoreDirectory = true; + if (sFileDialog.ShowDialog() == DialogResult.OK) + { + // salvo! + string rawData = JsonConvert.SerializeObject(stdSetup, Formatting.Indented); + saveConf(sFileDialog.FileName); } } @@ -421,5 +481,6 @@ namespace ELMA } #endregion + } } diff --git a/ELMA/MainForm.resx b/ELMA/MainForm.resx index a56a33e..f93310c 100644 --- a/ELMA/MainForm.resx +++ b/ELMA/MainForm.resx @@ -120,6 +120,9 @@ 17, 17 + + 17, 17 + 113, 17 @@ -129,6 +132,12 @@ 321, 17 + + 428, 17 + + + 543, 17 +