Exemplo n.º 1
0
        protected override void OnAttached()
        {
            base.OnAttached();

            this.AssociatedObject.SourceInitialized += (o, args) => {
                handle = new WindowInteropHelper(this.AssociatedObject).Handle;
                var hwndSource = HwndSource.FromHwnd(handle);
                if (hwndSource != null)
                {
                    hwndSource.AddHook(AssociatedObjectWindowProc);
                }
            };
            this.AssociatedObject.Loaded += (sender, e) => {
                this.left   = new GlowWindow(this.AssociatedObject, GlowDirection.Left);
                this.right  = new GlowWindow(this.AssociatedObject, GlowDirection.Right);
                this.top    = new GlowWindow(this.AssociatedObject, GlowDirection.Top);
                this.bottom = new GlowWindow(this.AssociatedObject, GlowDirection.Bottom);

                left.Show();
                left.Update();

                right.Show();
                right.Update();

                top.Show();
                top.Update();

                bottom.Show();
                bottom.Update();
            };
        }
 private void UpdateAll()
 {
     left.Update();
     right.Update();
     top.Update();
     bottom.Update();
 }
        protected override void OnAttached()
        {
            base.OnAttached();

            this.AssociatedObject.Loaded += (sender, e) =>
            {
                left   = new GlowWindow(this.AssociatedObject, GlowDirection.Left);
                right  = new GlowWindow(this.AssociatedObject, GlowDirection.Right);
                top    = new GlowWindow(this.AssociatedObject, GlowDirection.Top);
                bottom = new GlowWindow(this.AssociatedObject, GlowDirection.Bottom);

                Show();

                left.Update();
                right.Update();
                top.Update();
                bottom.Update();
            };

            this.AssociatedObject.Closed += (sender, args) =>
            {
                left.Close();
                right.Close();
                top.Close();
                bottom.Close();
            };
        }
Exemplo n.º 4
0
        protected override void OnAttached()
        {
            base.OnAttached();

            var metroWindow = this.AssociatedObject as MetroWindow;

            if (metroWindow != null && metroWindow.UseNoneWindowStyle)
            {
                return;
            }

            this.AssociatedObject.Loaded += (sender, e) =>
            {
                left   = new GlowWindow(this.AssociatedObject, GlowDirection.Left);
                right  = new GlowWindow(this.AssociatedObject, GlowDirection.Right);
                top    = new GlowWindow(this.AssociatedObject, GlowDirection.Top);
                bottom = new GlowWindow(this.AssociatedObject, GlowDirection.Bottom);

                Show();

                left.Update();
                right.Update();
                top.Update();
                bottom.Update();
            };

            this.AssociatedObject.Closed += (sender, args) =>
            {
                if (left != null)
                {
                    left.Close();
                }
                if (right != null)
                {
                    right.Close();
                }
                if (top != null)
                {
                    top.Close();
                }
                if (bottom != null)
                {
                    bottom.Close();
                }
            };
        }
Exemplo n.º 5
0
 /// <summary>
 /// Updates all glow windows (visible, hidden, collapsed)
 /// </summary>
 private void Update()
 {
     if (left != null)
     {
         left.Update();
     }
     if (right != null)
     {
         right.Update();
     }
     if (top != null)
     {
         top.Update();
     }
     if (bottom != null)
     {
         bottom.Update();
     }
 }