/// <summary>
        /// Performs a random tarnsition between the two pictures.
        /// </summary>
        public void transitionPictures()
        {
            // We randomly choose where the current image is going to 
            // slide off to (and where we are going to slide the inactive
            // image in from)...
            int iDestinationLeft = (m_Random.Next(2) == 0) ? Width : -Width;
            int iDestinationTop = (m_Random.Next(3) - 1) * Height;

            // We move the inactive image to this location...
            SuspendLayout();
            m_InactivePicture.Top = iDestinationTop;
            m_InactivePicture.Left = iDestinationLeft;
            m_InactivePicture.BringToFront();
            ResumeLayout();

            // We perform the transition which moves the active image off the
            // screen, and the inactive one onto the screen...
            Transition t = new Transition(new TransitionType_EaseInEaseOut(1000));
            t.add(m_InactivePicture, "Left", 0);
            t.add(m_InactivePicture, "Top", 0);
            t.add(m_ActivePicture, "Left", iDestinationLeft);
            t.add(m_ActivePicture, "Top", iDestinationTop);
            t.run();

            // We swap over which image is active and inactive for next time
            // the function is called...
            PictureBox tmp = m_ActivePicture;
            m_ActivePicture = m_InactivePicture;
            m_InactivePicture = tmp;
        }
示例#2
0
 public void Ask(string question)
 {
     if (question == "quit")
     {
         HideAssistant();
         Application.Exit();
     }
     if (asked == 3)
     {
         Transition t = new Transition(new TransitionType_Deceleration(500));
         t.add(MessagePanelz, "Top", MessagePanelz.Location.Y - 290);
         t.run();
         asked = 0;
     }
     DisplayQuestion(question);
     try
     {
         string uriString = "http://infini-dev.com/WISA/WISA.php"; //post request to server and get response
         WebClient myWebClient = new WebClient();
         NameValueCollection PostParams = new NameValueCollection();
         PostParams.Add("request", question);
         byte[] responseArray =
         myWebClient.UploadValues(uriString, "POST", PostParams);
         string response = Encoding.ASCII.GetString(responseArray);
         DisplayResponse(response);
     }
     catch
     {
         DisplayResponse("I'm sorry, I could not connect to the server");
     }
     asked++;
 }
示例#3
0
        public void swipe(bool show = true)
        {
            this.Visible = true;
            Transition _transasition = new Transitions.Transition(new TransitionType_EaseInEaseOut(500));
            _transasition.add(this, "Left", show ? 0 : this.Width);
            _transasition.run();

            while (this.Left != (show ? 0 : this.Width))
            {
                Application.DoEvents();
            }

            if (!show)
            {
                closed(new EventArgs());
                _owner.Resize -= owner_Resize;
                _owner.Controls.Remove(this);
                this.Dispose();
            }
            else
            {
                _loaded = true;
                ResizeForm();
                shown(new EventArgs());
            }
        }
 private void LabelMain_MouseLeave(object sender, EventArgs e)
 {
     Transition T = new Transition(new TransitionType_EaseInEaseOut(400));
     T.add(this, "ForeColor", Color.Silver);
     T.add(LabelMain, "ForeColor", Color.Silver);
     T.run();
 }
示例#5
0
 public void Move(PlayingCard card, Point position)
 {
     var t = new Transition(new TransitionType_EaseInEaseOut(500));
     t.add(card, "Left", position.X);
     t.add(card, "Top", position.Y);
     t.run();
 }
 private void FadePicBoxes(float xOpacity, float plusOpacity)
 {
     var fade = new Transition(new TransitionType_Linear(400));
     fade.add(pictureBoxX, "Opacity", xOpacity);
     fade.add(pictureBoxPlus, "Opacity", plusOpacity);
     fade.run();
 }
示例#7
0
        //This will determine the size of you panel
        //77 - is to remove the header and footer
        //50 - is for top position. You can change it depending on your design
        public void swipe(bool show = true)
        {
            this.Visible = true;
            Transition _transasition = new Transitions.Transition(new TransitionType_EaseInEaseOut(500));

            _transasition.add(this, "Left", show ? 0 : this.Width);
            _transasition.run();

            while (this.Left != (show ? 0 : this.Width))
            {
                Application.DoEvents();
            }

            if (!show)
            {
                closed(new EventArgs());
                _owner.Resize -= owner_Resize;
                _owner.Controls.Remove(this);
                this.Dispose();
            }
            else
            {
                _loaded = true;
                ResizeForm();
                shown(new EventArgs());
            }
        }
