protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var wnd = new LoadingWindow(); wnd.Show(); this.OnServiceLoaded += (s, _e) => { Dispatcher.BeginInvoke((Action)(() => { wnd.Hide(); new MainWindow().Show(); wnd.Close(); })); }; this.AsyncDispatch(() => { var languageInstance = Lib.Languages.Languages.Instance(); languageInstance.Initialize(); App.ServiceProvider.ScanCurrent(); var settingsProvider = App.ServiceProvider.GetProvider <SettingsProviderService>(); Debug.WriteLine("Currently active Language: " + settingsProvider?.GetConfig <ApplicationSettings>()?.SelectedLanguage.DisplayName); this.OnServiceLoaded?.Invoke(this, new EventArgs()); }).Execute(); Application.Current.Exit += (s, _e) => { App.ServiceProvider.GetProvider <AnimeService>()?.onExit(); }; }
private async void Application_Startup(object sender, StartupEventArgs e) { this.Dispatcher.UnhandledException += DispatcherOnUnhandledException; var loadingWindow = new LoadingWindow(); loadingWindow.Show(null, MiscStrings.CheckingConfiguration, MiscStrings.Initialising); var initResult = await BootStrap.CheckConfigurationAndInit(); _container = initResult.container; if (!initResult.ConfigResult.Success) { MessageBox.Show(string.Join(Environment.NewLine, initResult.ConfigResult.Errors), MiscStrings.LoadErrorCaption); Shutdown(); return; } loadingWindow.SetStatus(MiscStrings.CheckingForNewVersion); var release = await _container.GetInstance <IVersionChecker>().GetLatestVersion(); if (release.NewVersion) { MessageBox.Show(release.Release.ChangeLog, "New version " + release.Release.TagName + " is available!"); } loadingWindow.Hide(); _container.Configure(c => c.For <ILoadingWindow>().Use(loadingWindow).Singleton()); var windowProvider = _container.GetInstance <IWindowProvider>(); windowProvider.CreateWindow <IDeployment>().Show(); }
void Update() { for (int i = m_Requests.Count - 1; i >= 0; i--) { var t_Request = m_Requests[i]; if (t_Request.Request.isDone) { foreach (HTTPCallback t_Callback in t_Request.Callbacks) { t_Callback.Invoke(t_Request.Request); } m_Requests.Remove(t_Request); } } if (HasImportantTask()) { LoadingWindow.Show(); } else { LoadingWindow.Hide(); } }
private void SignIn_Click(object sender, RoutedEventArgs e) { string Login = textBoxLogin.Text; string Password = passwordUserPassword.Password; Connection.Connect(Login, Password); IsEnabled = false; LoadingWindow LoadingWindow = new LoadingWindow { Owner = this, Width = Width - 40, Height = Height - 40 }; LoadingWindow.Show(); Thread ConnectThread = new Thread(() => { if (Configuration.Connect(Login, Password)) { Dispatcher.BeginInvoke(new Action(delegate() { this.Hide(); MainWindow MWindow = new MainWindow(Login, Password); MWindow.Show(); })); } }); ConnectThread.Start(); LoadingWindow.Hide(); IsEnabled = true; }
public void HideWindow() { if (window == null) { return; } window.Hide(); }
public void HideModalLoadingAnimation() { lock (_loadingSyncLock) { if (_loadingCount > 0) { _loadingCount--; } if (_loadingCount == 0) { Window.Dispatcher.InvokeAsync(() => _loadingWindow.Hide()); } } }