private void ListBox1_SelectedIndexChanged(object sender, EventArgs e) { if (listBox1.SelectedIndex < 0) { return; } SelectedDevicePath = displays.ToList()[listBox1.SelectedIndex].Key; var display = DisplayHelper.LookupFromPath(SelectedDevicePath); if (display == null) { return; } var displayDevice = DisplayHelper.GetMeta(display); label9.Text = $"PowerPoint is set to show the output on display monitor \'{display.DisplayName}\'\nChanges are applied immediately"; RedrawChecklist(displayDevice); Config.WriteConfig(displayDevice); PowerPointRegistry.ApplyConfig(display.DisplayName); }
private void CheckedListBox1_SelectedIndexChanged(object sender, EventArgs e) { if (isLoading) { return; } if (checkedListBox1.SelectedIndex < 0) { return; } var display = DisplayHelper.LookupFromPath(SelectedDevicePath); if (display == null) { return; } var displayDevice = DisplayHelper.GetMeta(display); RedrawChecklist(displayDevice); Config.WriteConfig(displayDevice); PowerPointRegistry.ApplyConfig(display.DisplayName); }
// Main logic static public ApplyResult Run() { // Load config DisplayMeta res = Config.LoadConfig(); // Scan for the target display (e.g. the projector) to see if it is attached to the machine var display = DisplayHelper.LookupFromMatch(res); if (display == null) { // It's not. return(ApplyResult.Fail_NotDetected); } // Set PowerPoint to use that display using the up-to-date "DisplayName" if (PowerPointRegistry.ApplyConfig(display.DisplayName)) { return(ApplyResult.Success_WriteOK); } else { return(ApplyResult.Success_NoWriteNeeded); } }