示例#8
0
        /// <summary>
        /// Called when the "Swap" button is pressed.
        /// </summary>
        private void cmdSwap_Click(object sender, EventArgs e)
        {
            // We swap over the group-boxes that show the "Bounce" and 
            // "Throw and Catch" transitions. The active one is animated 
            // left off the screen and the inactive one is animated right
            // onto the screen...

            // We work out which box is currently on screen and
            // which is off screen...
            Control ctrlOnScreen, ctrlOffScreen;
            if (gbBounce.Left == GROUP_BOX_LEFT)
            {
                ctrlOnScreen = gbBounce;
                ctrlOffScreen = gbThrowAndCatch;
            }
            else
            {
                ctrlOnScreen = gbThrowAndCatch;
                ctrlOffScreen = gbBounce;
            }
            ctrlOnScreen.SendToBack();
            ctrlOffScreen.BringToFront();

            // We create a transition to animate the two boxes simultaneously. One is
            // animated onto the screen, the other off the screen.

            // The ease-in-ease-out transition acclerates the rate of change for the 
            // first half of the animation, and decelerates during the second half.

            Transition t = new Transition(new TransitionType_EaseInEaseOut(1000));
            t.add(ctrlOnScreen, "Left", -1 * ctrlOnScreen.Width);
            t.add(ctrlOffScreen, "Left", GROUP_BOX_LEFT);
            t.run();
        }
示例#9
0
        public static void run(object target, string strPropertyName, object destinationValue,
                               ITransitionType transitionMethod)
        {
            var transition = new Transition(transitionMethod);

            transition.add(target, strPropertyName, destinationValue);
            transition.run();
        }
示例#10
0
 private void AssistantGoUp()
 {
     //debug.Visible = true;
     Transition t = new Transition(new TransitionType_Deceleration(500));
     t.add(this, "Top", ScreenHeight/3);
        t.add(MicPanel, "Top", ScreenHeight/3*2-Mic.Height-10);
        //t.add(MessagePanelz, "Height", this.Height - 200);
     hidden = false;
     t.run();
     t.TransitionCompletedEvent += new EventHandler<Transition.Args>(t_TransitionCompletedEvent);
 }
示例#11
0
文件: MainForm.cs 项目: nodegin/dhs
 private void AnimateShowFormTrigger()
 {
     this.Show();
     Transition t = new Transition(new TransitionType_Deceleration(100));
     int tempY = this.Location.Y;
     this.CenterToScreen();
     int centerY = this.Location.Y;
     this.Top = tempY;
     t.add(this, "Top", centerY);
     t.add(this, "Opacity", 1.0);
     t.run();
 }
        public void SlideOut()
        {
            this.Location = new Point(FindForm().Width, 66);
            this.Visible = true;
            this.BackColor = Color.Silver;
            this.BringToFront();

            var t = new Transition(new TransitionType_EaseInEaseOut(400));
            t.TransitionCompletedEvent += ShowTransitionCompletedEvent;
            t.add(this, "Left", 15);
            t.add(this, "BackColor", Color.White);
            t.run();
        }
示例#13
0
        /// <summary>
        /// Runs the next transition in the list.
        /// </summary>
        private void runNextTransition()
        {
            if (m_listTransitions.Count == 0)
            {
                return;
            }

            // We find the next transition and run it. We also register
            // for its completed event, so that we can start the next transition
            // when this one completes...
            Transition nextTransition = m_listTransitions.First.Value;

            nextTransition.TransitionCompletedEvent += onTransitionCompleted;
            nextTransition.run();
        }
示例#14
0
        private void SetErrorMessageOpacity()
        {
            if (_presenter.HasError)
            {
                // Todo - is this the prob? maybe single log trasition
                var t = new Transition(new TransitionType_Acceleration(1000));
                t.add(PBOX_WarningIcon, "Opacity", 1.0F);
                t.add(LBL_Error, "Opacity", 1.0F);
                t.run();

                //Transition.runChain(_ErrorTransition);
            }
            else
            {
                _NoErrorTransition.run();
            }
        }
 private void buttonBack_Click(object sender, EventArgs e)
 {
     var t = new Transition(new TransitionType_EaseInEaseOut(400));
     t.TransitionCompletedEvent += HideTransitionCompletedEvent;
     t.add(this, "Left", FindForm().Width);
     t.add(this, "BackColor", Color.Silver);
     t.run();
 }
