Exemplo n.º 1
0
        private void frmMDIMain_MdiChildActivate(object sender, EventArgs e)
        {
            try
            {
                ToolStripManager.RevertMerge(this.toolStripMDIMain);
                IMergeToolStrip mdiChildMergeToolStrip = ActiveMdiChild as IMergeToolStrip;
                if (mdiChildMergeToolStrip != null)
                {
                    ToolStripManager.Merge(mdiChildMergeToolStrip.ChildToolStrip, toolStripMDIMain);
                }

                ICallToolStrip mdiChildCallToolStrip = ActiveMdiChild as ICallToolStrip;
                if (mdiChildCallToolStrip != null)
                {
                    mdiChildCallToolStrip.PropertyChanged -= new PropertyChangedEventHandler(mdiChildCallToolStrip_PropertyChanged);
                    mdiChildCallToolStrip.PropertyChanged += new PropertyChangedEventHandler(mdiChildCallToolStrip_PropertyChanged);

                    mdiChildCallToolStrip_PropertyChanged(mdiChildCallToolStrip, new PropertyChangedEventArgs("IsDirty"));
                }
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }
Exemplo n.º 2
0
        void mdiChildCallToolStrip_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                ICallToolStrip mdiChildCallToolStrip = sender as ICallToolStrip;
                if (mdiChildCallToolStrip != null)
                {
                    bool closable     = mdiChildCallToolStrip.Closable;
                    bool loadable     = mdiChildCallToolStrip.Loadable;
                    bool newable      = mdiChildCallToolStrip.Newable;
                    bool editable     = mdiChildCallToolStrip.Editable;
                    bool isDirty      = mdiChildCallToolStrip.IsDirty;
                    bool deletable    = mdiChildCallToolStrip.Deletable;
                    bool importable   = mdiChildCallToolStrip.Importable;
                    bool exportable   = mdiChildCallToolStrip.Exportable;
                    bool verifiable   = mdiChildCallToolStrip.Verifiable;
                    bool unverifiable = mdiChildCallToolStrip.Unverifiable;
                    bool printable    = mdiChildCallToolStrip.Printable;
                    bool searchable   = mdiChildCallToolStrip.Searchable;

                    bool readonlyMode = mdiChildCallToolStrip.ReadonlyMode;
                    bool editableMode = mdiChildCallToolStrip.EditableMode;
                    bool isValid      = mdiChildCallToolStrip.IsValid;


                    this.toolStripButtonEscape.Enabled = closable;
                    this.toolStripButtonLoad.Enabled   = loadable && readonlyMode;

                    this.toolStripButtonNew.Enabled    = newable && readonlyMode;
                    this.toolStripButtonEdit.Enabled   = editable && readonlyMode;
                    this.toolStripButtonSave.Enabled   = isDirty && isValid && editableMode;
                    this.toolStripButtonDelete.Enabled = deletable && readonlyMode;

                    this.toolStripButtonImport.Visible    = importable;
                    this.toolStripButtonImport.Enabled    = importable && newable && readonlyMode;
                    this.toolStripButtonExport.Visible    = exportable;
                    this.toolStripButtonExport.Enabled    = exportable;//&& !isDirty && readonlyMode;
                    this.toolStripSeparatorImport.Visible = importable || exportable;

                    this.toolStripButtonVerify.Visible    = verifiable || unverifiable;
                    this.toolStripButtonVerify.Enabled    = verifiable || unverifiable;
                    this.toolStripButtonVerify.Text       = verifiable ? "Verify" : "Unverify";
                    this.toolStripSeparatorVerify.Visible = verifiable || unverifiable;

                    this.toolStripButtonPrint.Visible        = printable;
                    this.toolStripButtonPrint.Enabled        = printable;
                    this.toolStripButtonPrintPreview.Visible = printable;
                    this.toolStripButtonPrintPreview.Enabled = printable;
                    this.toolStripSeparatorPrint.Visible     = printable;

                    this.toolStripComboBoxSearchText.Visible = searchable;
                    this.toolStripButtonSearch.Visible       = searchable;
                }
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }
Exemplo n.º 3
0
 private void toolStripButtonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         ICallToolStrip callToolStrip = this as ICallToolStrip;
         if (callToolStrip != null)
         {
             callToolStrip.Delete();
         }
     }
     catch (Exception exception)
     {
         GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
     }
 }
