Untitled
Anonymous
csharp
12/09/2024 7:48 PM
968 B
22
Indexable
// add timer to keep it from crashing when waiting on MainWindow
private void NotifyLoaded(bool loaded)
{
IsModelLoaded = loaded;
var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) };
timer.Tick += (sender, e) =>
{
var mainWindow = Application.Current.MainWindow as MainWindow;
if (mainWindow != null)
{
mainWindow.Dispatcher.BeginInvoke(new Action(() =>
{
if (AppConfig.Current.ToggleState.GlobalActive)
mainWindow.SetActive(loaded);
mainWindow.CallPropertyChanged(nameof(mainWindow.IsModelLoaded));
}));
timer.Stop();
}
};
timer.Start();
}Editor is loading...
Leave a Comment