示例#1
0
        /// <summary>
        /// Closes currently open popup.
        /// </summary>
        internal void Close()
        {
            WaitForCurrentAnimationToComplete();

            Animation.AnimationInt anim = new DevComponents.DotNetBar.Animation.AnimationInt(
                   new Animation.AnimationRequest(this, "OpenState", 100, 0),
                   Animation.AnimationEasing.EaseOutCubic, 300);
            anim.AutoDispose = true;
            anim.Start();

            if (_PopupProxy != null) // Hosted elsewhere other than RadialMenu
            {
                IOwnerMenuSupport ownerMenu = this.GetIOwnerMenuSupport();
                if (ownerMenu != null)
                {
                    ownerMenu.UnregisterPopup(_PopupProxy);
                    _PopupProxy.Expanded = false;
                }
            }
        }
示例#2
0
        internal void Open()
        {
            if (_IsOpening) return;
            try
            {
                _IsOpening = true;

                this.Displayed = true;

                WaitForCurrentAnimationToComplete();

                if (this.Parent != null) // Hosted elsewhere other than RadialMenu
                {
                    IOwnerMenuSupport ownerMenu = this.GetIOwnerMenuSupport();
                    if (ownerMenu != null)
                    {
                        if (_PopupProxy == null) _PopupProxy = new RadialMenuPopupProxy(this);
                        _PopupProxy.Expanded = true;
                        ownerMenu.RegisterPopup(_PopupProxy);
                    }
                }


                if (_Popup == null)
                {
                    _Popup = new RadialMenuPopup();
                    _Popup.DisplayItem = this;
                    if (_Font != null)
                        _Popup.Font = _Font;
                    else if (_RadialMenu != null)
                        _Popup.Font = _RadialMenu.Font;
                    _Popup.CreateControl();
                }

                if (_MenuLocation.IsEmpty)
                {
                    if (_RadialMenu != null)
                    {
                        Point p = _RadialMenu.PointToScreen(
                            new Point(_RadialMenu.Width / 2, _RadialMenu.Height / 2));
                        p.X -= _Diameter / 2;
                        p.Y -= _Diameter / 2;
                        _Popup.Location = p;
                    }
                    else
                    {
                        Point p = Control.MousePosition;
                        p.X -= _Diameter / 2;
                        p.Y -= _Diameter / 2;
                        _Popup.Location = p;
                    }
                }
                else
                    _Popup.Location = _MenuLocation;
                _Popup.Visible = true;
                _Popup.Refresh();

                Animation.AnimationInt anim = new DevComponents.DotNetBar.Animation.AnimationInt(
                       new Animation.AnimationRequest(this, "OpenState", 0, 100),
                       Animation.AnimationEasing.EaseOutCubic, 300);
                anim.AutoDispose = true;
                _CurrentAnimation = anim;
                anim.Start();
            }
            finally
            {
                _IsOpening = false;
            }
        }
示例#3
0
 private void RunExpandItemAnimation()
 {
     Animation.Storyline story = new DevComponents.DotNetBar.Animation.Storyline();
     story.AutoDispose = true;
     Animation.AnimationInt anim = new DevComponents.DotNetBar.Animation.AnimationInt(
            new Animation.AnimationRequest(this, "InnerScale", 100, 85),
            Animation.AnimationEasing.EaseInCubic, 250);
     anim.Animations.Add(new DevComponents.DotNetBar.Animation.AnimationRequest(this, "SubMenuEdgeWidthAnimated", 0, 12));
     anim.AutoDispose = true;
     story.Animations.Add(anim);
     anim = new DevComponents.DotNetBar.Animation.AnimationInt(
            new Animation.AnimationRequest(this, "InnerScale", 85, 100),
            Animation.AnimationEasing.EaseOutCubic, 250);
     anim.Animations.Add(new DevComponents.DotNetBar.Animation.AnimationRequest(this, "SubMenuEdgeWidthAnimated", 12, 0));
     anim.AutoDispose = true;
     story.Animations.Add(anim);
     _CurrentStoryline = story;
     story.Run();
 }
