コード例 #1
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="ACallerForm">the form that has opened this window; needed for focusing when this window is closed later</param>
        /// <param name="ATheForm"></param>
        /// <param name="AStatusBar"></param>
        public TFrmPetraUtils(Form ACallerForm, IFrmPetra ATheForm, TExtStatusBarHelp AStatusBar)
        {
            FFormActivatedForFirstTime    = true;
            FVerificationResultCollection = new TVerificationResultCollection();

            FTheForm    = ATheForm;
            FWinForm    = (Form)ATheForm;
            FStatusBar  = AStatusBar;
            FCallerForm = ACallerForm;

            if (ACallerForm != null)
            {
                TFormsList.GFormsList.NotifyWindowOpened(ACallerForm.Handle, FWinForm.Handle);
            }

            FWindowExtensions = new TFrmPetraWindowExtensions(FWinForm, FCallerForm);

            //
            // Initialise the Data Validation ToolTip
            //
            FValidationToolTip              = new System.Windows.Forms.ToolTip();
            FValidationToolTip.ToolTipIcon  = System.Windows.Forms.ToolTipIcon.Warning;
            FValidationToolTip.ToolTipTitle = Catalog.GetString("Incorrect Data");
            FValidationToolTip.UseAnimation = true;
            FValidationToolTip.UseFading    = true;

            // WriteToStatusBar(Catalog.GetString("Ready."));
        }
コード例 #2
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="ACallerForm">the int handle of the form that has opened this window; needed for focusing when this window is closed later</param>
        /// <param name="ATheForm"></param>
        /// <param name="AStatusBar"></param>"
        public TFrmPetraEditUtils(Form ACallerForm, IFrmPetraEdit ATheForm, TExtStatusBarHelp AStatusBar) : base(ACallerForm,
                                                                                                                 (IFrmPetra)ATheForm,
                                                                                                                 AStatusBar)
        {
            FCloseFormCheckRun = false;
            FFormLoadedTime    = DateTime.Now;

            // default behavior is false, DONT supress detecting the change events
            FSuppressChangeDetection = false;
            ChangesWereAbandonded    = false;
        }
コード例 #3
0
ファイル: PetraForm.cs プロジェクト: hoangduit/openpetra
        /**
         * Event Handler that is invoked when the Form is about to close - no matter
         * how the closing was invoked (by calling Form.Close, a Close button, the
         * x Button of a Form, etc).
         *
         * @param sender Event sender
         * @param e EventArgs that allow cancelling of the closing
         *
         */
        public virtual void TFrmPetra_Closing(System.Object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (!CanClose() || !FTheForm.CanClose())
            {
                // MessageBox.Show('TFrmPetra.TFrmPetra_Closing: e.Cancel := true');
                e.Cancel = true;
            }
            else
            {
                // MessageBox.Show('TFrmPetra.TFrmPetra_Closing: GFormsList.Remove(Self as Form)');
                TFormsList.GFormsList.NotifyWindowClose(this.FWinForm.Handle);
                TFormsList.GFormsList.Remove(FWinForm);

                FWindowExtensions.TForm_Closing();
                FStatusBar = null; // Throwing away my reference to the status bar may allow the form to be disposed,
                                   // and may avoid an exception in WriteToStatusBar, below.
            }
        }