/// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            //!!!! Return focus to owner form at closing.
            Owner?.Activate();

            base.Dispose(disposing);
        }
Пример #2
0
        private async void ProgressDialog_OnLoaded(object sender, RoutedEventArgs e)
        {
            viewModel.Start();

            // This dialog was shown async in "using" statement, await the close/dispose before closing
            await closeTask;

            viewModel.Stop();
            Owner?.Activate();
        }
Пример #3
0
 private void OKBouton_Click(object sender, EventArgs e)
 {
     if (Globals.ThisAddIn.Application.ActiveWorkbook != null)
     {
         Tools.Workbook  myWorkbook  = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook);
         Tools.Worksheet myWorksheet = Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveSheet);
         mvExcelGet.mParam[0].SetValuesWithCells(ConstRefEdit.Text, myWorksheet.Name, myWorkbook.Name);
         mvExcelGet.mParam[1].SetValuesWithCells(ArchRefEdit.Text, myWorksheet.Name, myWorkbook.Name);
         mvExcelGet.mParam[2].SetValuesWithCells(GarchRefEdit.Text, myWorksheet.Name, myWorkbook.Name);
         mvExcelGet.mParam[3].SetValuesWithCells(TetaRefEdit.Text, myWorksheet.Name, myWorkbook.Name);
         mvExcelGet.mParam[4].SetValuesWithCells(GammaRefEdit.Text, myWorksheet.Name, myWorkbook.Name);
         Globals.ThisAddIn.mAddInModel.DeleteCondVar();
         Globals.ThisAddIn.mAddInModel.AddCondVar(mvExcelGet);
     }
     else
     {
         Globals.ThisAddIn.mAddInModel = new cExcelModelClass(Globals.ThisAddIn.mAddInBackupModel);
     }
     Owner.Show();
     Owner.Activate();
     Owner.RemoveOwnedForm(this);
     Close();
 }
Пример #4
0
 private void SetupWindow_Closed(object?sender, EventArgs e)
 {
     Owner?.Activate();
 }
Пример #5
0
 /// <summary>СОБЫТИЕ При закрытии окна</summary>
 private void UserWindows_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Owner?.Activate();
 }
Пример #6
0
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     ViewModel?.Dispose();
     Owner?.Activate();
 }
 private void pdfStreamWindow_Closed(object?sender, EventArgs e)
 {
     pdfSourceRichTextBox.ResetStreamWindow();
     Owner.Activate();
 }
Пример #8
0
 /// <summary>
 /// logic for the Submit button, so the user can submit the
 /// changes, if any, that they have made to the record
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     if (HasAmountChanged() || HasCategoryChanged() || HasDateChanged() || HasDescriptionChanged())
     {
         if (chkHasBeenDeleted.IsChecked == true)
         {
             MessageBoxResult result = MessageBox.Show("The record is marked for deletion.\n" +
                                                       "Did you intent to reinstate the record and save the changes?", "Confimation", MessageBoxButton.YesNoCancel);
             if (result == MessageBoxResult.Yes)
             {
                 selectedRecord.Status   = "++";
                 selectedRecord.Modified = 1;
                 UpdateSelectedRecord();
                 Owner.IsEnabled = true;
                 Owner.Activate();
                 Close();
             }
             else if (result == MessageBoxResult.No)
             {
                 Owner.IsEnabled = true;
                 Owner.Activate();
                 Close();
             }
         }
         else
         {
             UpdateSelectedRecord();
             selectedRecord.Status   = "++";
             selectedRecord.Modified = 1;
             MessageBox.Show("Record Updated.", "Confirmation");
             Owner.IsEnabled = true;
             Owner.Activate();
             Close();
         }
     }
     else
     {
         if (chkHasBeenDeleted.IsChecked == false && selectedRecord.Status.Equals("--"))
         {
             MessageBoxResult result = MessageBox.Show("Do you wish to reinstate the record?", "Confirmation", MessageBoxButton.YesNoCancel);
             if (result == MessageBoxResult.Yes)
             {
                 if (selectedRecord.PreviousStatus.Equals("++"))
                 {
                     selectedRecord.Status   = selectedRecord.PreviousStatus;
                     selectedRecord.Modified = 1;
                     Owner.IsEnabled         = true;
                     Owner.Activate();
                     Close();
                 }
                 else
                 {
                     selectedRecord.Status = "";
                     Owner.IsEnabled       = true;
                     Owner.Activate();
                     Close();
                 }
             }
             else if (result == MessageBoxResult.No)
             {
                 Owner.IsEnabled = true;
                 Owner.Activate();
                 Close();
             }
         }
         else
         {
             MessageBox.Show("No changes made.", "Confirmation");
             Owner.IsEnabled = true;
             Owner.Activate();
             Close();
         }
     }
 }
