private void TcTasks_OnTelemetryChanging(object sender, TelemetryControl.TelemetryEventArgs e) { var telemetry = (TelemetryTask)e.Telemetry; if (e.Enabled) { var result = NvidiaController.EnableTelemetryTask(telemetry); if (result.Error != null) { e.Cancel = true; } Logging.GetFileLogger().Log(Level.Info, result.Error != null ? $"{Properties.Resources.Failed_to_enable_task}: {result.Item.Task.Path}" : $"{Properties.Resources.Task_enabled}: {result.Item.Task.Path}"); } else { var result = NvidiaController.DisableTelemetryTask(telemetry); if (result.Error != null) { e.Cancel = true; } Logging.GetFileLogger().Log(Level.Info, result.Error != null ? $"{Properties.Resources.Failed_to_disable_task}: {result.Item.Task.Path}" : $"{Properties.Resources.Task_disabled}: {result.Item.Task.Path}"); } }
private void tcTasks_DefaultClicked(object sender, EventArgs e) { tcTasks.Reset(); foreach (var item in _telemetryTasks) { var result = NvidiaController.EnableTelemetryTask(item); Logging.GetFileLogger().Log(Level.Info, result.Error != null ? $"{Properties.Resources.Failed_to_enable_task}: {result.Item.Task.Path}" : $"{Properties.Resources.Task_enabled}: {result.Item.Task.Path}"); } foreach (var item in _telemetryKeys) { var result = NvidiaController.EnableTelemetryRegistryItem(item); Logging.GetFileLogger().Log(Level.Info, result.Error != null ? $"{Properties.Resources.Failed_to_enable_registry_item}: {result.Item.Name}" : $"{Properties.Resources.Registry_item_enabled}: {result.Item.Name}"); } RefreshTelemetryTasks(false); }