Untitled
unknown
csharp
a year ago
724 B
9
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