Exemple #1
0
            // Token: 0x060089D6 RID: 35286 RVA: 0x002565A0 File Offset: 0x002547A0
            public void OnShutdownFinished(object sender, EventArgs e)
            {
                HwndHost hwndHost = this.Target as HwndHost;

                if (hwndHost != null)
                {
                    hwndHost.OnDispatcherShutdown(sender, e);
                    return;
                }
                this.Dispose();
            }
Exemple #2
0
            public void OnShutdownFinished(object sender, EventArgs e)
            {
                HwndHost hwndHost = this.Target as HwndHost;

                if (null != hwndHost)
                {
                    hwndHost.OnDispatcherShutdown(sender, e);
                }
                else
                {
                    Dispose();
                }
            }
 protected override void OnParentChanged(EventArgs e)
 {
     base.OnParentChanged(e);
     var Parent = this.Parent;
     if (Parent == null)
         HwndHost = null;
     else
     {
         var Adapter = FindWinFormsAdapter(Parent);
         if (Adapter != null)
             //Reflect out the hidden _host field value
             HwndHost = Adapter.GetType().GetField("_host", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(Parent) as HwndHost;
         else
             HwndHost = null;
     }
 }
Exemple #4
0
 public WeakEventDispatcherShutdown(HwndHost hwndHost, Dispatcher that) : base(hwndHost)
 {
     _that = that;
     _that.ShutdownFinished += new EventHandler(this.OnShutdownFinished);
 }
 public WeakEventDispatcherShutdown(HwndHost hwndHost, Dispatcher that): base(hwndHost)
 {
     _that = that;
     _that.ShutdownFinished += new EventHandler(this.OnShutdownFinished);
 }
Exemple #6
0
 // Token: 0x060089D5 RID: 35285 RVA: 0x00256579 File Offset: 0x00254779
 public WeakEventDispatcherShutdown(HwndHost hwndHost, Dispatcher that) : base(hwndHost)
 {
     this._that = that;
     this._that.ShutdownFinished += this.OnShutdownFinished;
 }
 ///
 public HwndHostAutomationPeer(HwndHost owner): base(owner) 
 { 
     IsInteropPeer = true;
 } 
 public HwndHostExtensionsWindowHook(HwndHost hwndHost)
     : base(new HWND(hwndHost.Handle))
 {
     _hwndHost = hwndHost;
 }
        private static bool TryHookWndProc(HwndHost hwndHost)
        {
            if (hwndHost.Handle != IntPtr.Zero)
            {
                // Hook the window messages so we can intercept the
                // various messages.
                HwndHostExtensionsWindowHook hook = new HwndHostExtensionsWindowHook(hwndHost);

                // Keep our hook alive.
                hwndHost.SetValue(WindowHookProperty, hook);

                return true;
            }
            else
            {
                return false;
            }
        }
        private static void RemoveWndProcUsage(HwndHost hwndHost)
        {
            int refCount = (int) hwndHost.GetValue(WindowHookRefCountProperty);
            refCount--;
            hwndHost.SetValue(WindowHookRefCountProperty, refCount);

            if (refCount == 0)
            {
                HwndHostExtensionsWindowHook hook = (HwndHostExtensionsWindowHook) hwndHost.GetValue(WindowHookProperty);
                hook.Dispose();
                hwndHost.ClearValue(WindowHookProperty);
            }
        }
        private static void AddWndProcUsage(HwndHost hwndHost)
        {
            int refCount = (int) hwndHost.GetValue(WindowHookRefCountProperty);
            refCount++;
            hwndHost.SetValue(WindowHookRefCountProperty, refCount);

            if(refCount == 1)
            {
                if (!TryHookWndProc(hwndHost))
                {
                    // Try again later, when the HwndHost is loaded.
                    hwndHost.Loaded += (s, e) => TryHookWndProc((HwndHost)s);
                }
            }
        }