From 80f683bed16876a5f0fb9809987cde37e8899654 Mon Sep 17 00:00:00 2001 From: gobbo1008 Date: Mon, 9 Oct 2017 00:14:26 +0200 Subject: [PATCH] Scroll bar for main panel The main panel was missing a scroll bar. Now it has one. Also played around with the ResearchItem to make multiple triggers less likely. I hope. --- ESOResearchNotifier/Form1.Designer.cs | 71 ++++++++++++++------------- ESOResearchNotifier/ResearchItem.cs | 17 +++---- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/ESOResearchNotifier/Form1.Designer.cs b/ESOResearchNotifier/Form1.Designer.cs index 710803e..fa7cd92 100644 --- a/ESOResearchNotifier/Form1.Designer.cs +++ b/ESOResearchNotifier/Form1.Designer.cs @@ -37,6 +37,7 @@ private void InitializeComponent() this.menuItemMute = new System.Windows.Forms.ToolStripMenuItem(); this.menuItemExit = new System.Windows.Forms.ToolStripMenuItem(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.treeView1 = new ESOResearchNotifier.FixedTreeView(); this.cboNotifyStyle = new System.Windows.Forms.ComboBox(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.cboTimeout = new System.Windows.Forms.ComboBox(); @@ -48,13 +49,12 @@ private void InitializeComponent() this.linkLabel2 = new System.Windows.Forms.LinkLabel(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.btnSortDefault = new System.Windows.Forms.Button(); + this.btnSortName = new System.Windows.Forms.Button(); this.btnSortTime = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.lblDone = new System.Windows.Forms.Label(); this.lblName = new System.Windows.Forms.Label(); - this.btnSortName = new System.Windows.Forms.Button(); - this.btnSortDefault = new System.Windows.Forms.Button(); - this.treeView1 = new ESOResearchNotifier.FixedTreeView(); ((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher1)).BeginInit(); this.notifyMenuStrip1.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -126,6 +126,18 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Characters"; // + // treeView1 + // + this.treeView1.CheckBoxes = true; + this.treeView1.Location = new System.Drawing.Point(9, 19); + this.treeView1.Name = "treeView1"; + this.treeView1.Size = new System.Drawing.Size(245, 270); + this.treeView1.TabIndex = 21; + this.toolTip1.SetToolTip(this.treeView1, "Select the characters you want to track here. If an account or character does not" + + " show up here, make sure to log in with that character whilst running the Resear" + + "chDump addon at least once."); + this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck); + // // cboNotifyStyle // this.cboNotifyStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -212,6 +224,7 @@ private void InitializeComponent() this.panelResearch.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.panelResearch.AutoScroll = true; this.panelResearch.Location = new System.Drawing.Point(6, 45); this.panelResearch.Name = "panelResearch"; this.panelResearch.Size = new System.Drawing.Size(655, 413); @@ -245,6 +258,26 @@ private void InitializeComponent() this.groupBox3.TabStop = false; this.groupBox3.Text = "Research"; // + // btnSortDefault + // + this.btnSortDefault.Location = new System.Drawing.Point(581, 17); + this.btnSortDefault.Name = "btnSortDefault"; + this.btnSortDefault.Size = new System.Drawing.Size(80, 23); + this.btnSortDefault.TabIndex = 6; + this.btnSortDefault.Text = "Reset Sorting"; + this.btnSortDefault.UseVisualStyleBackColor = true; + this.btnSortDefault.Click += new System.EventHandler(this.btnSortDefault_Click); + // + // btnSortName + // + this.btnSortName.Location = new System.Drawing.Point(138, 17); + this.btnSortName.Name = "btnSortName"; + this.btnSortName.Size = new System.Drawing.Size(39, 23); + this.btnSortName.TabIndex = 2; + this.btnSortName.Text = "Sort"; + this.btnSortName.UseVisualStyleBackColor = true; + this.btnSortName.Click += new System.EventHandler(this.btnSortName_Click); + // // btnSortTime // this.btnSortTime.Location = new System.Drawing.Point(363, 17); @@ -282,38 +315,6 @@ private void InitializeComponent() this.lblName.TabIndex = 1; this.lblName.Text = "Character and Item"; // - // btnSortName - // - this.btnSortName.Location = new System.Drawing.Point(138, 17); - this.btnSortName.Name = "btnSortName"; - this.btnSortName.Size = new System.Drawing.Size(39, 23); - this.btnSortName.TabIndex = 2; - this.btnSortName.Text = "Sort"; - this.btnSortName.UseVisualStyleBackColor = true; - this.btnSortName.Click += new System.EventHandler(this.btnSortName_Click); - // - // btnSortDefault - // - this.btnSortDefault.Location = new System.Drawing.Point(581, 17); - this.btnSortDefault.Name = "btnSortDefault"; - this.btnSortDefault.Size = new System.Drawing.Size(80, 23); - this.btnSortDefault.TabIndex = 6; - this.btnSortDefault.Text = "Reset Sorting"; - this.btnSortDefault.UseVisualStyleBackColor = true; - this.btnSortDefault.Click += new System.EventHandler(this.btnSortDefault_Click); - // - // treeView1 - // - this.treeView1.CheckBoxes = true; - this.treeView1.Location = new System.Drawing.Point(9, 19); - this.treeView1.Name = "treeView1"; - this.treeView1.Size = new System.Drawing.Size(245, 270); - this.treeView1.TabIndex = 21; - this.toolTip1.SetToolTip(this.treeView1, "Select the characters you want to track here. If an account or character does not" + - " show up here, make sure to log in with that character whilst running the Resear" + - "chDump addon at least once."); - this.treeView1.AfterCheck += new System.Windows.Forms.TreeViewEventHandler(this.treeView1_AfterCheck); - // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/ESOResearchNotifier/ResearchItem.cs b/ESOResearchNotifier/ResearchItem.cs index f0e7fc5..8878cf2 100644 --- a/ESOResearchNotifier/ResearchItem.cs +++ b/ESOResearchNotifier/ResearchItem.cs @@ -67,6 +67,8 @@ public string TraitName } public TimeSpan Duration { get; set; } public DateTime FinishTime { get; set; } + public bool Done = false; + public TimeSpan TimeLeft { @@ -120,19 +122,16 @@ public ResearchItem() public void Setup() { - if (!timerTick.Enabled) - { - timerTick.Start(); - } if (TimeLeft.TotalSeconds <= 0) { - if (this.ResearchDone != null) - { - this.ResearchDone(this, new EventArgs()); - } + Done = true; + ResearchDone?.Invoke(this, new EventArgs()); return; } - //MessageBox.Show(((int)((TimeDone.TotalSeconds / Duration.TotalSeconds) * 100)).ToString()); + if (!timerTick.Enabled && !Done) + { + timerTick.Start(); + } prgTime.Value = (int)((TimeDone.TotalSeconds / Duration.TotalSeconds) * 100); toolTip1.SetToolTip(prgTime, TimeDone.ToString(@"dd\.hh\:mm\:ss") + " of " + Duration.ToString(@"dd\.hh\:mm\:ss") + " done."); SetLabelText();