Beispiel #1
0
 /// <remarks> The session should already be prepared before invoking this routine.  Upon completion, this session will be disposed. </remarks>
 public void StartCallback(string document, EventHandler onComplete)
 {
     TimingUtility.PushTimer(String.Format("Windows.Session.StartCallback('{0}')", document));
     try
     {
         // Prepare the root form's host
         _rootFormHost = CreateHost();
         try
         {
             _rootFormHost.NextRequest = new Request(document);
             _onComplete = onComplete;
             RootFormAdvance(null);
         }
         catch
         {
             if (_rootFormHost != null)
             {
                 _rootFormHost.Dispose();
                 _rootFormHost = null;
             }
             throw;
         }
     }
     finally
     {
         TimingUtility.PopTimer();
     }
 }
Beispiel #2
0
 /// <remarks> Must call SetApplication or SetLibrary before calling Start().  Upon completion, this session will be disposed. </remarks>
 public void Start(string document)
 {
     TimingUtility.PushTimer(String.Format("Windows.Session.Start('{0}')", document));
     try
     {
         // Prepare the root forms host
         _rootFormHost = CreateHost();
         try
         {
             _rootFormHost.NextRequest = new Request(document);
             IWindowsFormInterface rootForm;
             do
             {
                 rootForm = LoadNextForm(_rootFormHost);
                 rootForm.ShowModal(FormMode.None);
             } while (_rootFormHost.NextRequest != null);
         }
         finally
         {
             Dispose();
         }
     }
     finally
     {
         TimingUtility.PopTimer();
     }
 }
Beispiel #3
0
        /// <remarks> Must call SetApplication or SetLibrary before calling Start().  Upon completion, the given
        /// callback will be invoked and the session will be disposed.  Note that the session may leave its
        /// control in place and it is up to the caller to replace the content of the given container. </remarks>
        public void Start(string document, ContentControl container)
        {
            TimingUtility.PushTimer(String.Format("Silverlight.Session.Start('{0}')", document));
            try
            {
                // Create the session control
                CreateSessionControl();

                // Prepare the root form's host
                _rootFormHost = CreateHost();
                try
                {
                    _rootFormHost.NextRequest = new Request(document);
                    _container = container;
                    LoadNextForm(_rootFormHost).Show();
                }
                catch
                {
                    if (_rootFormHost != null)
                    {
                        _rootFormHost.Dispose();
                        _rootFormHost = null;
                    }
                    throw;
                }

                // Show the session control as the content of the given container
                DispatchAndWait((System.Action)(() => { if (_sessionControl != null)
                                                        {
                                                            container.Content = _sessionControl;
                                                        }
                                                }));
            }
            finally
            {
                TimingUtility.PopTimer();
            }
        }