public void OnHelpRequested(EventArgs e) { if (_shellModuleService.ActiveModule == _module) { EventHandler <HelpRequestedEventArgs> temp = HelpRequested; ShellConfigurationSection config = ConfigurationManager.GetSection(ShellConfigurationSection.SectionKey) as ShellConfigurationSection; HelpRequestedEventArgs args = new HelpRequestedEventArgs(); args.HelpBaseUri = config.HelpBaseUri; if (temp != null) { temp(this, args); } else { args.Cancel = true; } if (args.Cancel) { IMessageBoxView messageBoxView = _workItem.SmartParts.AddNew <MessageBoxView>(); messageBoxView.Show(_shellView.Model.Module.Title, StringResources.No_Help_Message, null, Infrastructure.MessageBoxButton.Ok, Infrastructure.MessageBoxImage.Information); } } }
protected void AddServices() { _userSessionService = new UserSessionService(); if (ApplicationDeployment.IsNetworkDeployed) { _userSessionService.ActivationUri = ApplicationDeployment.CurrentDeployment.ActivationUri; NameValueCollection args = HttpUtility.ParseQueryString(_userSessionService.ActivationUri.Query); _userSessionService.InstanceName = args["instance"]; _userSessionService.HostName = args["HostServerName"]; _userSessionService.HostPort = Convert.ToInt32(args["HostPort"]); _userSessionService.CurrentVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion; } else { ShellConfigurationSection config = ConfigurationManager.GetSection(ShellConfigurationSection.SectionKey) as ShellConfigurationSection; _userSessionService.InstanceName = config.InstanceNameLocalInstall; _userSessionService.HostName = config.HostName; _userSessionService.HostPort = config.HostPort; _userSessionService.CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version; } _userSessionService.TerminalId = Environment.MachineName; _hyperlinkService = new HyperlinkService(_userSessionService); }
public ShellModuleService([ServiceDependency] IFavoritesService favoritesService, [ServiceDependency] IAuthorizationService authorizationService, [ServiceDependency] IUserSessionService userSessionService) { _modelDictionary = new Dictionary <IShellModule, IShellPresentationModel>(); _workItemDictionary = new Dictionary <IShellModule, WorkItem>(); _config = ConfigurationManager.GetSection(ShellConfigurationSection.SectionKey) as ShellConfigurationSection; _favoritesService = favoritesService; _authorizationService = authorizationService; _userSessionService = userSessionService; }
public void Start() { if (_serviceHost != null) { Stop(); } _serviceHost = new ServiceHost(this, new Uri(string.Format("net.pipe://localhost/{0}", Process.GetCurrentProcess().Id.ToString()))); _serviceHost.AddServiceEndpoint(typeof(IHyperlinkService), new NetNamedPipeBinding(), typeof(HyperlinkService).Name); _serviceHost.Open(); try { ShellConfigurationSection config = ConfigurationManager.GetSection(ShellConfigurationSection.SectionKey) as ShellConfigurationSection; string uri = string.Format("http://localhost{0}/IMI/SupplyChain/SmartClientKickStart/", string.IsNullOrEmpty(config.HttpListenerPort) ? string.Empty : ":" + config.HttpListenerPort); _httpListener = new HttpListener(); _httpListener.Prefixes.Add(uri); _httpListener.Start(); _httpListener.BeginGetContext(new AsyncCallback(HttpListenerCallback), null); } catch { try { if (_httpListener != null) { try { _httpListener.Stop(); _httpListener.Close(); } catch { } finally { _httpListener.Abort(); } } } finally { _httpListener = null; } } }
public static ThemeSettings GetDefaultThemeSettings() { ShellConfigurationSection config = ConfigurationManager.GetSection(ShellConfigurationSection.SectionKey) as ShellConfigurationSection; ThemeSettings themeSettings = new ThemeSettings(); themeSettings.ThemeName = config.ThemeName; themeSettings.IsGlassEnabled = config.IsGlassEnabled; if (!string.IsNullOrEmpty(config.ThemeTintColor)) { themeSettings.TintColor = (Color)ColorConverter.ConvertFromString(config.ThemeTintColor); } return(themeSettings); }
public static TService CreateInstance <TService>(params object[] list) where TService : class { ShellConfigurationSection settings = ConfigurationManager.GetSection(ShellConfigurationSection.SectionKey) as ShellConfigurationSection; foreach (ServiceElement element in settings.ServiceElementCollection) { if (element.ServiceType == typeof(TService)) { return(Activator.CreateInstance(element.InstanceType, list) as TService); } } throw new ServiceMissingException(typeof(TService)); }
public LoginPresenter() { _config = ConfigurationManager.GetSection(ShellConfigurationSection.SectionKey) as ShellConfigurationSection; }