示例#16
0
        private void InitialInfoPaneComponents()
        {
            FieldMaxWidth = InfoPane.Width - PanePadding * 2;
            // subtotal
            InsertFieldHeader(Root.GetMsg("cart.subtotal"), InfoPane);
            InsertField(FieldSubtotal, InfoPane, typeof(Label));
            // discount
            InsertFieldHeader(Root.GetMsg("cart.discounted"), InfoPane);
            InsertField(FieldDiscounted, InfoPane, typeof(Label));
            // total
            InsertFieldHeader(Root.GetMsg("cart.total"), InfoPane);
            InsertField(FieldTotal, InfoPane, typeof(Label));
            // panel for contain optional delivery inputs
            Panel dPane = new Panel();
            dPane.Visible = false;
            dPane.AutoSize = true;
            // is delivery item (for checkout only)
            if (IsCheckout)
            {
                InsertFieldHeader(Root.GetMsg("cart.delivery"), InfoPane);
                InsertField(FieldDelivery, InfoPane, typeof(MetroCheckBox));
            }
            // customer name
            FieldCustomerName = new MetroTextBox(FieldMaxWidth - 6 * 2, 32);
            InsertFieldHeader(Root.GetMsg("cart.cust-name"), dPane);
            InsertField(FieldCustomerName, dPane, typeof(MetroTextBox));
            FieldCustomerName.KeyPress += Validation.NonNumberField;
            // address
            FieldAddress = new MetroTextBox(FieldMaxWidth - 6 * 2, 64);
            InsertFieldHeader(Root.GetMsg("cart.cust-addr"), dPane);
            InsertField(FieldAddress, dPane, typeof(MetroTextBox));
            FieldAddress.Multiline = true;
            // phone
            FieldPhoneNum = new MetroTextBox(FieldMaxWidth - 6 * 2, 32);
            InsertFieldHeader(Root.GetMsg("cart.cust-phone"), dPane);
            InsertField(FieldPhoneNum, dPane, typeof(MetroTextBox));
            FieldPhoneNum.KeyPress += (sender, e) => { Validation.NumberField(sender, e, 8); };
            // insert optional delivery inputs panel
            dPane.Top = FieldsOffsetY;
            InfoPane.Controls.Add(dPane);
            FieldsOffsetY += dPane.Height + FieldsPadding;
            Size dPaneSavedSize = new Size(dPane.Size.Width, dPane.Size.Height);
            dPane.AutoSize = false;
            if (IsCheckout) dPane.Size = new Size(dPaneSavedSize.Width, 0);
            dPane.Visible = true;
            // padding for buttons
            FieldsOffsetY += 12;
            // PayByCash
            PayByCash.AutoSize = true;
            int btnWidth = (int)(FieldMaxWidth * .4);
            PayByCash.MinimumSize = new Size(btnWidth, 48);
            PayByCash.Padding = new Padding(32, 0, 0, 0);
            PayByCash.Left = FieldMaxWidth / 2 - btnWidth - FieldsPadding;
            PayByCash.Paint += (sender, e) =>
            {
                Image im = Properties.Resources.money;
                SizeF size = e.Graphics.MeasureString(PayByCash.Text, PayByCash.Font);
                e.Graphics.DrawImage(im, (btnWidth - size.Width) / 2 - PayByCash.Padding.Left / 2, PayByCash.Height / 2 - im.Height / 2);
            };
            PayByCash.Click += (sender, e) => { DoPayment(true); };
            PayByCash.Top = FieldsOffsetY - (IsCheckout ? dPaneSavedSize.Height : 0);
            PayByCash.Text = Root.GetMsg("cart.cash");
            InfoPane.Controls.Add(PayByCash);
            // PayByCreditCard
            PayByCreditCard.MinimumSize = new Size(btnWidth, 48);
            PayByCreditCard.Padding = PayByCash.Padding;
            PayByCreditCard.Left = FieldMaxWidth / 2 + FieldsPadding;
            PayByCreditCard.Paint += (sender, e) =>
            {
                Image im = Properties.Resources.credit_card;
                SizeF size = e.Graphics.MeasureString(PayByCreditCard.Text, PayByCreditCard.Font);
                e.Graphics.DrawImage(im, (btnWidth - size.Width) / 2 - PayByCreditCard.Padding.Left / 2, PayByCreditCard.Height / 2 - im.Height / 2);
            };
            PayByCreditCard.Click += (sender, e) => { DoPayment(false); };
            PayByCreditCard.Top = FieldsOffsetY - (IsCheckout ? dPaneSavedSize.Height : 0);
            PayByCreditCard.Text = Root.GetMsg("cart.card");
            InfoPane.Controls.Add(PayByCreditCard);
            int savedPaymentButtonOffsetY = FieldsOffsetY;
            FieldsOffsetY += PayByCreditCard.Height + FieldsPadding;

            // animate for slide down
            InfoPane.Top = _This.ContentPanel.Height / 2 - InfoPane.Height / 2;
            int savedInfoPaneY = InfoPane.Top;
            int savedInfoPaneHeight = InfoPane.Height;
            InfoPane.AutoSize = false;
            InfoPane.Height = savedInfoPaneHeight + (IsCheckout ? 0 : dPaneSavedSize.Height);
            if (IsCheckout)
            {
                FieldDelivery.CheckedChanged += (sender, e) =>
                {
                    if (FieldDelivery.Checked)
                    {
                        Transition t = new Transition(new TransitionType_EaseInEaseOut(250));
                        t.add(dPane, "Height", dPaneSavedSize.Height);
                        t.add(PayByCash, "Top", savedPaymentButtonOffsetY);
                        t.add(PayByCreditCard, "Top", savedPaymentButtonOffsetY);
                        t.add(InfoPane, "Height", savedInfoPaneHeight + dPaneSavedSize.Height);
                        t.add(InfoPane, "Top", savedInfoPaneY - dPaneSavedSize.Height / 2);
                        t.run();
                    }
                    else
                    {
                        dPane.AutoSize = false;
                        Transition t = new Transition(new TransitionType_EaseInEaseOut(250));
                        t.add(dPane, "Height", 0);
                        t.add(PayByCash, "Top", savedPaymentButtonOffsetY - dPaneSavedSize.Height);
                        t.add(PayByCreditCard, "Top", savedPaymentButtonOffsetY - dPaneSavedSize.Height);
                        t.add(InfoPane, "Height", savedInfoPaneHeight);
                        t.add(InfoPane, "Top", savedInfoPaneY);
                        t.run();
                    }
                };
            }
            else dPane.Size = dPaneSavedSize;
        }
        private void CreateRetourManagement()
        {
            if (_retourManagement != null) {
                return;
            }

            if (_reservationManagement != null || _empruntManagement != null) {
                if (_reservationManagement != null){
                    Controls.Remove(_reservationManagement);
                    Controls.Remove(_empruntManagement);
                }
                if (_reservationManagement != null) {
                    _reservationManagement.Dispose();
                    _reservationManagement = null;
                }
                if (_empruntManagement != null) {
                    _empruntManagement.Dispose();
                    _empruntManagement = null;
                }
            }

            _retourManagement = new RetourManagement(this) {Location = new Point(panel1.Width + 20, 56)};

            var t1 = new Transition(new TransitionType_EaseInEaseOut(1000));
            t1.add(this, "Width", _dashboardWidth + _retourManagement.Width + 10);
            t1.add(lblBibliothequeTitle, "Left", _lblBibliothequeTitleLocationX + _retourManagement.Width + 10);
            t1.add(cmbBibliotheque, "Left", _cmbBibliothequeLocationX + _retourManagement.Width + 10);

            Controls.Add(_retourManagement);

            t1.run();
        }
 /// <summary>
 /// Creates and immediately runs a transition on the property passed in.
 /// </summary>
 public static void run(object target, string strPropertyName, object destinationValue, ITransitionType transitionMethod)
 {
     Transition t = new Transition(transitionMethod);
     t.add(target, strPropertyName, destinationValue);
     t.run();
 }