Exemplo n.º 4
0
 private void toolStripButtonPrintPreview_Click(object sender, EventArgs e)
 {
     try
     {
         ICallToolStrip callToolStrip = ActiveMdiChild as ICallToolStrip;
         if (callToolStrip != null)
         {
             callToolStrip.Print(PrintDestination.PrintPreview);
         }
     }
     catch (Exception exception)
     {
         GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
     }
 }
Exemplo n.º 5
0
 private void toolStripButtonVerify_Click(object sender, EventArgs e)
 {
     try
     {
         ICallToolStrip callToolStrip = ActiveMdiChild as ICallToolStrip;
         if (callToolStrip != null)
         {
             callToolStrip.Verify();
         }
     }
     catch (Exception exception)
     {
         GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
     }
 }
Exemplo n.º 6
0
 private void toolStripButtonSearch_Click(object sender, EventArgs e)
 {
     try
     {
         ICallToolStrip callToolStrip = ActiveMdiChild as ICallToolStrip;
         if (callToolStrip != null)
         {
             callToolStrip.SearchText(this.toolStripComboBoxSearchText.Text);
         }
     }
     catch (Exception exception)
     {
         GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
     }
 }
Exemplo n.º 7
0
        private void toolStripButtonEscape_Click(object sender, EventArgs e)
        {
            try
            {
                ICallToolStrip callToolStrip = ActiveMdiChild as ICallToolStrip;
                if (callToolStrip != null)
                {
                    callToolStrip.Escape();
                }

                if (this.MdiChildren.Length == 0)
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }
Exemplo n.º 8
0
        void DataMessage_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            try
            {
                ICallToolStrip mdiChildCallToolStrip = sender as ICallToolStrip;
                if (mdiChildCallToolStrip != null)
                {
                    bool closable     = mdiChildCallToolStrip.Closable;
                    bool loadable     = mdiChildCallToolStrip.Loadable;
                    bool newable      = mdiChildCallToolStrip.Newable;
                    bool editable     = mdiChildCallToolStrip.Editable;
                    bool isDirty      = mdiChildCallToolStrip.IsDirty;
                    bool deletable    = mdiChildCallToolStrip.Deletable;
                    bool importable   = mdiChildCallToolStrip.Importable;
                    bool exportable   = mdiChildCallToolStrip.Exportable;
                    bool verifiable   = mdiChildCallToolStrip.Verifiable;
                    bool unverifiable = mdiChildCallToolStrip.Unverifiable;
                    bool printable    = mdiChildCallToolStrip.Printable;
                    bool readonlyMode = mdiChildCallToolStrip.ReadonlyMode;
                    bool editableMode = mdiChildCallToolStrip.EditableMode;
                    bool isValid      = true;// mdiChildCallToolStrip.IsValid;


                    this.toolStripButtonEscape.Enabled = closable;
                    this.toolStripButtonLoad.Enabled   = loadable && readonlyMode;

                    this.toolStripButtonNew.Enabled    = newable && readonlyMode;
                    this.toolStripButtonEdit.Enabled   = editable && readonlyMode;
                    this.toolStripButtonSave.Enabled   = isDirty && isValid && editableMode;
                    this.toolStripButtonDelete.Enabled = deletable && readonlyMode;
                }
            }
            catch (Exception exception)
            {
                GlobalExceptionHandler.ShowExceptionMessageBox(this, exception);
            }
        }