예제 #1
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            double rollpercent = (double)(Environment.TickCount - targetrolltickstart) / RollUpAnimationTime;
            int    rolldiff    = unrolledheight - RolledUpHeight;

            bool inarea = this.IsHandleCreated && this.RectangleScreenCoords().Contains(MousePosition.X, MousePosition.Y);

            //System.Diagnostics.Debug.WriteLine(Environment.TickCount + " " + rollpercent + " mode " + mode + " inarea " + inarea);

            if (mode == Mode.RollingUp)        // roll up animation, move one step on, check for end
            {
                Height = Math.Max((int)(unrolledheight - rolldiff * rollpercent), RolledUpHeight);
                //System.Diagnostics.Debug.WriteLine(Environment.TickCount + " At " + Height + " child size " + this.FindMaxSubControlArea(0, 0) + " child " + this.Controls[3].FindMaxSubControlArea(0, 0));

                if (Height == RolledUpHeight)    // end
                {
                    timer.Stop();
                    foreach (Control c in Controls)
                    {
                        if (!Object.ReferenceEquals(c, hiddenmarker1) && !Object.ReferenceEquals(c, hiddenmarker2))       // everything hidden but hm
                        {
                            c.Visible = false;
                        }
                    }

                    hiddenmarkershouldbeshown = true;
                    SetHMViz();
                    System.Diagnostics.Debug.WriteLine(Environment.TickCount + " At min h" + Height);

                    mode = Mode.Up;
                    RetractCompleted?.Invoke(this, EventArgs.Empty);
                }
            }
            else if (mode == Mode.RollingDown) // roll down animation, move one step on, check for end
            {
                Height = Math.Min((int)(RolledUpHeight + rolldiff * rollpercent), unrolledheight);
                //System.Diagnostics.Debug.WriteLine(Environment.TickCount + " At " + Height);

                if (Height == unrolledheight)        // end, everything is already visible.  hide the hidden marker
                {
                    timer.Stop();
                    mode = Mode.Down;
                    hiddenmarkershouldbeshown = false;
                    SetHMViz();

                    if (wasautosized)
                    {
                        this.AutoSize = true;

                        foreach (Control c in Controls)     // all panels below become autosized.. shortcut for now.
                        {
                            if (c is Panel)
                            {
                                (c as Panel).AutoSize = true;
                            }
                        }
                    }

                    DeployCompleted?.Invoke(this, EventArgs.Empty);
                }

                if (!inarea && !pinbutton.Checked)      // but not in area now, and not held.. so start roll up procedure
                {
                    StartRollUpTimer();
                }
            }
            else if (mode == Mode.UpAwaitRollDecision) // timer up.. check if in area, if so roll down
            {
                timer.Stop();

                if (inarea)
                {
                    RollDown();
                }
                else
                {
                    mode = Mode.Up;     // back to up
                }
            }
            else if (mode == Mode.DownAwaitRollDecision)    // timer up, check if out of area and not pinned, if so roll up
            {
                timer.Stop();

                pinbutton.Visible = inarea;     // visible is same as inarea flag..

                //System.Diagnostics.Debug.WriteLine("Pause before - in area" + inarea + " pin " + pinbutton.Checked);
                if (!inarea && !pinbutton.Checked)      // if not in area, and its not checked..
                {
                    RollUp();
                }
                else
                {
                    mode = Mode.Down;   // back to down
                }
            }
        }
예제 #2
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (mode == Mode.RollUp)        // roll up animation, move one step on, check for end
            {
                Height = Math.Max(Math.Min(Height - RollPixelStep, UnrolledHeight), RolledUpHeight);

                if (Height == RolledUpHeight)    // end
                {
                    timer.Stop();
                    foreach (Control c in Controls)
                    {
                        if (!Object.ReferenceEquals(c, hiddenmarker))       // everything hidden but hm
                        {
                            c.Visible = false;
                        }
                    }

                    hiddenmarkershouldbeshown = true;
                    SetHMViz();
                    //System.Diagnostics.Debug.WriteLine(Environment.TickCount + " At min h");

                    mode = Mode.None;
                    RetractCompleted?.Invoke(this, EventArgs.Empty);
                }
            }
            else if (mode == Mode.RollDown) // roll down animation, move one step on, check for end
            {
                Height = Math.Max(Math.Min(Height + RollPixelStep, UnrolledHeight), RolledUpHeight);

                if (Height == UnrolledHeight)        // end, everything is already visible.  hide the hidden marker
                {
                    timer.Stop();
                    mode = Mode.None;
                    hiddenmarkershouldbeshown = false;
                    SetHMViz();
                    DeployCompleted?.Invoke(this, EventArgs.Empty);
                }

                if (!inarea && !pinbutton.Checked)      // but not in area now, and not held.. so start roll up procedure
                {
                    StartRollUpTimer();
                }
            }
            else if (mode == Mode.PauseBeforeRollDown) // timer up.. check if in area, if so roll down
            {
                mode = Mode.None;
                timer.Stop();

                if (inarea)
                {
                    RollDown();
                }
                else
                {
                    //System.Diagnostics.Debug.WriteLine("Ignore roll down not in area " + inarea + " checked " + pinbutton.Checked);
                }
            }
            else if (mode == Mode.PauseBeforeRollUp)    // timer up, check if out of area and not pinned, if so roll up
            {
                mode = Mode.None;
                timer.Stop();

                pinbutton.Visible = inarea;        // visible is same as inarea flag..

                if (!inarea && !pinbutton.Checked) // if not in area, and its not checked..
                {
                    RollUp();
                }
                else
                {
                    //System.Diagnostics.Debug.WriteLine("Ignore roll up.. area " + inarea + " checked " + pinbutton.Checked);
                }
            }
        }