示例#19
0
        void AnimateMenuPanel()
        {
            //Util.Animate(menuPanel, Util.Effect.Slide, 100, 0); this.Refresh();

            menuPanel.BringToFront();
            // Left border and bottom left cornerborder would get overlapped otherwise
            LeftBorderPanel.BringToFront();
            BottomLeftCornerPanel.BringToFront();

            #region Animation
            if (this.WindowState == FormWindowState.Normal)
            {
                if (menuPanel.Left == -menuPanel.Width - 1)
                {
                    Transition t = new Transition(new TransitionType_Deceleration(300)); t.add(menuPanel, "Left", 1); t.run();
                }
                else
                {
                    Transition t = new Transition(new TransitionType_Deceleration(300)); t.add(menuPanel, "Left", -menuPanel.Width - 1); t.run();
                }
            }
            else
            {
                if (menuPanel.Left == -menuPanel.Width)
                {
                    Transition t = new Transition(new TransitionType_Deceleration(300)); t.add(menuPanel, "Left", 0); t.run();
                }
                else
                {
                    Transition t = new Transition(new TransitionType_Deceleration(300)); t.add(menuPanel, "Left", -menuPanel.Width); t.run();
                }
            }
            #endregion
        }
示例#20
0
 private void ShowAssistant()
 {
     MicPanel.Location = new System.Drawing.Point(((ScreenWidth / 3) - MicPanel.Width) / 2, Mic.Location.Y + 10);
     Transition t = new Transition(new TransitionType_Deceleration(500));
     t.add(this, "Top", ScreenHeight - 150);
     hidden = false;
     t.run();
 }
