Ejemplo n.º 1
0
 public void SmileySelect()
 {
     if (whichPlayerSelecting == selectionMode.PONESELECTION)
     {
         pOneSelection        = 0;
         whichPlayerSelecting = selectionMode.PTWOSELECTION;
     }
     else if (whichPlayerSelecting == selectionMode.PTWOSELECTION)
     {
         pTwoSelection        = 0;
         whichPlayerSelecting = selectionMode.READYTOGO;
     }
 }
 public void TyreseSelect()
 {
     if (whichPlayerSelecting == selectionMode.PONESELECTION)
     {
         pOneSelection = 2;
         whichPlayerSelecting = selectionMode.PTWOSELECTION;
     }
     else if (whichPlayerSelecting == selectionMode.PTWOSELECTION)
     {
         pTwoSelection = 2;
         whichPlayerSelecting = selectionMode.READYTOGO;
     }
 }
Ejemplo n.º 3
0
 //decide which function to run inside revit ( this is called only in the execute method of the handler)
 public void selectionControler(selectionMode sel, UIApplication app)
 {
     if (sel == selectionMode.One)
     {
         renumberingOrigin = getCurrentSelection();
     }
     else if (sel == selectionMode.All)
     {
         unorderedElementIds = getCurrentSelection();
         getCommonParameters();
     }
     else if (sel == selectionMode.Run)
     {
         Run();
     }
 }
Ejemplo n.º 4
0
 void Start()
 {
     whichPlayerSelecting = selectionMode.PONESELECTION;
 }
Ejemplo n.º 5
0
 public void pOneSelect()
 {
     whichPlayerSelecting = selectionMode.PONESELECTION;
 }
 void Start()
 {
     whichPlayerSelecting = selectionMode.PONESELECTION;
 }
 public void pOneSelect()
 {
     whichPlayerSelecting = selectionMode.PONESELECTION;
 }