Пример #9
0
 private void mi_Finish_Click(object sender, EventArgs e)
 {
     Owner.Activate();
     Owner.Show();
     Hide();
 }
 private void CancelButton_Click(object sender, EventArgs e)
 {
     _shown = false;
     Owner.Activate();
     Hide();
 }
Пример #11
0
 private void ActivateClose()
 {
     Owner?.Activate();
     Close();
 }
 private void DocumentSelectorForm_Deactivate(object sender, EventArgs e)
 {
     Owner.Activate();
     Hide();
 }
Пример #13
0
 private void frmPrevisionnel_FormClosing(object sender, FormClosingEventArgs e)
 {
     Owner.Activate();
 }
Пример #14
0
 private void OnClosing(object sender, CancelEventArgs e)
 {
     Owner.Activate();
 }
Пример #15
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     SaveChanges(true);
     Owner.Activate();
 }
Пример #16
0
 public new async void Hide()
 {
     Owner.Show(); await Task.Delay(50); base.Hide(); Owner.Activate();
 }
Пример #17
0
 private void checkedWindow_Closed(object?sender, EventArgs e)
 {
     Owner?.Activate();
 }
 private void Cancel_Click(object sender, RoutedEventArgs e)
 {
     Close();
     Owner.Activate();
 }
Пример #19
0
 /// <summary>
 /// Event handler for the window closing
 /// </summary>
 private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     Owner.Activate();
 }
Пример #20
0
 private void Form1_MouseUp(object sender, MouseEventArgs e)
 {
     mouseDown = false;
     Owner.Activate();
 }
Пример #21
0
 private void Window_Closed(object sender, EventArgs e)
 {
     Owner.Activate();
 }