示例#21
0
        private void pictureBox1_Click_1(object sender, EventArgs e)
        {
            if ((authorResultsListView.Visible == true && authStats != null && authStats.getNumberOfPapers() > 0) || (journalResultsListView.Visible == true && journalStats != null && journalStats.getNumberOfPapers() > 0))
            {

                graphsChart.Titles.Clear();
                Transition t = new Transition(new TransitionType_EaseInEaseOut(500));
                t.add(graphsPanel, "Top", 111);
                t.run();
                graphsChart.Series["Series1"].Points.Clear();

                if (graphComboBox.SelectedItem == null) graphComboBox.SelectedItem = "Citations of Publications Per Year";
                else{
                if (graphComboBox.Text.Equals("Citations of Publications Per Year"))
                {
                    graphsChart.Titles.Add("Citations of Publications Per Year");
                    graphsChart.Titles.Add("Citations").Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Left;
                    graphsChart.Titles.Add("Year").Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Bottom;

                    int currYear;
                    int j;
                    int currCitations = 0;
                    graphPapers = Papers;
                    sortPapersByYearGraph(true);
                    for (j = 0; j < graphPapers.Count; j++)
                    {
                        if (graphPapers[j].Year > 2) break;

                    }

                    if (j != graphPapers.Count)
                    {
                        currYear = graphPapers[j].Year;

                        for (int i = j; i < graphPapers.Count; i++)
                        {
                            if (currYear == graphPapers[i].Year)
                            {

                                currCitations += graphPapers[i].NumberOfCitations;

                            }
                            else
                            {

                                graphsChart.Series["Series1"].Points.AddXY(currYear, currCitations);
                                currYear = graphPapers[i].Year;
                                currCitations = graphPapers[i].NumberOfCitations;

                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Graphing data not available!");
                    }

                }
                else if (graphComboBox.Text.Equals("Publications Per Year"))
                {

                    graphsChart.Titles.Add("Publications Per Year");
                    graphsChart.Titles.Add("Publications").Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Left;
                    graphsChart.Titles.Add("Year").Docking = System.Windows.Forms.DataVisualization.Charting.Docking.Bottom;

                    int currYear;
                    int j;
                    int currpublic = 0;
                    graphPapers = Papers;
                    sortPapersByYearGraph(true);
                    for (j = 0; j < graphPapers.Count; j++)
                    {
                        if (graphPapers[j].Year > 2) break;

                    }

                    if (j != graphPapers.Count)
                    {
                        currYear = graphPapers[j].Year;

                        for (int i = j; i < graphPapers.Count; i++)
                        {
                            if (currYear == graphPapers[i].Year)
                            {

                                currpublic++;

                            }
                            else
                            {

                                graphsChart.Series["Series1"].Points.AddXY(currYear, currpublic);
                                currYear = graphPapers[i].Year;
                                currpublic = 1;
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Graphing data not available!");
                    }
                }

            }
            }
            else
                MessageBox.Show("Please select an author or journal before viewing graphs");
        }
示例#22
0
文件: OrderRow.cs 项目: mahitosh/HRA4
        private void deleteButton_Click(object sender, EventArgs e)
        {
            ((OrdersView)owningView).Finalized -= new EventHandler<OrdersView.FinalizedEventArgs>(OrderRow_Finalized);
            SessionManager.Instance.MetaData.OrderTypes.ReleaseListeners(this);

            //Transition.run(this, "BackColor", Color.Red, new TransitionType_Flash(1, 100));
            t = new Transition(new TransitionType_Flash(1, 50));
            t.add(this, "BackColor", Color.Gray);
            t.TransitionCompletedEvent += new EventHandler<Transition.Args>(t_TransitionCompletedEvent);

            t.run();
        }
示例#23
0
文件: MetroForm.cs 项目: nodegin/dhs
 public virtual void AnimateShowForm(EventHandler<Transition.Args> handler = null)
 {
     this.Show();
     Transition t = new Transition(new TransitionType_EaseInEaseOut(100));
     int tempY = this.Location.Y;
     this.CenterToScreen();
     int centerY = this.Location.Y;
     this.Top = tempY;
     t.add(this, "Top", centerY);
     t.add(this, "Opacity", 1.0);
     if (handler != null) t.TransitionCompletedEvent += handler;
     t.run();
 }
示例#24
0
 private void HideAssistant()
 {
     Transition t = new Transition(new TransitionType_Deceleration(500));
     t.add(this, "Top", ScreenHeight-1);
     hidden = true;
     t.run();
     MessagePanelz.Visible = false;
     DebuggerPanel.Visible = false;
     MessagePanelz.Height = 5;
 }
示例#25
0
文件: MetroForm.cs 项目: nodegin/dhs
 public void AnimateHideForm(EventHandler<Transition.Args> handler = null)
 {
     Transition t = new Transition(new TransitionType_EaseInEaseOut(100));
     t.add(this, "Top", this.Location.Y + 48);
     t.add(this, "Opacity", 0.0);
     if (handler != null) t.TransitionCompletedEvent += handler;
     t.run();
 }
示例#26
0
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     Transition t = new Transition(new TransitionType_EaseInEaseOut(500));
     t.add(graphsPanel, "Top", -900);
     t.run();
 }
示例#27
0
        /// <summary>
        /// Called when the "Text Transition" button is pressed.
        /// </summary>
        private void cmdTextTransition_Click(object sender, EventArgs e)
        {
            // We transition four properties simulataneously here:
            // - The two labels' text is changed.
            // - The two labels' colors are changed.

            // We work out the new text and colors to transition to...
            string strText1, strText2;
            Color color1, color2;
            if (lblTextTransition1.Text == STRING_SHORT)
            {
                strText1 = STRING_LONG;
                color1 = Color.Red;
                strText2 = STRING_SHORT;
                color2 = Color.Blue;
            }
            else
            {
                strText1 = STRING_SHORT;
                color1 = Color.Blue;
                strText2 = STRING_LONG;
                color2 = Color.Red;
            }

            // We create a transition to animate all four properties at the same time...
            Transition t = new Transition(new TransitionType_Linear(1000));
            t.add(lblTextTransition1, "Text", strText1);
            t.add(lblTextTransition1, "ForeColor", color1);
            t.add(lblTextTransition2, "Text", strText2);
            t.add(lblTextTransition2, "ForeColor", color2);
            t.run();
        }
示例#28
0
        public void ShowMenu(string menuName)
        {
            if (menuName.Equals(CurrentlyFocused.Name))
                return;

            MetroMenuItem target = GetMenuItem(menuName);

            if (target == null)
                throw new InvalidOperationException("Menu by the name of " + menuName + " could not be found..");

            this.Invoke(delegate()
            {
                //-- Don't want this control resize as it's losing focus..
                CurrentlyFocused.Control.Anchor = AnchorStyles.Left | AnchorStyles.Top;

                //-- Should I also make it invisible? Will this improve performance? Since technically the control doesn't have
                //-- to be drawn..
                //CurrentlyFocused.Control.Visible = false;

                //-- Make sure the control that will be focused is the same size as the parent.
                target.Control.Size = this.Size;

                //-- Definitely want this control to resize with the parent now - it's in focus!
                target.Control.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;

                if (target.MenuTransition == MetroMenuTransition.Instant)
                {
                    target.Control.Left = 0;
                    target.Control.BringToFront();
                }
                else if (target.MenuTransition == MetroMenuTransition.EaseIn)
                {
                    int direction = 1;

                    if (MenuItems.IndexOf(target) < MenuItems.IndexOf(CurrentlyFocused))
                        direction = -1;

                    target.Control.Left = this.Width * direction;
                    target.Control.BringToFront();

                    Transition t = new Transition(new TransitionType_EaseInEaseOut(500));
                    t.add(target.Control, "Left", 0);
                    t.add(CurrentlyFocused.Control, "Left", -this.Width * direction);
                    t.run();
                }
            });

            CurrentlyFocused = target;
        }
示例#29
0
        void ToggleNoInternetPanel()
        {
            // avoid border overlapping
            TopBorderPanel.BringToFront();
            TopLeftCornerPanel.BringToFront();
            TopRightCornerPanel.BringToFront();

            if (this.WindowState == FormWindowState.Normal)
            {
                if (this.Size != Screen.PrimaryScreen.Bounds.Size)
                {
                    if (nointernet_panel.Top == 0)
                    {
                        nointernet_panel.Show();
                        Transition t = new Transition(new TransitionType_Deceleration(450)); t.add(nointernet_panel, "Top", 31); t.run();
                    }
                    else
                    {
                        Transition t = new Transition(new TransitionType_Deceleration(450)); t.add(nointernet_panel, "Top", 0); t.run();
                    }
                }
                else
                if (nointernet_panel.Top == -nointernet_panel.Height)
                {
                    nointernet_panel.Show(); TopBorderPanel.Hide(); TopLeftCornerPanel.Hide(); TopRightCornerPanel.Hide();
                    Transition t = new Transition(new TransitionType_Deceleration(450)); t.add(nointernet_panel, "Top", 0); t.run();
                }
                else
                {
                    Transition t = new Transition(new TransitionType_Deceleration(450)); t.add(nointernet_panel, "Top", -nointernet_panel.Height); t.run();
                }
            }
            else
            {
                if (nointernet_panel.Top == 0)
                {
                    nointernet_panel.Show();
                    Transition t = new Transition(new TransitionType_Deceleration(450)); t.add(nointernet_panel, "Top", 30); t.run();
                }
                else
                {
                    Transition t = new Transition(new TransitionType_Deceleration(450)); t.add(nointernet_panel, "Top", 0); t.run();
                }
            }

            menuPanel.BringToFront(); titlebar.BringToFront();
            //if (nointernet_panel.Visible == true) SetTitlebarColor(nointernet_panel.BackColor, Color.White);
            //else SetTitlebarColor(GetTitlebarColoring(), Color.White);
        }
 private void FadePicBoxes(Control picbox, float Opacity)
 {
     var fade = new Transition(new TransitionType_Linear(400));
     fade.add(picbox, "Opacity", Opacity);
     fade.run();
 }
示例#31
0
 void AnimateController()
 {
     if (currentCameraLabel.Top == 0)
     {
         Transition t = new Transition(new TransitionType_Acceleration(350)); t.add(cameralistDropDownButton, "Top", -cameralistDropDownButton.Width); t.add(currentCameraLabel, "Top", -currentCameraLabel.Width); t.run();
     }
     else
     {
         Transition t = new Transition(new TransitionType_Deceleration(500)); t.add(cameralistDropDownButton, "Top", 0); t.add(currentCameraLabel, "Top", 0); t.run();
     }
 }
示例#32
0
 private static void FadeLinkTo(LinkLabel l, Color c)
 {
     var changeColorTransition = new Transition(new TransitionType_Linear(300));
     changeColorTransition.add(l, "LinkColor", c);
     changeColorTransition.run();
 }
        private void ResizeDynamicWindow(Control objControl)
        {
            var t1 = new Transition(new TransitionType_EaseInEaseOut(1000));
            t1.add(this, "Width", _dashboardWidth + objControl.Width + 10);
            t1.add(lblBibliotheque, "Left", _lblBibliothequeLocationX + objControl.Width + 10);
            t1.add(lblBibliothequeTitle, "Left", _lblBibliothequeTitleLocationX + objControl.Width + 10);
            t1.add(lblDtLastVisite, "Left", _lblDtLastLocationX + objControl.Width + 10);
            t1.add(lblDtLastVisiteTitle, "Left", _lblDtLastVisiteTitleLocationX + objControl.Width + 10);

            t1.run();
        }