public ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType) { ShellHyperlink hyperlink = new ShellHyperlink(); hyperlink.ModuleId = ModuleController.ModuleId; hyperlink.Data.Add("ProgramType", "trim"); hyperlink.Data.Add("DialogId", ProgramName); hyperlink.Data.Add("DialogDescription", ProgramDescription); hyperlink.Data.Add("Parameters", StartParameters); return(new ShellSmartPartInfo("Title", "Description", hyperlink)); }
public ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType) { ShellHyperlink hyperlink = new ShellHyperlink(); hyperlink.ModuleId = ModuleController.ModuleId; hyperlink.Data.Add("ProgramType", "anywhere"); hyperlink.Data.Add("DialogId", menuId); hyperlink.Data.Add("DialogDescription", menuDescription); hyperlink.Data.Add("Parameters", null); return(new ShellSmartPartInfo("Title", "Description", hyperlink)); }
public ISmartPartInfo GetSmartPartInfo(Type smartPartInfoType) { ShellHyperlink hyperlink = null; if (browser.Source != null) { hyperlink = new ShellHyperlink(); hyperlink.Data["Title"] = _title; hyperlink.ModuleId = DashboardModule.ModuleId; hyperlink.Link = _url; } ShellSmartPartInfo info = new ShellSmartPartInfo(_title, "", hyperlink); return(info); }
public void ExecuteHyperlink(ShellHyperlink hyperlink) { IShellModule module = (from m in _shellModuleService.Modules where m.Id == hyperlink.ModuleId select m).LastOrDefault(); if (module != null) { ShellInteractionService interactionService = _shellModuleService.GetWorkItem(module).Services.Get <IShellInteractionService>() as ShellInteractionService; interactionService.OnHyperlinkExecuted(new HyperlinkExecutedEventArgs(hyperlink)); _shellHyperlink = null; //Clean up saved shellhyperlink from activation uri at application startup, See ShellApplication.cs function AddServices while (_workItem.RootWorkItem.Items.FindByType <ShellHyperlink>().Count > 0) { _workItem.RootWorkItem.Items.Remove(_workItem.RootWorkItem.Items.FindByType <ShellHyperlink>().FirstOrDefault()); } } }
public bool ExecuteHyperlink(Uri hyperlink) { if (hyperlink != null) { ShellHyperlink shellHyperlink = ConvertToShellHyperlink(hyperlink); if (!string.IsNullOrEmpty(shellHyperlink.ModuleId)) { _module = (from m in _shellModuleService.Modules where m.Id == shellHyperlink.Data["ModuleId"] select m).LastOrDefault(); if (_module != null) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { Application.Current.MainWindow.Activate(); if (_shellModuleService.ActiveModule != _module) { _shellHyperlink = shellHyperlink; _shellModuleService.ActiveModule = _module; } else { ExecuteHyperlink(shellHyperlink); } })); return(true); } } } return(false); }
protected override void AddServices() { base.AddServices(); RootWorkItem.Services.Add <IUserSessionService>(_userSessionService); if (_userSessionService.ActivationUri != null) { ShellHyperlink hyperlink = HyperlinkService.ConvertToShellHyperlink(_userSessionService.ActivationUri); if (hyperlink.Data.ContainsKey("ModuleId")) { //Add shellhyperlink to workitem to prevent dialogs being lodad before the module is fully loaded. See NavigationBarView.xaml.cs function NavigationBarSelectionChangedEventHandler //Hyperlink is removed from workitem in HyperlinkService.cs function ExecuteHyperlink(ShellHyperlink hyperlink) RootWorkItem.Items.Add(hyperlink); } } if (string.IsNullOrEmpty(_userSessionService.DomainUser)) { _userSessionService.UserId = string.Format("{0}\\{1}", Environment.UserDomainName, Environment.UserName); } else { _userSessionService.Password = _password; } RootWorkItem.Items.Add(_tokenCache); IChannelFactoryService factoryService = ServiceActivator.CreateInstance <IChannelFactoryService>(_userSessionService, _tokenCache); RootWorkItem.Services.Add <IChannelFactoryService>(factoryService); IAuthorizationService authorizationService = ServiceActivator.CreateInstance <IAuthorizationService>(); RootWorkItem.Services.Add <IAuthorizationService>(authorizationService); IFavoritesService favoritesService = RootWorkItem.Services.AddNew <FavoritesService, IFavoritesService>(); RootWorkItem.Services.AddNew <ShellModuleService, IShellModuleService>(); RootWorkItem.Services.AddNew <FileService, IFileService>(); _settingsService = ServiceActivator.CreateInstance <IUXSettingsService>(ContainerName); RootWorkItem.Services.Add <IUXSettingsService>(_settingsService); RootWorkItem.Services.AddNew <HyperlinkService, IHyperlinkService>(); ThreadPool.QueueUserWorkItem((e) => { try { _settingsService.LoadSettings(); favoritesService.LoadFavorites(); } catch (Exception) { } _settingsLoadedEvent.Set(); }); }