public ActivationService(IShellWindow shellWindow, ActivationHandler <LaunchActivatedEventArgs> defaultHandler, IEnumerable <IActivationHandler> activationHandlers, INavigationService navigationService) { App.CurrentWindow = shellWindow as Window; _defaultHandler = defaultHandler; _activationHandlers = activationHandlers; _navigationService = navigationService; }
public async Task StartAsync() { // Initialize services that you need before app activation await InitializeAsync(); _identityService.InitializeWithAadAndPersonalMsAccounts(_config.IdentityClientId, "http://localhost"); var silentLoginSuccess = await _identityService.AcquireTokenSilentAsync(); if (!silentLoginSuccess || !_identityService.IsAuthorized()) { _logInWindow = SimpleIoc.Default.GetInstance <ILogInWindow>(); _logInWindow.ShowWindow(); await StartupAsync(); return; } _shellWindow = SimpleIoc.Default.GetInstance <IShellWindow>(); _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); // Tasks after activation await StartupAsync(); }
public async Task StartAsync(CancellationToken cancellationToken) { // Initialize services that you need before app activation await InitializeAsync(); // https://aka.ms/msal-net-token-cache-serialization // this generates a file-system safe directory name to stick the cache in - or use something like Resources.AppDisplayName // should also consider this root dir for other configuration data var safeAppDirectoryName = System.IO.Path.GetInvalidFileNameChars().Aggregate(typeof(App).Assembly.GetName().Name, (current, c) => current.Replace(c, '-')); var rootCacheDirectory = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), safeAppDirectoryName, _config.IdentityCacheDirectoryName); var storageCreationProperties = new StorageCreationPropertiesBuilder(_config.IdentityCacheFileName, rootCacheDirectory, _config.IdentityClientId).Build(); var cacheHelper = await MsalCacheHelper.CreateAsync(storageCreationProperties).ConfigureAwait(false); _identityService.InitializeWithAadAndPersonalMsAccounts(_config.IdentityClientId, "http://localhost", cacheHelper); var silentLoginSuccess = await _identityService.AcquireTokenSilentAsync(); if (!silentLoginSuccess || !_identityService.IsAuthorized()) { _logInWindow = _serviceProvider.GetService(typeof(ILogInWindow)) as ILogInWindow; _logInWindow.ShowWindow(); await StartupAsync(); return; } _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); // Tasks after activation await StartupAsync(); }
//^^ //{[{ private void OnLoggedIn(object sender, EventArgs e) { _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(Param_HomeNameViewModel).FullName); _logInWindow.CloseWindow(); }
public ActivationService(IShellWindow shellWindow, ActivationHandler <LaunchActivatedEventArgs> defaultHandler, IEnumerable <IActivationHandler> activationHandlers, INavigationService navigationService, IThemeSelectorService themeSelectorService) { App.MainWindow = shellWindow as Window; _defaultHandler = defaultHandler; _activationHandlers = activationHandlers; _navigationService = navigationService; _themeSelectorService = themeSelectorService; }
private void OnLoggedIn(object sender, EventArgs e) { _shellWindow = SimpleIoc.Default.GetInstance <IShellWindow>(Guid.NewGuid().ToString()); _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); _logInWindow.CloseWindow(); _logInWindow = null; }
private async Task HandleActivationAsync() { if (App.Current.Windows.OfType <IShellWindow>().Count() == 0) { // Default activation that navigates to the apps default page shellWindow = serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; shellWindow.ShowWindow(); await Task.CompletedTask; } }
public NavigationManager(IContainer container, IMessanger messanger, IRegionManager regionManager, IShellWindow shell, ILog loger, IMenuService menuService, IRegionNavigationJournal regionNavigationJournal) { this.menuService = menuService; this.loger = loger; this.container = container; this.shell = shell; this.messanger = messanger; this.regionManager = regionManager; this.regionNavigationJournal = regionNavigationJournal; subscription = messanger.Subscribe <NavigationRequest>(OnMessageArrived); }
private async Task HandleActivationAsync() { if (App.Current.Windows.OfType <IShellWindow>().Count() == 0) { // Default activation that navigates to the apps default page _shellWindow = SimpleIoc.Default.GetInstance <IShellWindow>(Guid.NewGuid().ToString()); _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); await Task.CompletedTask; } }
private async Task HandleActivationAsync() { if (App.Current.Windows.OfType <IShellWindow>().Count() == 0) { // Default activation that navigates to the apps default page _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(GucklochViewModel).FullName); await Task.CompletedTask; } }
public async Task StartAsync(CancellationToken cancellationToken) { // Initialize services that you need before app activation await InitializeAsync(); _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); // Tasks after activation await StartupAsync(); }
public async Task StartAsync() { // Initialize services that you need before app activation await InitializeAsync(); _shellWindow = SimpleIoc.Default.GetInstance <IShellWindow>(); _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); // Tasks after activation await StartupAsync(); }
public ActivationService(IShellWindow shellWindow, ActivationHandler <LaunchActivatedEventArgs> defaultHandler, IEnumerable <IActivationHandler> activationHandlers, INavigationService navigationService, IThemeSelectorService themeSelectorService, ILanguageSelectorService languageSelectorService, ISettingsService settingsService) { App.MainWindow = shellWindow as Window; this.defaultHandler = defaultHandler; this.activationHandlers = activationHandlers; this.navigationService = navigationService; this.themeSelectorService = themeSelectorService; this.languageSelectorService = languageSelectorService; this.settingsService = settingsService; }
public async Task StartAsync(CancellationToken cancellationToken) { // Initialize services that you need before app activation await InitializeAsync(); _identityService.InitializeWithAadAndPersonalMsAccounts(_config.IdentityClientId, "http://localhost"); await _identityService.AcquireTokenSilentAsync(); _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); // Tasks after activation await StartupAsync(); }
private async Task HandleActivationAsync() { if (!Application.Current.Windows.OfType <IShellWindow>().Any()) { // Default activation that navigates to the apps default page _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; if (_shellWindow != null) { _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); } _navigationService.NavigateTo(typeof(SimulatorPage)); await Task.CompletedTask; } }
private async Task HandleActivationAsync() { var activationHandler = _activationHandlers .FirstOrDefault(h => h.CanHandle()); if (activationHandler != null) { await activationHandler.HandleAsync(); } if (App.Current.Windows.OfType <IShellWindow>().Count() == 0) { // Default activation _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); } }
public async Task StartAsync(CancellationToken cancellationToken) { // Initialize services that you need before app activation await InitializeAsync(); // https://aka.ms/msal-net-token-cache-serialization var storageCreationProperties = new StorageCreationPropertiesBuilder(_config.IdentityCacheFileName, _config.IdentityCacheDirectoryName, _config.IdentityClientId).Build(); var cacheHelper = await MsalCacheHelper.CreateAsync(storageCreationProperties).ConfigureAwait(false); _identityService.InitializeWithAadAndPersonalMsAccounts(_config.IdentityClientId, "http://localhost", cacheHelper); await _identityService.AcquireTokenSilentAsync(); _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); // Tasks after activation await StartupAsync(); }
private async Task HandleActivationAsync() { var activationHandler = SimpleIoc.Default.GetAllInstances <IActivationHandler>() .FirstOrDefault(h => h.CanHandle()); if (activationHandler != null) { await activationHandler.HandleAsync(); } await Task.CompletedTask; if (App.Current.Windows.OfType <IShellWindow>().Count() == 0) { // Default activation _shellWindow = SimpleIoc.Default.GetInstance <IShellWindow>(); _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(MainViewModel).FullName); } }
private async Task HandleActivationAsync() { var activationHandler = _activationHandlers.FirstOrDefault(h => h.CanHandle()); if (activationHandler != null) { await activationHandler.HandleAsync(); } await Task.CompletedTask; if (App.Current.Windows.OfType <IShellWindow>().Count() == 0) { // Default activation that navigates to the apps default page _shellWindow = _serviceProvider.GetService(typeof(IShellWindow)) as IShellWindow; _navigationService.Initialize(_shellWindow.GetNavigationFrame()); _shellWindow.ShowWindow(); _navigationService.NavigateTo(typeof(Param_HomeNamePage)); await Task.CompletedTask; } }
public ApplicationHostService(INavigationService navigationService, IShellWindow shellWindow) { _navigationService = navigationService; _shellWindow = shellWindow; _navigationService.Initialize(_shellWindow.GetNavigationFrame()); }
/// <summary> /// Method responsible for initializing shell /// </summary> protected virtual void InitialiseShell() { PublishSystemMessage("Going to init shell window"); log.Debug("about initializing shell"); PublishSystemMessage("post initialization has been completed"); var regionManager = Container.Resolve <IRegionManager>(); PublishSystemMessage("Going to setup regions on shell window"); if (Container.IsTypeRegistered <ICommandsViewModel>()) { log.Info("registering CommandRegion in shell"); regionManager.RegisterViewWithRegion(ShellRegionNames.CommandRegion, Container.Resolve <ICommandsViewModel>); } if (Container.IsTypeRegistered <IStatusViewModel>()) { log.Info("registering StatusRegion in shell"); regionManager.RegisterViewWithRegion(ShellRegionNames.StatusRegion, Container.Resolve <IStatusViewModel>); } PublishSystemMessage("regions has been registerd"); Bootstrapper.RegisterShell(Container); PublishSystemMessage("Going to register shell window"); Container.RegisterTypeIfMissing <IShellWindow, ShellWindow>(LifetimeScope.Singleton); shellWindow = Container.Resolve <IShellWindow>(); PublishSystemMessage("Going to configure shell window"); Bootstrapper.ConfigureShell(Container, shellWindow); PublishSystemMessage("Going to post init application"); Bootstrapper.PostConfiguration(Container, Messanger); var shell = shellWindow as Window; if (shell != null) { log.Info("going to register shell view to shell window"); shell.DataContext = Container.Resolve <IShellViewModel>(); var regionCfg = Container.Resolve <IRegionConfigurator>(); log.Info("going to configure and register regions"); regionCfg.ConfigureRegions(); regionCfg.InitializeShell(shell, regionManager); Container.RegisterTypeIfMissing <INavigationManager, NavigationManager>(LifetimeScope.Singleton); if (Container.IsTypeRegistered <INavigationManager>()) { var navManager = Container.Resolve <INavigationManager>(); } shell.Closing += (s, e) => { }; if (Application.Current != null) { PublishSystemMessage("Going to register main window"); Application.Current.MainWindow = shell; } } PublishSystemMessage("Going to show shell"); shellWindow.Show(); if (shell != null) { shell.Activate(); } }
/// <summary> /// Method which is responsible for configuring shell window /// </summary> /// <param name="container">the container</param> /// <param name="shellWindow">shell window</param> public virtual void ConfigureShell(IContainer container, IShellWindow shellWindow) { }