protected override string GetLocalizedString(string value) { return(ResourcesHelper.GetString(value)); }
private void ChangeActiveXStateUpTo(ActiveXHelper.ActiveXState state) { if (!this.GetActiveXHostState(ActiveXHelper.InTransition)) { this.SetActiveXHostState(ActiveXHelper.InTransition, true); try { while (state > this.activeXState) { switch (this.activeXState) { case ActiveXHelper.ActiveXState.Passive: this.activeXInstance = UnsafeNativeMethods.CoCreateInstance <TActiveXClass, TActiveXInterface>(null, NativeMethods.tagCLSCTX.CLSCTX_INPROC_SERVER, NativeMethods.ActiveX.IID_IUnknown); this.activeXState = ActiveXHelper.ActiveXState.Loaded; this.AttachInterfacesInternal(); continue; case ActiveXHelper.ActiveXState.Loaded: try { if ((this.activeXOleObject.GetMiscStatus(NativeMethods.tagDVASPECT.DVASPECT_CONTENT) & NativeMethods.tagOLEMISC.OLEMISC_SETCLIENTSITEFIRST) != 0) { this.activeXOleObject.SetClientSite(this.ActiveXSite); } } catch { } if (!base.DesignMode) { this.StartEvents(); } this.activeXState = ActiveXHelper.ActiveXState.Running; continue; case ActiveXHelper.ActiveXState.Running: try { this.DoVerb(NativeMethods.OLEIVERB.OLEIVERB_INPLACEACTIVATE); } catch (Exception ex) { throw new TargetInvocationException(ResourcesHelper.GetString(ResourcesHelper.ActiveXNoWindowHandle, new object[] { base.GetType().Name }), ex); } ControlShim.CreateControl(this, true); this.activeXState = ActiveXHelper.ActiveXState.InPlaceActive; continue; case ActiveXHelper.ActiveXState.InPlaceActive: try { this.DoVerb(NativeMethods.OLEIVERB.OLEIVERB_UIACTIVATE); } catch (Exception ex) { throw new TargetInvocationException(ResourcesHelper.GetString(ResourcesHelper.ActiveXNoWindowHandle, new object[] { base.GetType().Name }), ex); } this.activeXState = ActiveXHelper.ActiveXState.UIActive; continue; } //this.activeXState += ActiveXHelper.ActiveXState.Loaded; this.activeXState = (ActiveXHelper.ActiveXState)((int)(this.activeXState) + (int)(ActiveXHelper.ActiveXState.Loaded)); } } finally { this.SetActiveXHostState(ActiveXHelper.InTransition, false); } } }