예제 #1
1
        /// <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());
            }
        }
예제 #4
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();
 }
예제 #5
0
        public ConfigMount()
        {
            InitializeComponent();

            var delay = new Transition(new TransitionType_Linear(2000));
            var fadeIn = new Transition(new TransitionType_Linear(800));

            _ErrorTransition = new[] { delay, fadeIn };

            _NoErrorTransition = new Transition(new TransitionType_Linear(10));

            //setup button actions
            foreach (var btn in Controls.Cast<Control>().OfType<Button>())
                btn.Click += HandleButtonClick;

            LNK_wiki.MouseEnter += (s, e) => FadeLinkTo((LinkLabel)s, Color.CornflowerBlue);
            LNK_wiki.MouseLeave += (s, e) => FadeLinkTo((LinkLabel)s, Color.WhiteSmoke);

            SetErrorMessageOpacity();

            comboBox1.Items.AddRange(Enum.GetNames(typeof(ChannelCameraShutter)));

            if (MainV2.comPort.MAV.cs.firmware == MainV2.Firmwares.ArduPlane)
            {
                mavlinkComboBoxTilt.Items.AddRange(Enum.GetNames(typeof(Channelap)));
                mavlinkComboBoxRoll.Items.AddRange(Enum.GetNames(typeof(Channelap)));
                mavlinkComboBoxPan.Items.AddRange(Enum.GetNames(typeof(Channelap)));
            }
            else
            {
                mavlinkComboBoxTilt.Items.AddRange(Enum.GetNames(typeof(Channelac)));
                mavlinkComboBoxRoll.Items.AddRange(Enum.GetNames(typeof(Channelac)));
                mavlinkComboBoxPan.Items.AddRange(Enum.GetNames(typeof(Channelac)));
            }
        }
 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
        /// <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();
        }
예제 #8
0
        /// <summary>
        /// Finds any properties in the old-transition that are also in the new one,
        /// and removes them from the old one.
        /// </summary>
        private void removeDuplicates(Transition newTransition, Transition oldTransition)
        {
            // Note: This checking might be a bit more efficient if it did the checking
            //       with a set rather than looking through lists. That said, it is only done 
            //       when transitions are added (which isn't very often) rather than on the
            //       timer, so I don't think this matters too much.

            // We get the list of properties for the old and new transitions...
            IList<Transition.TransitionedPropertyInfo> newProperties = newTransition.TransitionedProperties;
            IList<Transition.TransitionedPropertyInfo> oldProperties = oldTransition.TransitionedProperties;

            // We loop through the old properties backwards (as we may be removing 
            // items from the list if we find a match)...
            for (int i = oldProperties.Count - 1; i >= 0; i--)
            {
                // We get one of the properties from the old transition...
                Transition.TransitionedPropertyInfo oldProperty = oldProperties[i];

                // Is this property part of the new transition?
                foreach (Transition.TransitionedPropertyInfo newProperty in newProperties)
                {
                    if (oldProperty.target == newProperty.target
                        &&
                        oldProperty.propertyInfo == newProperty.propertyInfo)
                    {
                        // The old transition contains the same property as the new one,
                        // so we remove it from the old transition...
                        oldTransition.removeProperty(oldProperty);
                    }
                }
            }
        }
예제 #9
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());
            }
        }
예제 #10
0
 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();
 }
예제 #11
0
 /// <summary>
 /// Checks if any existing transitions are acting on the same properties as the
 /// transition passed in. If so, we remove the duplicated properties from the 
 /// older transitions.
 /// </summary>
 private void removeDuplicates(Transition transition)
 {
     // We look through the set of transitions we're currently managing...
     foreach (KeyValuePair<Transition, bool> pair in m_Transitions)
     {
         removeDuplicates(transition, pair.Key);
     }
 }
		/// <summary>
		///   Processes the new <paramref name="transition" /> discovered by the <paramref name="worker " /> within the traversal
		///   <paramref name="context" />.
		/// </summary>
		/// <param name="context">The context of the model traversal.</param>
		/// <param name="worker">The worker that found the transition.</param>
		/// <param name="transition">The new transition that should be processed.</param>
		/// <param name="isInitialTransition">
		///   Indicates whether the transition is an initial transition not starting in any valid source state.
		/// </param>
		public unsafe void ProcessTransition(TraversalContext context, Worker worker, Transition* transition, bool isInitialTransition)
		{
			if (transition->Formulas[_formulaIndex])
				return;

			context.FormulaIsValid = false;
			context.LoadBalancer.Terminate();
			worker.CreateCounterExample(endsWithException: false, addAdditionalState: false);
		}
