void MissionRunningWorkSpaceView_Loaded(object sender, RoutedEventArgs e)
        {
              
            this.Browser.LoadCompleted += BrowserOnLoadCompleted;
            this.Browser.Navigated += BrowserOnNavigated;
            this.Browser.Navigating += BrowserOnNavigating;
            this.Browser.ObjectForScripting = new ScriptHelper(Browser);
            
            mEventAggregator.GetEvent<RunStepEvent>().Subscribe(setp =>
            {
                mStep = setp; 
                setp.Commands.Current.Run(this.Browser, CallBack); 
            });

            var webBrowserHelper = new WebBrowserHelper(this.Browser);
            HelperRegistery.SetHelperInstance(this, webBrowserHelper);
            webBrowserHelper.NewWindow += WebBrowserOnNewWindow;
            if(!string.IsNullOrEmpty(GoUrl))
                this.Browser.Navigate(GoUrl);
             

        }
        int UnsafeNativeMethods.IOleInPlaceSite.GetWindowContext(out UnsafeNativeMethods.IOleInPlaceFrame ppFrame, out UnsafeNativeMethods.IOleInPlaceUIWindow ppDoc,
                                                                 NativeMethods.COMRECT lprcPosRect, NativeMethods.COMRECT lprcClipRect, NativeMethods.tagOIFI lpFrameInfo)
        {
            ppDoc   = null;
            ppFrame = this.Host.GetParentContainer();

            lprcPosRect.left   = this.Host.Bounds.X;
            lprcPosRect.top    = this.Host.Bounds.Y;
            lprcPosRect.right  = this.Host.Bounds.Width + this.Host.Bounds.X;
            lprcPosRect.bottom = this.Host.Bounds.Height + this.Host.Bounds.Y;

            lprcClipRect = WebBrowserHelper.GetClipRect();
            if (lpFrameInfo != null)
            {
                lpFrameInfo.cb            = Marshal.SizeOf <NativeMethods.tagOIFI>();
                lpFrameInfo.fMDIApp       = false;
                lpFrameInfo.hAccel        = IntPtr.Zero;
                lpFrameInfo.cAccelEntries = 0;
                lpFrameInfo.hwndFrame     = (this.Host.ParentInternal == null) ? IntPtr.Zero : this.Host.ParentInternal.Handle;
            }
            return(NativeMethods.S_OK);
        }
 private int OnActiveXRectChange(System.Windows.Forms.NativeMethods.COMRECT lprcPosRect)
 {
     this.Host.AXInPlaceObject.SetObjectRects(System.Windows.Forms.NativeMethods.COMRECT.FromXYWH(0, 0, lprcPosRect.right - lprcPosRect.left, lprcPosRect.bottom - lprcPosRect.top), WebBrowserHelper.GetClipRect());
     this.Host.MakeDirty();
     return(0);
 }
 internal void SetSelectionStyle(WebBrowserHelper.SelectionStyle selectionStyle) {
     if (DesignMode) {
         ISelectionService iss = WebBrowserHelper.GetSelectionService(this);
         this.selectionStyle = selectionStyle;
         if (iss != null && iss.GetComponentSelected(this)) {
             // The ActiveX Host designer will offer an extender property
             // called "SelectionStyle" 
             PropertyDescriptor prop = TypeDescriptor.GetProperties(this)["SelectionStyle"];
             if (prop != null && prop.PropertyType == typeof(int)) {
                 prop.SetValue(this, (int)selectionStyle);
             }
         }
     }
 }
 internal void SetEditMode(WebBrowserHelper.AXEditMode em) {
     this.axEditMode = em;
 }
        internal void TransitionDownTo(WebBrowserHelper.AXState state) {
            if (!this.GetAXHostState(WebBrowserHelper.inTransition)) {
                this.SetAXHostState(WebBrowserHelper.inTransition, true);

                try {
                    while (state < this.ActiveXState) {
                        switch (this.ActiveXState) {
                            case WebBrowserHelper.AXState.UIActive:
                                TransitionFromUIActiveToInPlaceActive();
                                Debug.Assert(this.ActiveXState == WebBrowserHelper.AXState.InPlaceActive, "Failed transition");
                                break;
                            case WebBrowserHelper.AXState.InPlaceActive:
                                TransitionFromInPlaceActiveToRunning();
                                Debug.Assert(this.ActiveXState == WebBrowserHelper.AXState.Running, "Failed transition");
                                break;
                            case WebBrowserHelper.AXState.Running:
                                TransitionFromRunningToLoaded();
                                Debug.Assert(this.ActiveXState == WebBrowserHelper.AXState.Loaded, "Failed transition");
                                break;
                            case WebBrowserHelper.AXState.Loaded:
                                TransitionFromLoadedToPassive();
                                Debug.Assert(this.ActiveXState == WebBrowserHelper.AXState.Passive, "Failed transition");
                                break;
                            default:
                                Debug.Fail("bad state");
                                this.ActiveXState--; // To exit the loop
                                break;
                        }
                    }
                }
                finally {
                    this.SetAXHostState(WebBrowserHelper.inTransition, false);
                }
            }
        }