Skip to content

Commit

Permalink
Disable other tabs when MLC is running
Browse files Browse the repository at this point in the history
  • Loading branch information
FarisR99 committed Oct 26, 2022
1 parent 3355779 commit c067f2e
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions IMLCGui/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ private void BtnQuickRun_Click(object sender, RoutedEventArgs e)
this.TxtBoxQuickBandwidth.Text = "";
this.TxtBoxQuickLatency.Text = "";
this.BtnQuickRun.Content = "Cancel";
this.ToggleOtherTabs(false);
},
"Running Intel MLC quick test",
() =>
Expand Down Expand Up @@ -222,6 +223,7 @@ private void ResetQuickRunButton()
this.BtnQuickRun.Invoke(() =>
{
this.BtnQuickRun.Content = "Run";
this.ToggleOtherTabs(true);
});
}

Expand Down Expand Up @@ -305,6 +307,7 @@ private void BtnBandwidthRun_Click(object sender, RoutedEventArgs e)
this.TxtBoxBandwidth11.Text = "";
this.TxtBoxBandwidthStreamTriad.Text = "";
this.BtnBandwidthRun.Content = "Cancel";
this.ToggleOtherTabs(false);
},
"Running Intel MLC bandwidth test",
() =>
Expand All @@ -329,6 +332,7 @@ private void ResetBandwidthRunButton()
this.BtnBandwidthRun.Invoke(() =>
{
this.BtnBandwidthRun.Content = "Run";
this.ToggleOtherTabs(true);
});
}

Expand Down Expand Up @@ -456,6 +460,7 @@ private void BtnLatencyRun_Click(object sender, RoutedEventArgs e)
rowLatency.Bandwidth = "";
}
this.BtnLatencyRun.Content = "Cancel";
this.ToggleOtherTabs(false);
},
"Running Intel MLC latency test",
() =>
Expand All @@ -480,6 +485,7 @@ private void ResetLatencyRunButton()
this.BtnLatencyRun.Invoke(() =>
{
this.BtnLatencyRun.Content = "Run";
this.ToggleOtherTabs(true);
});
}

Expand Down Expand Up @@ -602,6 +608,7 @@ private void BtnCacheRun_Click(object sender, RoutedEventArgs e)
this.TxtBoxL2Hit.Text = "";
this.TxtBoxL2HitM.Text = "";
this.BtnCacheRun.Content = "Cancel";
this.ToggleOtherTabs(false);
},
"Running Intel MLC cache test",
() =>
Expand All @@ -626,6 +633,7 @@ private void ResetCacheRunButton()
this.BtnCacheRun.Invoke(() =>
{
this.BtnCacheRun.Content = "Run";
this.ToggleOtherTabs(true);
});
}

Expand Down Expand Up @@ -828,6 +836,7 @@ private void BtnConfigureDownload_Click(object sender, RoutedEventArgs e)
if (!Directory.Exists(mlcWindowsPath))
{
this._logger.Warn($"Failed to locate extracted directory at \"{mlcWindowsPath}\"");
FileUtils.Delete(extractedZipDirectory);
Dispatcher.Invoke(() =>
{
this.WriteToConfigureLog($"Failed to locate MLC at: {mlcWindowsPath}");
Expand Down Expand Up @@ -1055,6 +1064,18 @@ private void TxtConfigurePath_KeyUp(object sender, KeyEventArgs e)
}
}

private void ToggleOtherTabs(bool enabled)
{
for (int tabIndex = 0; tabIndex < this.TabCtrlBenchmark.Items.Count; tabIndex++)
{
if (tabIndex != this.TabCtrlBenchmark.SelectedIndex)
{
MetroTabItem tab = (MetroTabItem)this.TabCtrlBenchmark.Items[tabIndex];
tab.IsEnabled = enabled;
}
}
}

private static string TrimNumericString(string inputString)
{
inputString = inputString.Trim();
Expand Down

0 comments on commit c067f2e

Please sign in to comment.