예제 #13
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);
 }
예제 #14
0
        /// <summary>
        /// Called when the transition we have just run has completed.
        /// </summary>
        private void OnTransitionCompleted(object sender, Transition.Args e)
        {
            // We unregister from the completed event...
            var transition = (Transition)sender;
            transition.TransitionCompletedEvent -= OnTransitionCompleted;

            // We remove the completed transition from our collection, and
            // run the next one...
            _listTransitions.RemoveFirst();
            RunNextTransition();
        }
예제 #15
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();
        }
예제 #17
0
        /// <summary>
        /// You register a transition with the manager here. This will start to run
        /// the transition as the manager's timer ticks.
        /// </summary>
        public void register(Transition transition)
        {
            lock (_lock)
            {
                // We check to see if the properties of this transition
                // are already being animated by any existing transitions...
                removeDuplicates(transition);

                // We add the transition to the collection we manage, and
                // observe it so that we know when it has completed...
                _transitions[transition] = true;
                transition.TransitionCompletedEvent += onTransitionCompleted;
            }
        }
예제 #18
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();
            }
        }
예제 #19
0
        public void Activate()
        {
            _presenter = new ConfigCameraStabModel(MainV2.comPort);
            presenterBindingSource.DataSource = _presenter;

            var delay = new Transition(new TransitionType_Linear(2000));
            var fadeIn = new Transition(new TransitionType_Linear(800));
            fadeIn.add(PBOX_WarningIcon, "Opacity", 1.0F);
            fadeIn.add(LBL_Error, "Opacity", 1.0F);
           
            _ErrorTransition = new[] { delay, fadeIn };

            _NoErrorTransition = new Transition(new TransitionType_Linear(10));
            _NoErrorTransition.add(PBOX_WarningIcon, "Opacity", 0.0F);
            _NoErrorTransition.add(LBL_Error, "Opacity", 0.0F);
             
            //setup button actions
            foreach (var btn in Controls.Cast<Control>().OfType<Button>())
                btn.Click += HandleButtonClick;


            _presenter.PropertyChanged += (s, e) =>
                    {
                        if (e.PropertyName == "HasError")
                        {
                            SetErrorMessageOpacity();
                        }
                    };
            
            _presenter.PropertyChanged += CheckCommandStates;
            LNK_wiki.MouseEnter += (s, e) => FadeLinkTo((LinkLabel)s, Color.CornflowerBlue);
            LNK_wiki.MouseLeave += (s, e) => FadeLinkTo((LinkLabel)s, Color.WhiteSmoke);

            SetErrorMessageOpacity();

            // Fix for mono bug where binding sources do not respect INPC notifications on POCOs
            if (MainV2.MONO)
            {
                _presenter.PropertyChanged += (s, e) => presenterBindingSource.ResetBindings(false);
            }

            _presenter.Load();
        }
예제 #20
0
        /// <summary>
        /// Called when a transition has completed. 
        /// </summary>
        private void onTransitionCompleted(object sender, Transition.Args e)
        {
            // We stop observing the transition...
            Transition transition = (Transition)sender;
            transition.TransitionCompletedEvent -= onTransitionCompleted;

            // We remove the transition from the collection we're managing...
            lock (_lock)
            {
                _transitions.Remove(transition);
            }
        }
예제 #21
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 FadePicBoxes(Control picbox, float Opacity)
 {
     var fade = new Transition(new TransitionType_Linear(400));
     fade.add(picbox, "Opacity", Opacity);
     fade.run();
 }
예제 #23
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;
        }
 private void ShowTransitionCompletedEvent(object sender, Transition.Args e)
 {
     if (SlideOutComplete != null)
         SlideOutComplete(this, EventArgs.Empty);
 }
 private void HideTransitionCompletedEvent(object sender, Transition.Args e)
 {
     this.Visible = false;
 }
 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();
 }
        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();
        }
예제 #28
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);
        }
예제 #29
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();
     }
 }
예제 #30
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
        }
예제 #31
0
 /// <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();
 }