Ejemplo n.º 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="button"></param>
        /// <param name="e"></param>
        /// <param name="isIngepland"></param>
        /// <param name="isAangevraagd"></param>
        /// <param name="isSelected"></param>
        /// <param name="quarter"></param>
        private void SetMouseActions(Border button, MouseEventArgs e, bool isIngepland, bool isAangevraagd, bool isSelected, int quarter)
        {
            try
            {
                //if (IsOwner || (quarter == 1 && IsEnabledQ1) || (quarter == 2 && IsEnabledQ2) || (quarter == 3 && IsEnabledQ3) || (quarter == 4 && IsEnabledQ4))
                if (IsOwner)
                {
                    if ((quarter == 1 && IsEnabledQ1) || (quarter == 2 && IsEnabledQ2) || (quarter == 3 && IsEnabledQ3) || (quarter == 4 && IsEnabledQ4))
                    {
                        //Mouse.SetCursor(Cursors.SizeWE);
                    }



                    if (e.LeftButton == MouseButtonState.Pressed)
                    {
                        Point absoluteScreenPos = PointToScreen(Mouse.GetPosition(this));
                        ApplicationState.SetValue("MouseLastEnterPosition", this.Uur * 4 + quarter);


                        if ((selectionDirection)ApplicationState.GetValue <int>("selectionDirection") == selectionDirection.Unknown && ApplicationState.GetValue <int>("MouseFirstEnterPosition") > 0 && ApplicationState.GetValue <int>("MouseLastEnterPosition") > 0)
                        {
                            if (ApplicationState.GetValue <int>("MouseFirstEnterPosition") > ApplicationState.GetValue <int>("MouseLastEnterPosition"))
                            {
                                ApplicationState.SetValue("selectionDirection", selectionDirection.Left);
                            }
                            else if (ApplicationState.GetValue <int>("MouseFirstEnterPosition") < ApplicationState.GetValue <int>("MouseLastEnterPosition"))
                            {
                                ApplicationState.SetValue("selectionDirection", selectionDirection.Right);
                            }
                        }


                        if (!blnIsMouseButtonPressed)
                        {
                            //Mouse.SetCursor(Cursors.SizeWE);


                            // test to lock the mouse
                            System.Drawing.Rectangle r = new System.Drawing.Rectangle(10, (int)absoluteScreenPos.Y, 2000, (int)absoluteScreenPos.Y + 1);
                            ClipCursor(ref r);

                            intPosY = Convert.ToInt32(absoluteScreenPos.Y - Mouse.GetPosition(this).Y + 30);
                            blnIsMouseButtonPressed = true;

                            if (ApplicationState.GetValue <int>("MouseFirstEnterPosition") == 0)
                            {
                                ApplicationState.SetValue("MouseFirstEnterPosition", this.Uur * 4 + quarter);
                            }

                            // bij eerste click, stel de selectionMode in
                            if ((selectionMode)ApplicationState.GetValue <int>("selectionMode") == selectionMode.Unknown)
                            {
                                if (isSelected)
                                {
                                    ApplicationState.SetValue("selectionMode", (int)selectionMode.Deselecting);
                                }
                                else
                                {
                                    ApplicationState.SetValue("selectionMode", (int)selectionMode.Selecting);
                                }
                            }
                        }

                        // are we selecting or deselecting
                        selectionMode smode = (selectionMode)ApplicationState.GetValue <int>("selectionMode");


                        MoveCursor();

                        if (IsAllowedToChange(quarter, true))
                        {
                            switch (quarter)
                            {
                            case 1:
                                if (isEnabledQ1)
                                {
                                    if (smode == selectionMode.Selecting)
                                    {
                                        IsSelectedQ1   = true;
                                        IsDeSelectedQ1 = false;

                                        ProjectDagViewProjectUur vpSender = (ProjectDagViewProjectUur)this;
                                        SetAllColors(vpSender);

                                        //ToggleOthers(vpSender, quarter, 0);
                                    }
                                    else if (smode == selectionMode.Deselecting)
                                    {
                                        IsSelectedQ1   = false;
                                        IsDeSelectedQ1 = true;

                                        ProjectDagViewProjectUur vpSender = (ProjectDagViewProjectUur)this;
                                        SetAllColors(vpSender);
                                    }
                                }
                                break;

                            case 2:
                                if (isEnabledQ2)
                                {
                                    if (smode == selectionMode.Selecting)
                                    {
                                        IsSelectedQ2   = true;
                                        IsDeSelectedQ2 = false;

                                        ProjectDagViewProjectUur vpSender = (ProjectDagViewProjectUur)this;
                                        SetAllColors(vpSender);

                                        //ToggleOthers(vpSender, quarter, 0);
                                    }
                                    else if (smode == selectionMode.Deselecting)
                                    {
                                        IsSelectedQ2   = false;
                                        IsDeSelectedQ2 = true;

                                        ProjectDagViewProjectUur vpSender = (ProjectDagViewProjectUur)this;
                                        SetAllColors(vpSender);
                                    }
                                }
                                break;

                            case 3:
                                if (isEnabledQ3)
                                {
                                    if (smode == selectionMode.Selecting)
                                    {
                                        IsSelectedQ3   = true;
                                        IsDeSelectedQ3 = false;

                                        ProjectDagViewProjectUur vpSender = (ProjectDagViewProjectUur)this;
                                        SetAllColors(vpSender);

                                        //ToggleOthers(vpSender, quarter, 0);
                                    }
                                    else if (smode == selectionMode.Deselecting)
                                    {
                                        IsSelectedQ3   = false;
                                        IsDeSelectedQ3 = true;

                                        ProjectDagViewProjectUur vpSender = (ProjectDagViewProjectUur)this;
                                        SetAllColors(vpSender);
                                    }
                                }
                                break;

                            case 4:
                                if (isEnabledQ4)
                                {
                                    if (smode == selectionMode.Selecting)
                                    {
                                        IsSelectedQ4   = true;
                                        IsDeSelectedQ4 = false;

                                        ProjectDagViewProjectUur vpSender = (ProjectDagViewProjectUur)this;
                                        SetAllColors(vpSender);

                                        //ToggleOthers(vpSender, quarter, 0);
                                    }
                                    else if (smode == selectionMode.Deselecting)
                                    {
                                        IsSelectedQ4   = false;
                                        IsDeSelectedQ4 = true;

                                        ProjectDagViewProjectUur vpSender = (ProjectDagViewProjectUur)this;
                                        SetAllColors(vpSender);
                                    }
                                }
                                break;
                            }
                        }
                    }

                    else if (e.LeftButton == MouseButtonState.Released)
                    {
                        // test release mouse again
                        ClipCursor(IntPtr.Zero);

                        if (blnIsMouseButtonPressed)
                        {
                            ApplicationState.SetValue("selectionDirection", (int)selectionDirection.Unknown);
                            ApplicationState.SetValue("selectionMode", (int)selectionMode.Unknown);
                            ApplicationState.SetValue("LastMouseLeavePosition", 0);
                            ApplicationState.SetValue("MouseFirstEnterPosition", 0);

                            RaiseEvent(new RoutedEventArgs(VakmanDagViewEvent, this));

                            blnIsMouseButtonPressed = false;
                        }
                    }
                    else if (e.RightButton == MouseButtonState.Released)
                    {
                        if (blnIsMouseButtonPressed)
                        {
                            ApplicationState.SetValue("selectionDirection", (int)selectionDirection.Unknown);
                            ApplicationState.SetValue("selectionMode", (int)selectionMode.Unknown);
                            ApplicationState.SetValue("LastMouseLeavePosition", 0);
                            ApplicationState.SetValue("MouseFirstEnterPosition", 0);

                            RaiseEvent(new RoutedEventArgs(VakmanDagViewEvent, this));

                            blnIsMouseButtonPressed = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                // do something here
                //MessageBox.Show("Er is een error opgetreden, het systeem was nog niet klaar met het verwerken van de uren van de vorige actie. U kunt nu weer verder gaan.");
            }
        }