Improve handling of SharedData

This commit is contained in:
Kamil Trzciński 2022-11-16 12:32:09 +01:00
parent 0b86664002
commit 092f96a9ab
3 changed files with 5 additions and 5 deletions

View file

@ -29,6 +29,7 @@ namespace FanControl
public FanControlForm()
{
InitializeComponent();
SharedData_Update();
Text += " v" + Application.ProductVersion.ToString();
Instance.Open(Text, "Global\\FanControlOnce");

View file

@ -37,7 +37,8 @@ namespace PerformanceOverlay
public Controller()
{
contextMenu = new System.Windows.Forms.ContextMenuStrip(components);
SharedData_Update();
Instance.Open(TitleWithVersion, "Global\\PerformanceOverlay");
showItem = new ToolStripMenuItem("&Show OSD");

View file

@ -126,8 +126,6 @@ namespace PowerControl
if (ActiveOption == null)
ActiveOption = Options.First();
if (SelectedOption == null)
SelectedOption = ActiveOption;
onUpdateToolStrip();
}
@ -171,7 +169,7 @@ namespace PowerControl
return;
foreach (ToolStripMenuItem item in toolStripItem.DropDownItems)
item.Checked = (item.Tag.ToString() == SelectedOption.ToString());
item.Checked = Object.Equals(item.Tag, SelectedOption ?? ActiveOption);
toolStripItem.Visible = Visible && Options.Count > 0;
}
@ -254,7 +252,7 @@ namespace PowerControl
else
output += Color(Name + ":", Colors.Blue).PadRight(30);
output += optionText(SelectedOption);
output += optionText(SelectedOption ?? ActiveOption);
if (!Object.Equals(ActiveOption, SelectedOption))
output += " (active: " + optionText(ActiveOption) + ")";