Пример #1
0
            unsafe HRESULT IOleControlSite.GetExtendedControl(IntPtr *ppDisp)
            {
                Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "in GetExtendedControl " + host.ToString());
                if (ppDisp is null)
                {
                    return(HRESULT.E_POINTER);
                }

                object proxy = host.GetParentContainer().GetProxyForControl(host);

                if (proxy is null)
                {
                    return(HRESULT.E_NOTIMPL);
                }

                *ppDisp = Marshal.GetIDispatchForObject(proxy);
                return(HRESULT.S_OK);
            }
Пример #2
0
            HRESULT Ole32.IOleControlSite.GetExtendedControl(out object ppDisp)
            {
                Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "in GetExtendedControl " + host.ToString());
                ppDisp = host.GetParentContainer().GetProxyForControl(host);
                if (ppDisp == null)
                {
                    return(HRESULT.E_NOTIMPL);
                }

                return(HRESULT.S_OK);
            }
Пример #3
0
            /// <devdoc>
            ///    <para>[To be supplied.]</para>
            /// </devdoc>
            internal void OnUIActivate(AxHost site) {
                // The ShDocVw control repeatedly calls OnUIActivate() with the same
                // site. This causes the assert below to fire.
                //
                if (siteUIActive == site)
                    return;

                if (siteUIActive != null && siteUIActive != site) {
                    AxHost tempSite = siteUIActive;
                    bool ownDisposing = tempSite.GetAxState(AxHost.ownDisposing);
                    try {
                        tempSite.SetAxState(AxHost.ownDisposing, true);
                        tempSite.GetInPlaceObject().UIDeactivate();
                    }
                    finally {
                        tempSite.SetAxState(AxHost.ownDisposing, ownDisposing);
                    }
                }
                site.AddSelectionHandler();
                Debug.Assert(siteUIActive == null, "Object did not call OnUIDeactivate");
                Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "active Object is now "+site.ToString());
                siteUIActive = site;
                ContainerControl f = site.ContainingControl;
                Debug.Assert(f != null, "a control has to be on a ContainerControl...");
                if (f != null) {
                    f.ActiveControl = site;
                }
            }
Пример #4
0
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 internal void ControlCreated(AxHost invoker) {
     Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "in controlCreated for "+invoker.ToString()+" fAC: "+formAlreadyCreated.ToString());
     if (formAlreadyCreated) {
         if (invoker.IsUserMode() && invoker.AwaitingDefreezing()) {
             invoker.Freeze(false);
         }
     }
     else {
         // the form will be created in the future
         parent.CreateAxContainer();
     }
 }
Пример #5
0
            /// <devdoc>
            ///    <para>[To be supplied.]</para>
            /// </devdoc>
            // FxCop: Currently not used
            private void OnNewActiveControlInternal(AxHost value) {
                Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "New active control. siteUIActive is" +siteUIActive.ToString()+" Control is "+value.ToString());
                if (siteUIActive != null && siteUIActive != value) {
                    Debug.Fail("we should not have an ui active site on this container!"+parent.ToString());
                    siteUIActive.UiDeactivate();
                }
#if DEBUG
                if (siteUIActive != null && siteUIActive != value) Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "Why is "+siteUIActive.ToString()+" still active?");
                if (!value.CanUIActivate) Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "why can't "+value.ToString()+" be uiactivated?");
#endif
                if (siteUIActive == null && value.CanUIActivate) {
                    // we need to uiactivate it ourselves...
                    try {
                        ((AxHost)value).UiActivate();
                    }
                    catch (Exception e) {
                        Debug.Fail(e.ToString());
                    }
                }
#if DEBUG
                if (siteUIActive != parent.ActiveControl && value.CanUIActivate) {
                    Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "form's active control is "+parent.ActiveControl.ToString());
                    Debug.WriteLineIf(AxHTraceSwitch.TraceVerbose, "could not reconcile active controls... bad things loom on the horizon...");
                }
#endif
                if (siteUIActive == null) {
                    // so now the form thinks that value is the active control but it's not ui active...
                    // this can often lead to bad things unless we are carefull...
                    siteActive = value;
                    // basically, when siteActive goes inplacedeactivate, we need to treat it the same as a
                    // siteuiactive going uiactivedeactivate...
                }
            }