Пример #22
0
        public void OwnerChanged()
        {
            canResize = () => Owner.ResizeMode == ResizeMode.CanResize ? true :
                        Owner.ResizeMode == ResizeMode.CanResizeWithGrip ? true : false;
            switch (Location)
            {
            case Location.Left:
            {
                GetCursor = pt =>
                            new Rect(new Point(0, 0), new Size(ActualWidth, tolerance)).Contains(pt) ?
                            Cursors.SizeNWSE :
                            new Rect(new Point(0, ActualHeight - tolerance), new Size(ActualWidth, tolerance)).Contains(pt) ?
                            Cursors.SizeNESW :
                            Cursors.SizeWE;

                GetHT = pt => new Rect(new Point(0, 0), new Size(ActualWidth, tolerance)).Contains(pt) ?
                        HT.TOPLEFT :
                        new Rect(new Point(0, ActualHeight - tolerance), new Size(ActualWidth, tolerance)).Contains(pt) ?
                        HT.BOTTOMLEFT :
                        HT.LEFT;

                Update = delegate
                {
                    if (Glow != null)
                    {
                        Glow.Margin = new Thickness(glowThickness, glowThickness, -glowThickness, glowThickness);
                    }
                    double left = 0;
                    double top  = 0;
                    if (Owner.WindowState == System.Windows.WindowState.Normal)
                    {
                        left = Owner.Left;
                        top  = Owner.Top;
                    }
                    Left   = left - glowThickness;
                    Top    = top - glowThickness;
                    Width  = glowThickness;
                    Height = Owner.ActualHeight + glowThickness * 2;
                    if (Owner.WindowState != WindowState.Normal)
                    {
                        Hide();
                    }
                };
                break;
            }

            case Location.Top:
            {
                GetCursor = pt =>
                            new Rect(new Point(0, 0), new Size(tolerance, glowThickness)).Contains(pt) ?
                            Cursors.SizeNWSE :
                            new Rect(new Point(ActualWidth - tolerance, 0), new Size(tolerance, ActualHeight)).Contains(pt) ?
                            Cursors.SizeNESW :
                            Cursors.SizeNS;

                GetHT = pt =>
                        new Rect(new Point(0, 0), new Size(tolerance, glowThickness)).Contains(pt) ?
                        HT.TOPLEFT :
                        new Rect(new Point(ActualWidth - tolerance, 0), new Size(tolerance, ActualHeight)).Contains(pt) ?
                        HT.TOPRIGHT :
                        HT.TOP;

                Update = delegate
                {
                    if (Glow != null)
                    {
                        Glow.Margin = new Thickness(glowThickness, glowThickness, glowThickness, -glowThickness);
                    }
                    double left = 0;
                    double top  = 0;
                    if (Owner.WindowState == System.Windows.WindowState.Normal)
                    {
                        left = Owner.Left;
                        top  = Owner.Top;
                    }
                    Left   = left - glowThickness;
                    Top    = top - glowThickness;
                    Width  = Owner.ActualWidth + glowThickness * 2;
                    Height = glowThickness;
                    if (Owner.WindowState != WindowState.Normal)
                    {
                        Hide();
                    }
                };
                break;
            }

            case Location.Right:
            {
                GetCursor = pt =>
                            new Rect(new Point(0, 0), new Size(ActualWidth, tolerance)).Contains(pt) ?
                            Cursors.SizeNESW :
                            new Rect(new Point(0, ActualHeight - tolerance), new Size(ActualWidth, tolerance)).Contains(pt) ?
                            Cursors.SizeNWSE :
                            Cursors.SizeWE;

                GetHT = pt => new Rect(new Point(0, 0), new Size(ActualWidth, tolerance)).Contains(pt) ?
                        HT.TOPRIGHT :
                        new Rect(new Point(0, ActualHeight - tolerance), new Size(ActualWidth, tolerance)).Contains(pt) ?
                        HT.BOTTOMRIGHT :
                        HT.RIGHT;


                Update = delegate
                {
                    if (Glow != null)
                    {
                        Glow.Margin = new Thickness(-glowThickness, glowThickness, glowThickness, glowThickness);
                    }
                    double left = 0;
                    double top  = 0;
                    if (Owner.WindowState == System.Windows.WindowState.Normal)
                    {
                        left = Owner.Left;
                        top  = Owner.Top;
                    }
                    Left   = left + Owner.ActualWidth;
                    Top    = top - glowThickness;
                    Width  = glowThickness;
                    Height = Owner.ActualHeight + glowThickness * 2;
                    if (Owner.WindowState != WindowState.Normal)
                    {
                        Hide();
                    }
                };
                break;
            }

            case Location.Bottom:
            {
                GetCursor = pt =>
                            new Rect(new Point(0, 0), new Size(tolerance, glowThickness)).Contains(pt) ?
                            Cursors.SizeNESW :
                            new Rect(new Point(ActualWidth - tolerance, 0), new Size(tolerance, ActualHeight)).Contains(pt) ?
                            Cursors.SizeNWSE :
                            Cursors.SizeNS;

                GetHT = pt =>
                        new Rect(new Point(0, 0), new Size(tolerance, glowThickness)).Contains(pt) ?
                        HT.BOTTOMLEFT :
                        new Rect(new Point(ActualWidth - tolerance, 0), new Size(tolerance, ActualHeight)).Contains(pt) ?
                        HT.BOTTOMRIGHT :
                        HT.BOTTOM;

                Update = delegate
                {
                    if (Glow != null)
                    {
                        Glow.Margin = new Thickness(glowThickness, -glowThickness, glowThickness, glowThickness);
                    }
                    double left = 0;
                    double top  = 0;
                    if (Owner.WindowState == System.Windows.WindowState.Normal)
                    {
                        left = Owner.Left;
                        top  = Owner.Top;
                    }
                    Left   = left - glowThickness;
                    Top    = top + Owner.ActualHeight;
                    Width  = Owner.ActualWidth + glowThickness * 2;
                    Height = glowThickness;
                    if (Owner.WindowState != WindowState.Normal)
                    {
                        Hide();
                    }
                };
                break;
            }
            }

            Owner.LocationChanged += delegate
            {
                Update();
            };
            Owner.SizeChanged += delegate
            {
                Update();
            };

            Owner.StateChanged += delegate
            {
                switch (Owner.WindowState)
                {
                case WindowState.Maximized:
                    Hide();
                    break;

                case WindowState.Minimized:
                    Hide();
                    break;

                default:
                    Show();
                    Owner.Activate();
                    break;
                }
            };

            Owner.IsVisibleChanged += delegate
            {
                if (Owner.IsVisible)
                {
                    Update();
                }
                else
                {
                    Hide();
                }
            };

            Owner.Activated += delegate
            {
                Binding activeBrushBinding = new Binding();
                activeBrushBinding.Path   = new PropertyPath(GlowManager.ActiveGlowBrushProperty);
                activeBrushBinding.Source = Owner;
                SetBinding(ForegroundProperty, activeBrushBinding);
                if (Owner.WindowState != WindowState.Normal)
                {
                    Hide();
                }
            };
            Owner.Deactivated += delegate
            {
                Binding activeBrushBinding = new Binding();
                activeBrushBinding.Path   = new PropertyPath(GlowManager.InactiveGlowBrushProperty);
                activeBrushBinding.Source = Owner;
                SetBinding(ForegroundProperty, activeBrushBinding);
                if (Owner.WindowState != WindowState.Normal)
                {
                    Hide();
                }
            };

            Update();
        }
Пример #23
0
 protected override void OnActivated(EventArgs e)
 {
     BeginInvoke(new Action(() => Owner.Activate()));
 }
Пример #24
0
 private void name_list_FormClosed(object sender, FormClosedEventArgs e)
 {
     Owner.Activate();
     Owner.BringToFront();
 }