示例#4
0
 /// <summary>
 /// Called when CurrentFrame property has changed.
 /// </summary>
 /// <param name="oldValue">Old property value</param>
 /// <param name="newValue">New property value</param>
 protected virtual void OnCurrentFrameChanged(int oldValue, int newValue)
 {
     _LastFrame = oldValue;
     if (_AnimationEnabled && _AnimationDuration > 0 && !GetDesignMode()) // Animate transition from current frame to new frame
     {
         DisposeCurrentAnimation();
         int targetValue = _TileSize.Height;
         Animation.AnimationInt anim = new DevComponents.DotNetBar.Animation.AnimationInt(new Animation.AnimationRequest(this, "CurrentFrameOffset", targetValue, 0),
             Animation.AnimationEasing.EaseOutExpo, _AnimationDuration);
         _CurrentAnimation = anim;
         anim.Start();
     }
     else
         this.Refresh();
     //OnPropertyChanged(new PropertyChangedEventArgs("CurrentFrame"));
 }
示例#5
0
        private static IntPtr ShowInternal(Control parent, string message, Image image, int timeoutInterval, eToastGlowColor toastGlowColor, eToastPosition? toastPosition, int x, int y)
        {
            if (parent == null) throw new NullReferenceException("parent parameter for toast notification must be set.");

            if (timeoutInterval < 1) timeoutInterval = 0;

            ToastDisplay toast = new ToastDisplay();
            toast.BackColor = Color.Transparent;
            toast.ToastBackColor = _ToastBackColor;
            toast.ForeColor = _ToastForeColor;
            if (_ToastFont != null) toast.Font = _ToastFont;
            bool isTerminalSession = NativeFunctions.IsTerminalSession();
            toast.Alpha = isTerminalSession ? 255 : 0;
            toast.Text = message;
            toast.Image = image;
            toast.GlowColor = toastGlowColor;
            parent.Controls.Add(toast);
            Size toastSize = toast.DesiredSize(_ToastMargin, parent.ClientRectangle);
            toast.BringToFront();
            if (toastPosition != null)
                toast.Bounds = CalculateToastBounds(toastPosition.Value, parent.ClientRectangle, toastSize);
            else
                toast.Bounds = new Rectangle(x, y, toastSize.Width, toastSize.Height);

            toast.Visible = true;
            IntPtr toastId = toast.Handle;
            if (!isTerminalSession)
            {
                Animation.AnimationInt anim = new DevComponents.DotNetBar.Animation.AnimationInt(new Animation.AnimationRequest(toast, "Alpha", 0, 255),
                        Animation.AnimationEasing.EaseOutQuad, 250);
                //anim.FixedStepCount = 10;
                anim.AutoDispose = true;
                anim.Start();
            }

            if (timeoutInterval > 0)
                BarUtilities.InvokeDelayed(new MethodInvoker(delegate { CloseToast(toast); }), timeoutInterval);

            return toastId;
        }
示例#6
0
        private static void CloseToast(ToastDisplay toast)
        {
            bool isTerminalSession = NativeFunctions.IsTerminalSession();

            if (toast.IsDisposed)
            {
                if (toast.Parent != null)
                    toast.Parent.Controls.Remove(toast);
                return;
            }

            if (isTerminalSession)
            {
                toast.Visible = false;
                toast.Parent.Controls.Remove(toast);
                toast.Dispose();
            }
            else
            {
                Animation.AnimationInt anim = new DevComponents.DotNetBar.Animation.AnimationInt(new Animation.AnimationRequest(toast, "Alpha", 255, 0),
                        Animation.AnimationEasing.EaseInQuad, 250);
                anim.AutoDispose = true;
                anim.Start();
                anim.AnimationCompleted += new EventHandler(delegate { if (toast.Parent != null) toast.Parent.Controls.Remove(toast); toast.Dispose(); });
            }
        }