Beispiel #1
0
        private void StartNewEventSession()
        {
            try
            {
                Logging(string.Format("::StartNewEventSession() - вход..."));

                base.Closing += delegate(object sender, System.ComponentModel.CancelEventArgs args)
                {
                    if ((App.IsAssemblyRelease(Assembly.GetAssembly(this.GetType())) == false) ||
                        (this.isNormalShutdownMode == true))
                    {
                        args.Cancel = false;

                        foreach (BrowserLauncherView view in _dictBrowserLauncherView.Values)
                        {
                            view.Closing -= new CancelEventHandler(closingViewer <BrowserLauncherView>);
                            view.Close();
                        }
                        _dictBrowserLauncherView.Clear();

                        foreach (BrandLauncherView view in _dictBrandLauncherView.Values)
                        {
                            view.Closing -= new CancelEventHandler(closingViewer <BrandLauncherView>);
                            view.Close();
                        }
                        _dictBrandLauncherView.Clear();

                        MainWindow.FreeOccupiedAccount();
                    }
                    else
                    {
                        args.Cancel = true;

                        base.WindowState   = WindowState.Minimized;
                        base.ShowInTaskbar = true;

                        if (this.currentBrandLauncher != null)
                        {
                            this.currentBrandLauncher.Visibility = Visibility.Hidden;
                        }
                        else
                        {
                            ;
                        }
                    }
                };

                base.StateChanged += delegate //(object sender, System.EventArgs args)
                {
                    try
                    {
                        if ((this.currentBrandLauncher != null) &&
                            ((this.currentBrandLauncher == null) ||
                             (this.currentBrandLauncher.Visibility == Visibility.Hidden))
                            )
                        {
                            try
                            {
                                this.currentBrandLauncher.Visibility = Visibility.Visible;
                            }
                            catch (Exception)
                            {
                            }

                            MainWindow.ShowWindow(new WindowInteropHelper(this.currentBrandLauncher).Handle, SwRestore);
                        }
                    }
                    catch (System.Exception ex2)
                    {
                        ErrorLogHelper.AddErrorInLog("StartNewEventSession()", ex2.Message + " | " + ex2.StackTrace);
                        MessageBox.Show(ex2.Message + " | " + ex2.StackTrace);
                    }
                };

                base.LocationChanged += delegate //(object sender, System.EventArgs args)
                {
                    if (this.DownFlag)
                    {
                        this.currentBrandLauncher.Top  = base.Top + base.Height;
                        this.currentBrandLauncher.Left = base.Left + this.LeftLength;
                    }

                    if (this.TopFlag)
                    {
                        this.currentBrandLauncher.Top  = base.Top - this.currentBrandLauncher.Height;
                        this.currentBrandLauncher.Left = base.Left + this.LeftLength;
                    }

                    if (this.LeftFlag)
                    {
                        this.currentBrandLauncher.Left = base.Left - this.currentBrandLauncher.Width;
                        this.currentBrandLauncher.Top  = base.Top + this.TopLength;
                    }

                    if (this.RightFlag)
                    {
                        this.currentBrandLauncher.Left = base.Left + base.Width;
                        this.currentBrandLauncher.Top  = base.Top + this.TopLength;
                    }
                };

                Microsoft.Win32.SystemEvents.SessionEnding += delegate(object sender, Microsoft.Win32.SessionEndingEventArgs args)
                {
                    Microsoft.Win32.SessionEndReasons arg_07_0 = args.Reason;
                    MainWindow.FreeOccupiedAccount();
                };

                Logging(string.Format("::StartNewEventSession() - успех..."));
            }
            catch (System.Exception ex)
            {
                ErrorLogHelper.AddErrorInLog("StartNewEventSession()", ex.Message + " | " + ex.StackTrace);
                MessageBox.Show(ex.Message + " | " + ex.StackTrace);
            }
        }
Beispiel #2
0
 private void StartNewEventSession()
 {
     try
     {
         base.Closing += delegate(object sender, System.ComponentModel.CancelEventArgs args)
         {
             if ((!(NewLauncher.App.IsRelease(Assembly.GetAssembly(this.GetType()))) ||
                  (this.isNormalShutdownMode == true)))
             {
                 args.Cancel = false;
             }
             else
             {
                 args.Cancel        = true;
                 base.WindowState   = WindowState.Minimized;
                 base.ShowInTaskbar = true;
                 if (this.brandLauncher != null)
                 {
                     this.brandLauncher.Visibility = Visibility.Hidden;
                 }
             }
         };
         base.StateChanged += delegate //(object sender, System.EventArgs args)
         {
             try
             {
                 if (this.brandLauncher != null && (this.brandLauncher == null || this.brandLauncher.Visibility == Visibility.Hidden))
                 {
                     try
                     {
                         this.brandLauncher.Visibility = Visibility.Visible;
                     }
                     catch (Exception)
                     {
                     }
                     MainWindow.ShowWindow(new WindowInteropHelper(this.brandLauncher).Handle, 9);
                 }
             }
             catch (System.Exception ex2)
             {
                 ErrorLogHelper.AddErrorInLog("StartNewEventSession()", ex2.Message + " | " + ex2.StackTrace);
                 MessageBox.Show(ex2.Message + " | " + ex2.StackTrace);
             }
         };
         base.LocationChanged += delegate //(object sender, System.EventArgs args)
         {
             if (this.DownFlag)
             {
                 this.brandLauncher.Top  = base.Top + base.Height;
                 this.brandLauncher.Left = base.Left + this.LeftLength;
             }
             if (this.TopFlag)
             {
                 this.brandLauncher.Top  = base.Top - this.brandLauncher.Height;
                 this.brandLauncher.Left = base.Left + this.LeftLength;
             }
             if (this.LeftFlag)
             {
                 this.brandLauncher.Left = base.Left - this.brandLauncher.Width;
                 this.brandLauncher.Top  = base.Top + this.TopLength;
             }
             if (this.RightFlag)
             {
                 this.brandLauncher.Left = base.Left + base.Width;
                 this.brandLauncher.Top  = base.Top + this.TopLength;
             }
         };
         Microsoft.Win32.SystemEvents.SessionEnding += delegate(object sender, Microsoft.Win32.SessionEndingEventArgs args)
         {
             Microsoft.Win32.SessionEndReasons arg_07_0 = args.Reason;
             MainWindow.FreeOccupiedAccount();
         };
     }
     catch (System.Exception ex)
     {
         ErrorLogHelper.AddErrorInLog("StartNewEventSession()", ex.Message + " | " + ex.StackTrace);
         MessageBox.Show(ex.Message + " | " + ex.StackTrace);
     }
 }