private void logEntryAdded(LogEntry logEntry) { if (tabs.SelectedIndex != 2 && (int)logEntry.Severity >= cbLogLevel.SelectedIndex) { unreadLogs++; logHeader.Text = "Log (" + unreadLogs + ")"; } LogView logView = new LogView(logEntry); logView.checkSeverity(cbLogLevel.SelectedIndex); cbLogLevel.SelectionChanged += logView.LogLevelChanged; LogList.Children.Add(logView); if (cbAutoscrollLog.IsChecked == true) { LogScroller.ScrollToEnd(); } }
private void MainWindow_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { try { Dispatcher.Invoke(() => { switch (e.PropertyName) { case "GPUs": { int n = _ViewModel.GPUs; /*SetGPUs*/ { GPUs.Children.Clear(); for (int i = 0; i < n; i++) { Label Lb = new Label { Height = 26, HorizontalContentAlignment = HorizontalAlignment.Center, VerticalContentAlignment = VerticalAlignment.Center, FontFamily = new FontFamily("Consolas"), FontSize = 14, Content = $"GPU{i}" }; GPUs.Children.Add(Lb); } } SetTextBoxes(PowerLimits, "PowerLimits", n); SetLabels(InfPowerLimits, "InfPowerLimits", PLsLengthA, PLsLengthB, n); SetLengths(ArrPowerLimits, PLsLengthA, PLsLengthB); SetTextBoxes(CoreClocks, "CoreClocks", n); SetLabels(InfCoreClocks, "InfCoreClocks", CoresLengthA, CoresLengthB, n); SetLengths(ArrCoreClocks, CoresLengthA, CoresLengthB); SetLabels(InfOHMCoreClocks, "InfOHMCoreClocks", null, null, n); SetTextBoxes(MemoryClocks, "MemoryClocks", n); SetLabels(InfMemoryClocks, "InfMemoryClocks", MemorysLengthA, MemorysLengthB, n); SetLengths(ArrMemoryClocks, MemorysLengthA, MemorysLengthB); SetLabels(InfOHMMemoryClocks, "InfOHMMemoryClocks", null, null, n); SetTextBoxes(FanSpeeds, "FanSpeeds", n); SetLabels(InfoFanSpeeds, "InfFanSpeeds", FansLengthA, FansLengthB, n); SetLengths(ArrFanSpeeds, FansLengthA, FansLengthB); SetLabels(InfTemps, "InfTemperatures", TempsLengthA, TempsLengthB, n); SetLengths(ArrTemperatures, TempsLengthA, TempsLengthB); SetLabels(InfHashrates, "InfHashrates", HashesLengthA, HashesLengthB, n, "0.00"); SetLengths(ArrHashrates, HashesLengthA, HashesLengthB); SetLabels(LogTemperatures, "InfTemperatures", n, "0°C"); SetLabels(LogHashrates, "InfHashrates", n, "0.00"); } break; case "Indication": OMGworking = _ViewModel.Indication; break; case "Log": if (_ViewModel.LogAutoscroll) { LogScroller.ScrollToEnd(); } break; case "InfPowerLimits": { if (ArrPowerLimits != _ViewModel.InfPowerLimits) { ArrPowerLimits = _ViewModel.InfPowerLimits; SetLengths(ArrPowerLimits, PLsLengthA, PLsLengthB); } } break; case "InfCoreClocks": { if (ArrCoreClocks != _ViewModel.InfCoreClocks) { ArrCoreClocks = _ViewModel.InfCoreClocks; SetLengths(ArrCoreClocks, CoresLengthA, CoresLengthB); } } break; case "InfOHMCoreClocks": { if (ArrOHMCoreClocks != _ViewModel.InfOHMCoreClocks) { ArrOHMCoreClocks = _ViewModel.InfOHMCoreClocks; } } break; case "InfOHMMemoryClocks": { if (ArrOHMMemoryClocks != _ViewModel.InfOHMMemoryClocks) { ArrOHMMemoryClocks = _ViewModel.InfOHMMemoryClocks; } } break; case "InfMemoryClocks": { if (ArrMemoryClocks != _ViewModel.InfMemoryClocks) { ArrMemoryClocks = _ViewModel.InfMemoryClocks; SetLengths(ArrMemoryClocks, MemorysLengthA, MemorysLengthB); } } break; case "InfFanSpeeds": { if (ArrFanSpeeds != _ViewModel.InfFanSpeeds) { ArrFanSpeeds = _ViewModel.InfFanSpeeds; SetLengths(ArrFanSpeeds, FansLengthA, FansLengthB); } } break; case "InfTemperatures": { if (ArrTemperatures != _ViewModel.InfTemperatures) { ArrTemperatures = _ViewModel.InfTemperatures; SetLengths(ArrTemperatures, TempsLengthA, TempsLengthB); } } break; case "InfHashrates": { if (ArrHashrates != _ViewModel.InfHashrates) { ArrHashrates = _ViewModel.InfHashrates; SetLengths(ArrHashrates, HashesLengthA, HashesLengthB); } } break; } }); } catch { } }
/// <summary> /// Writes the input string to the combat log /// </summary> /// <param name="message">The string to be written</param> private void WriteLog(string message) { Log.Log(message); LogScroller.ScrollToEnd(); }