Exemple #1
0
        public IFormInterface LoadForm(INode node, string document, FormInterfaceHandler beforeActivate)
        {
            // DO NOT use a using block with the interface.  Should return immediately.
            IHost host = CreateHost();

            try
            {
                IFormInterface form = CreateForm();
                try
                {
                    host.Load
                    (
                        document,
                        form
                    );
                    if (beforeActivate != null)
                    {
                        beforeActivate(form);
                    }
                    host.Open();
                    return(form);
                }
                catch
                {
                    form.Dispose();
                    throw;
                }
            }
            catch
            {
                host.Dispose();
                throw;
            }
        }
Exemple #2
0
 protected override void InternalExecute(INode sender, EventParams paramsValue)
 {
     if (_document != String.Empty)
     {
         _params = paramsValue;
         if ((_mode == FormMode.Delete) && !ConfirmDelete)
         {
             SourceLink.Source.DataView.Delete();
         }
         else
         {
             _mainSourceParams = paramsValue["AParams"] as DataParams;
             try
             {
                 IFormInterface form = HostNode.Session.LoadForm(this, _document, new FormInterfaceHandler(InternalBeforeActivateForm));
                 try
                 {
                     form.OnClosed += new EventHandler(OnClosedHandler);
                     form.TopMost   = TopMost;
                     InternalAfterActivateForm(form);
                     bool forceAcceptReject = (_onFormAccepted != null) || (_onFormRejected != null) || (OnFormAcceptedEvent != null) || (OnFormRejectedEvent != null);
                     if ((_mode != FormMode.None) || (SourceLinkType != SourceLinkType.None) || forceAcceptReject)
                     {
                         if (forceAcceptReject)
                         {
                             form.ForceAcceptReject = true;
                         }
                         form.Show
                         (
                             (IFormInterface)FindParent(typeof(IFormInterface)),
                             new FormInterfaceHandler(FormAccepted),
                             new FormInterfaceHandler(FormRejected),
                             _mode
                         );
                     }
                     else
                     {
                         form.Show(_mode);
                     }
                 }
                 catch
                 {
                     form.Dispose();
                     throw;
                 }
             }
             finally
             {
                 _mainSourceParams = null;
             }
         }
     }
 }