Код: Выделить всё
Внутри конструктора .cs моего окна у меня есть следующее:
Код: Выделить всё
public home_page()
{
this.InitializeComponent();
Task.Run(() => { set_enabled_disabled_switch(); });
}
Код: Выделить всё
private async Task set_enabled_disabled_switch()
{
bool is_it_running = await Ipc_handler.send_is_my_app_running_message() ; // Under the covers, this send an IPC pipe message to a back end component, that then returns to tell my GUI app if its running or not. it returns a true or false boolean.
if (is_it_running)
{
Trace.WriteLine("GUI:app is on, so enabling toggle switch", "info");
enable_toggle_button.IsOn = true;
}
else
{
Trace.WriteLine("GUI: App is off, so disabling toggle switch", "info");
enable_toggle_button.IsOn = false;
}
}
Есть идеи, что я делаю неправильно?
Подробнее здесь: https://stackoverflow.com/questions/788 ... ndow-loads