Skip to content

Commit

Permalink
Object Execution Summary - Compare To : None fix
Browse files Browse the repository at this point in the history
Fix the issue where selecting compare to None doesn't remove the comparison when a custom time comparison is used.
  • Loading branch information
DavidWiseman committed Dec 18, 2023
1 parent 48fbfcc commit 9891245
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions DBADashGUI/Performance/ObjectExecutionSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public string Types
}
}

private int CompareOffset=>int.Parse(SelectedCompareOffsetItem.Tag.ToString() ?? "-1");
private int CompareOffset => int.Parse(SelectedCompareOffsetItem.Tag.ToString() ?? "-1");

private DateTime _compareTo = DateTime.MinValue;
private DateTime _compareFrom = DateTime.MinValue;
private DataTable dt;

private ToolStripMenuItem SelectedCompareOffsetItem => tsCompare.DropDownItems.OfType<ToolStripMenuItem>().FirstOrDefault(mnu => mnu.Checked,tsNoCompare);
private ToolStripMenuItem SelectedCompareOffsetItem => tsCompare.DropDownItems.OfType<ToolStripMenuItem>().FirstOrDefault(mnu => mnu.Checked, tsNoCompare);

private DateTime CompareTo
{
Expand All @@ -79,14 +79,11 @@ private DateTime CompareFrom
return CompareOffset > 0 ? DateRange.FromUTC.AddMinutes(-CompareOffset) :
_compareFrom;
}

}

private bool HasCompare => CompareFrom != DateTime.MinValue && CompareFrom != DateTime.MaxValue &&
CompareTo != DateTime.MinValue && CompareTo != DateTime.MaxValue;



private readonly List<DataGridViewColumn> StandardCols = new()
{
new DataGridViewTextBoxColumn() { Name = "DB", DataPropertyName = "DB",DisplayIndex=0 },
Expand Down Expand Up @@ -200,7 +197,6 @@ public void RefreshData()
RefreshChart((long)dt.Rows[0]["ObjectID"], (string)dt.Rows[0]["ObjectName"]);
}


dgv.Columns.Clear();
dgv.AutoGenerateColumns = false;
tsCompare.Font = new Font(tsCompare.Font, HasCompare ? FontStyle.Bold : FontStyle.Regular);
Expand All @@ -219,8 +215,8 @@ public void RefreshData()
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
status = "Error: " + ex.Message;
}
finally{
finally
{
this.Cursor = Cursors.Default;
}
lblStatus.Text = status;
Expand Down Expand Up @@ -304,6 +300,8 @@ private void TsCopy_Click(object sender, EventArgs e)
private void TsSetOffset_Click(object sender, EventArgs e)
{
CheckCompareOffset((ToolStripMenuItem)sender);
_compareFrom = DateTime.MinValue;
_compareTo = DateTime.MinValue;
RefreshData();
}

Expand Down Expand Up @@ -453,6 +451,5 @@ private void TsCols_Click(object sender, EventArgs e)
dgv.AutoResizeRows();
}
}

}
}

0 comments on commit 9891245

Please sign in to comment.