Ejemplo n.º 1
0
        /// <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);
            };
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Mis the logon click.
 /// </summary>
 public void LogonLogoff()
 {
     if (IrisSession.Current.IsDefaultSession)
     {
         StartSessionAsync(GetBoutiqueUserInfo);
     }
     else
     {
         AuthenticationHost.TerminateSessionAsync(OnTerminateSessionCompleted);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Handles the Click event of the miLogon control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 /// <remarks></remarks>
 void miLogon_Click(object sender, EventArgs e)
 {
     if (IrisSession.Current.IsDefaultSession)
     {
         StartSessionAsync(GetBoutiqueUserInfo, LoginCanceled);
     }
     else
     {
         AuthenticationHost.TerminateSessionAsync(OnTerminateSessionCompleted);
     }
 }
Ejemplo n.º 4
0
 public void LogonLogoff()
 {
     if (WulkaSession.Current.IsDefaultSession)
     {
         AuthenticationHost.StartSessionAsync(GetUserEnvironmentInfo);
     }
     else
     {
         AuthenticationHost.TerminateSessionAsync(OnTerminateSessionCompleted);
     }
 }
Ejemplo n.º 5
0
        /// <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);
            };
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles the Click event of the miExit control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks></remarks>
        void miExit_Click(object sender, EventArgs e)
        {
            bool close = true;

            if (_host.HasRunningApplications)
            {
                close = false;
                MessageBoxResult result = MessageBox.Show(
                    "Broobu Boutique and all applications will be closed. All unsaved data will be lost. Are u sure?",
                    "Warning", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    close = true;
                }
            }
            if (close)
            {
                AuthenticationHost.TerminateSessionAsync(ShutdownDesktop);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Bis the exit click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="ItemClickEventArgs"/> instance containing the event data.</param>
 private void BiExitClick(object sender, ItemClickEventArgs e)
 {
     AuthenticationHost.TerminateSessionAsync(ShutdownDesktop);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Logons the guest.
 /// </summary>
 private void LogonGuest()
 {
     WulkaSession.Current     = SessionFactory.CreateDefaultWulkaSession();
     WulkaCredentials.Current = WulkaSession.Current.Credentials;
     AuthenticationHost.TerminateSessionAsync(GetUserEnvironmentInfo);
 }
Ejemplo n.º 9
0
 public void Exit()
 {
     AuthenticationHost.WaitInfo = new ShuttingDownWaitInfo();
     AuthenticationHost.TerminateSessionAsync(ShutdownDesktop);
 }