Esempio n. 1
0
 /// <summary>
 /// Asks a container to display its object to the user. This method ensures that the container itself is visible and not minimized.
 /// </summary>
 /// <remarks>
 /// <para>After a link client binds to a link source, it commonly calls IOleObject::DoVerb on the link source, usually
 /// requesting the source to perform some action requiring that it display itself to the user. As part of its implementation
 /// of IOleObject::DoVerb, the link source can call ShowObject, which forces the client to show the link source as best it can.
 /// If the link source's container is itself an embedded object, it will recursively invoke ShowObject on its own container.</para>
 /// <para>Having called the ShowObject method, a link source has no guarantee of being appropriately displayed because its container
 /// may not be able to do so at the time of the call. The ShowObject method does not guarantee visibility, only that the container will do the best it can.</para>
 /// </remarks>
 public virtual void SendAdvise_ShowObject()
 {
     ComDebug.ReportInfo("{0}.SendAdvise.ShowObject -> Calling IOleClientSite.ShowObject()", GetType().Name);
     if (null != _clientSite)
     {
         _clientSite.ShowObject();
     }
 }
Esempio n. 2
0
        public void RefreshView()
        {
            ICustomDoc cDoc = (ICustomDoc)this.ieInstance.Document;

            if (cDoc != null)
            {
                IOleClientSite oleObj = cDoc as IOleClientSite;
                if (oleObj != null)
                {
                    oleObj.ShowObject();
                }
            }
        }
Esempio n. 3
0
        public int DoVerb(int iVerb, IntPtr lpmsg, IOleClientSite pActiveSite, int lindex, IntPtr hwndParent, COMRECT lprcPosRect)
        {
            ComDebug.ReportInfo("{0}.IOleObject.DoVerb {1}", GetType().Name, iVerb);
            try
            {
                // I saw OLEIVERB_HIDE come in as 253.  Perhaps a unsigned
                // byte conversion happening somewhere.
                if (iVerb >= 250 && iVerb <= 255)
                {
                    int new_iverb = iVerb - 256;
                    ComDebug.ReportWarning("{0}.IOleObject.DoVerb -> Fixing iVerb: {1} -> {2}", GetType().Name, iVerb, new_iverb);
                    iVerb = new_iverb;
                }

                _lastVerb = iVerb;

                switch (iVerb)
                {
                case (int)OLEIVERB.OLEIVERB_HIDE:
                    ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_HIDE", GetType().Name);
                    _comManager.ApplicationAdapter.HideMainWindow();
                    SendAdvise_HideWindow();
                    break;

                case (int)OLEIVERB.OLEIVERB_PRIMARY:
                case (int)OLEIVERB.OLEIVERB_SHOW:
                case (int)OLEIVERB.OLEIVERB_OPEN:

                    if ((int)OLEIVERB.OLEIVERB_PRIMARY == iVerb)
                    {
                        ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_PRIMARY", GetType().Name);
                    }
                    if ((int)OLEIVERB.OLEIVERB_SHOW == iVerb)
                    {
                        ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_SHOW", GetType().Name);
                    }
                    if ((int)OLEIVERB.OLEIVERB_OPEN == iVerb)
                    {
                        ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_OPEN", GetType().Name);
                    }
                    _comManager.ApplicationAdapter.ShowMainWindow();
                    if (pActiveSite != null)
                    {
                        ComDebug.ReportInfo("{0}.IOleObject.DoVerb -> calling ClientSite.ShowObject()", GetType().Name);
                        try
                        {
                            pActiveSite.ShowObject();
                        }
                        catch (Exception ex)
                        {
                            ComDebug.ReportInfo("{0}.IOleObject.DoVerb pActiveSite.ShowObject caused an exception: {1}", GetType().Name, ex);
                        }

                        SendAdvise_ShowWindow();
                    }

                    return(ComReturnValue.NOERROR);

                default:
                    ComDebug.ReportError("{0}.IOleObject.DoVerb Unexpected verb: {1}", GetType().Name, iVerb);
                    return(ComReturnValue.OLEOBJ_S_INVALIDVERB);
                }
                ComDebug.ReportInfo("{0}.IOleObject.DoVerb -> returning NOERROR", GetType().Name);
                return(ComReturnValue.NOERROR);
            }
            catch (Exception e)
            {
                ComDebug.ReportError("{0}.IOleObject.DoVerb throw an exception. Details: {1}", GetType().Name, e);
                throw;
            }
        }
		public int DoVerb(int iVerb, IntPtr lpmsg, IOleClientSite pActiveSite, int lindex, IntPtr hwndParent, COMRECT lprcPosRect)
		{
			ComDebug.ReportInfo("{0}.IOleObject.DoVerb {1}", this.GetType().Name, iVerb);
			try
			{
				// I saw OLEIVERB_HIDE come in as 253.  Perhaps a unsigned
				// byte conversion happening somewhere.
				if (iVerb >= 250 && iVerb <= 255)
				{
					int new_iverb = iVerb - 256;
					ComDebug.ReportWarning("{0}.IOleObject.DoVerb -> Fixing iVerb: {1} -> {2}", this.GetType().Name, iVerb, new_iverb);
					iVerb = new_iverb;
				}

				_lastVerb = iVerb;

				switch (iVerb)
				{
					case (int)OLEIVERB.OLEIVERB_HIDE:
						ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_HIDE", this.GetType().Name);
						_comManager.ApplicationAdapter.HideMainWindow();
						SendAdvise_HideWindow();
						break;

					case (int)OLEIVERB.OLEIVERB_PRIMARY:
					case (int)OLEIVERB.OLEIVERB_SHOW:
					case (int)OLEIVERB.OLEIVERB_OPEN:

						if ((int)OLEIVERB.OLEIVERB_PRIMARY == iVerb) ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_PRIMARY", this.GetType().Name);
						if ((int)OLEIVERB.OLEIVERB_SHOW == iVerb) ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_SHOW", this.GetType().Name);
						if ((int)OLEIVERB.OLEIVERB_OPEN == iVerb) ComDebug.ReportInfo("{0}.IOleObject.DoVerb OLEIVERB_OPEN", this.GetType().Name);
						_comManager.ApplicationAdapter.ShowMainWindow();
						if (pActiveSite != null)
						{
							ComDebug.ReportInfo("{0}.IOleObject.DoVerb -> calling ClientSite.ShowObject()", this.GetType().Name);
							try
							{
								pActiveSite.ShowObject();
							}
							catch (Exception ex)
							{
								ComDebug.ReportInfo("{0}.IOleObject.DoVerb pActiveSite.ShowObject caused an exception: {1}", this.GetType().Name, ex);
							}

							SendAdvise_ShowWindow();
						}

						return ComReturnValue.NOERROR;

					default:
						ComDebug.ReportError("{0}.IOleObject.DoVerb Unexpected verb: {1}", this.GetType().Name, iVerb);
						return ComReturnValue.OLEOBJ_S_INVALIDVERB;
				}
				ComDebug.ReportInfo("{0}.IOleObject.DoVerb -> returning NOERROR", this.GetType().Name);
				return ComReturnValue.NOERROR;
			}
			catch (Exception e)
			{
				ComDebug.ReportError("{0}.IOleObject.DoVerb throw an exception. Details: {1}", this.GetType().Name, e);
				throw;
			}
		}
 public void ShowObject()
 {
     Debug.Print("IOleClientSite.ShowObject");
     _baseIOleClientSite.ShowObject();
 }