/// <summary> /// Initializes a new instance of the <see cref="TrayWindow"/> class. /// </summary> /// <remarks></remarks> public TrayWindow() { if (LauncherConfigurationHelper.RunOnlyOneInstance) { string runningProcess = Process.GetCurrentProcess().ProcessName; Process[] processes = Process.GetProcessesByName(runningProcess); if (processes.Length > 1) { MessageBox.Show("Application is already running", "Stop", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } } _launcherId = Guid.NewGuid().ToString(); this.ToolTip = "Broobu Boutique"; ShowInTaskbar = false; //WindowState = WindowState.Minimized; Width = 0; Height = 0; this.WindowStyle = WindowStyle.None; this.Left = -1; this.Top = -1; ApplicationHelper.EnableExceptionHandling((nfo) => { IsEnabled = true; _splsh.Close(); }); _splsh.Show(); IsEnabled = false; InitializeComponent(); ni = CreateNotifyIcon(); Closing += (s, e) => AuthenticationHost.TerminateSessionAsync(ShutdownDesktop); // Application.Current.Resources = MobiLauncherThemeHelper.ReadCommonThemes(); App.DoEvents(); _host = new LauncherHost(this); _host.LauncherId = HostApplication.LauncherId; Host.BroadcastReceived += new BroadcastReceivedEventHandler(BroadcastReceived); Host.RequestShellContextReceived += new RequestShellContextReceivedEventHandler(RequestShellContextReceived); Host.UnloadPluginReceived += new UnloadPluginReceivedEventHandler(UnloadPluginReceived); //PluginHost.Current = _host; Loaded += (s, e) => { AppDomain.CurrentDomain.AssemblyLoad += (s1, e1) => { //SetFeedBackText("Iris Desktop is busy.", // String.Format("Loading : {0}", e1.LoadedAssembly.FullName)); }; App.DoEvents(); SetFeedBackText("Iris Desktop is busy.", "Please Wait..."); _host.PreloadAssemblies(); _splsh.Close(); IrisSession.Current = SessionFactory.CreateDefaultIrisSession(); StartSessionAsync(GetBoutiqueUserInfo, LoginCanceled); }; }
/// <summary> /// Initializes a new instance of the <see cref="HostWindow" /> class. /// </summary> public HostWindow() { ApplicationHelper.EnableExceptionHandling((nfo) => { IsEnabled = true; _splash.Close(); }); _splash.Show(); if (LauncherConfigurationHelper.RunOnlyOneInstance) { string runningProcess = Process.GetCurrentProcess().ProcessName; var processes = Process.GetProcessesByName(runningProcess); if (processes.Length > 1) { MessageBox.Show("Broobu Desktop is already running", "Stop", MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } } IsEnabled = false; InitializeComponent(); SizeToContent = SizeToContent.Height; Width = SystemParameters.PrimaryScreenWidth; Closing += (s, e) => AuthenticationHost.TerminateSessionAsync(ShutdownDesktop); AppBar.HostWindow = this; App.DoEvents(); _host = new LauncherHost(this) { LauncherId = HostApplication.LauncherId }; Loaded += (s, e) => { ApplyTheme(LauncherConfigurationHelper.DefaultTheme); SizeToContent = SizeToContent.Height; var measuredHeight = Height; SizeToContent = SizeToContent.Manual; Height = measuredHeight; AppDomain.CurrentDomain.AssemblyLoad += (s1, e1) => SetSplashFeedback(String.Format("Loading : {0}", e1.LoadedAssembly. FullName)); _host.PreloadAssemblies(); Thread.Sleep(5000); _splash.Close(); IrisSession.Current = SessionFactory.CreateDefaultIrisSession(); App.DoEvents(); StartSessionAsync(GetBoutiqueUserInfo); }; }