예제 #1
0
        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right && this.Mode == ClickMode.AddRoom)
            {
                if (!this.points.Any())
                {
                    this.Mode = ClickMode.Normal;
                }
                else
                {
                    this.points.RemoveAt(this.points.Count - 1);
                }

                return;
            }

            switch (this.Mode)
            {
            case ClickMode.AddEhibtion:
                AddExhibition(new Exhibition()
                {
                    x = e.X, y = e.Y
                });
                this.Mode = ClickMode.Normal;
                break;

            case ClickMode.AddRoom:
                this.points.Add(new Point(e.X, e.Y));
                break;

            default:
                break;
            }
        }
예제 #2
0
        public void WriteSettings()
        {
            try
            {
                IniFile ini = new IniFile(TargetFile);
                ini.IniWriteValue("config", "Volume", Volume.ToString());
                ini.IniWriteValue("config", "AyahLastOpen", AyahLastOpen.ToString());
                ini.IniWriteValue("config", "SurahLastOpen", SurahLastOpen.ToString());
                ini.IniWriteValue("config", "ReciterLastOpen", ReciterLastOpen.ToString());
                ini.IniWriteValue("config", "LanguageLastOpen", LanguageLastOpen.ToString());
                ini.IniWriteValue("config", "JuzLastOpen", JuzLastOpen.ToString());
                ini.IniWriteValue("config", "UrlRecitation", UrlRecitation);

                ini.IniWriteValue("config", "VerseSize", VerseSize.ToString());
                ini.IniWriteValue("config", "ClickMode", ClickMode.ToString());
                ini.IniWriteValue("config", "PlayMode", PlayMode.ToString());
                ini.IniWriteValue("config", "isVoiceEnable", isVoiceEnable.ToString());
                ini.IniWriteValue("config", "isGestureEnable", isGestureEnable.ToString());
                ini.IniWriteValue("config", "isAutoShutdownEnable", isAutoShutdownEnable.ToString());
                ini.IniWriteValue("config", "ShutdownTime", ShutdownTime.ToString());
            }
            catch
            {
                throw;
            }
        }
예제 #3
0
        private static void Main()
        {
            const ClickMode clickMode    = ClickMode.Hover;
            var             comClickMode = EnumConvert <ClickMode, ComClickMode>(clickMode);

            Console.WriteLine(comClickMode);
        }
예제 #4
0
 private void OnClickModeChanged(ClickMode newClickMode)
 {
     if (!Enum.IsDefined(typeof(ClickMode), newClickMode))
     {
         throw new ArgumentException("Invalid ClickMode set.", nameof(newClickMode));
     }
 }
예제 #5
0
        /// <summary>
        /// PopupButtonModeProperty property changed handler.
        /// </summary>
        /// <param name="d">Picker that changed its PopupButtonMode.</param>
        /// <param name="e">Event arguments.</param>
        private static void OnPopupButtonModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Picker    source   = (Picker)d;
            ClickMode newValue = (ClickMode)e.NewValue;

            if (newValue != ClickMode.Hover &&
                newValue != ClickMode.Press &&
                newValue != ClickMode.Release)
            {
                // revert to old value
                source.SetValue(PopupButtonModeProperty, e.OldValue);

                // todo: move to resource
                string message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Invalid value: {0}",
                    newValue);

                throw new ArgumentOutOfRangeException("e", message);
            }

            if (source.DropDownToggleButton != null)
            {
                source.DropDownToggleButton.ClickMode = newValue;
            }
        }
예제 #6
0
        private void LeftCameraImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            angularResolution = w / horAngle;
            string msg;

            switch (clickMode)
            {
            case ClickMode.rotateCamera:
                msg = TurnCamera(e);
                break;

            case ClickMode.rotateDevice:
                msg = TurnDevice(e);
                break;

            case ClickMode.move:
                msg = MoveDevice(e);
                break;

            default:
                throw new ArgumentException("Unknown ClickMode!");
            }

            Send(msg);

            moveByClickButton.IsEnabled = true;
            turnByClickButton.IsEnabled = true;
            infoLabel.Content           = "";
            clickMode        = ClickMode.rotateCamera;
            imageArea.Cursor = Cursors.Arrow;
        }
        /// <summary>
        /// Mouse click on center of Button
        /// </summary>
        /// <param name="targetElement">A ButtonBase reference</param>
        public static void MouseClickButtonCenter(ButtonBase targetElement, ClickMode clickMode, MouseButton mouseButton)
        {
            InputHelper.MouseMoveToElementCenter(targetElement);
            //DispatcherOperations.WaitFor(DispatcherPriority.ApplicationIdle);

            switch (clickMode)
            {
            case ClickMode.Release:
                //Microsoft.Test.Input.Mouse.Click(mouseButton);
                break;

            case ClickMode.Press:
                //Microsoft.Test.Input.Mouse.Down(mouseButton);
                break;

            case ClickMode.Hover:
                throw new Exception("Fail: ClickMode.Hover is not supported in the MouseClickCenter method");
            }
            //DispatcherOperations.WaitFor(DispatcherPriority.ApplicationIdle);

            // Cleanup
            if (clickMode == ClickMode.Press)
            {
                //Microsoft.Test.Input.Mouse.Up(mouseButton);
                //DispatcherOperations.WaitFor(DispatcherPriority.ApplicationIdle);
            }
        }
예제 #8
0
        private static bool IsValidClickMode(object o)
        {
            ClickMode value = (ClickMode)o;

            return(value == ClickMode.Press ||
                   value == ClickMode.Release ||
                   value == ClickMode.Hover);
        }
예제 #9
0
 private void CancelClickButton_Click(object sender, RoutedEventArgs e)
 {
     moveByClickButton.IsEnabled = true;
     turnByClickButton.IsEnabled = true;
     infoLabel.Content           = "";
     clickMode        = ClickMode.rotateCamera;
     imageArea.Cursor = Cursors.Arrow;
 }
예제 #10
0
 private void TurnByClickButton_Click(object sender, RoutedEventArgs e)
 {
     moveByClickButton.IsEnabled = false;
     turnByClickButton.IsEnabled = false;
     infoLabel.Content           = "Click where to turn to";
     clickMode        = ClickMode.rotateDevice;
     imageArea.Cursor = Cursors.Cross;
 }
예제 #11
0
        public ClickableShapeGrid()
            : base()
        {
            clickMode      = ClickMode.None;
            SelectedStates = new List <bool>();

            AddHandler(Grid.MouseMoveEvent, new MouseEventHandler(gridMouseMove));
            AddHandler(Grid.MouseLeaveEvent, new MouseEventHandler(gridMouseMove));
        }
예제 #12
0
        private static bool IsValidClickMode(object o)
        {
            ClickMode mode = (ClickMode)o;

            if ((mode != ClickMode.Press) && (mode != ClickMode.Release))
            {
                return(mode == ClickMode.Hover);
            }
            return(true);
        }
예제 #13
0
    void HandleClick(Button btn, ClickMode btnMode)
    {
        if (last != null)
        {
            last.interactable = true;
        }

        last             = btn;
        btn.interactable = false;
        physics.SetClickMode(btnMode);
    }
예제 #14
0
 private void drawAreaBox_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         if (clickMode == ClickMode.ChoosingRectanglePoints)
         {
             clickMode = ClickMode.MovingElement;
             polygonsContainer.FinishPolygonBuilding(e.X, e.Y);
         }
     }
 }
예제 #15
0
 public virtual void Click(ClickMode clickMode)
 {
     if (clickMode == ClickMode.NoWait)
     {
         _element.ClickNoWait();
     }
     else
     {
         _element.Click();
     }
 }
예제 #16
0
 public virtual void Click(ClickMode clickMode)
 {
     if (clickMode == ClickMode.NoWait)
     {
         _element.ClickNoWait();
     }
     else
     {
         _element.Click();
     }
 }
    public void SwitchMode(ClickMode m)
    {
        previousMode = currentMode;
        if (previousMode == ClickMode.Destroy && m != ClickMode.Destroy)
        {
            EventManager.instance.MapChanged();
        }

        currentMode = m;
        EventManager.instance.ModeChanged(m);
    }
예제 #18
0
    private void InterpretMouse(Vector3 mouseWorldPos)
    {
        Vector3Int tilePos    = grid.WorldToCell(mouseWorldPos);
        Vector3    drawCoords = grid.GetCellCenterWorld(tilePos);

        switch (clickMode)
        {
        case ClickMode.PLACING:
            if (Input.GetMouseButtonDown(0))
            {
                clickPos = tilePos;
            }

            if (Input.GetMouseButtonUp(0))
            {
                if (clickPos == tilePos)
                {
                    if (PlaceMolecule(clickPos))
                    {
                        placedPos = drawCoords;
                        clickMode = ClickMode.DIRECTIONS;
                    }
                }
            }
            break;

        case (ClickMode.DIRECTIONS):
            if (Input.GetMouseButtonDown(0))
            {
                clickDirection = getMouseDirection(placedPos, mouseWorldPos);
            }

            if (Input.GetMouseButtonUp(0))
            {
                if (clickDirection == getMouseDirection(placedPos, mouseWorldPos))
                {
                    switch (PlaceDir())
                    {
                    case PlaceDirResult.INVALID:
                        break;

                    case PlaceDirResult.VALID_CONTINUE:
                        break;

                    case PlaceDirResult.VALID_STOP:
                        clickMode = ClickMode.PLACING;
                        break;
                    }
                }
            }
            break;
        }
    }
예제 #19
0
        private void newPolygonButton_Click(object sender, EventArgs e)
        {
            switch (clickMode)
            {
            case ClickMode.ChoosingRectanglePoints:
                polygonsContainer.DeleteCurrentlyBuildedPolygon();
                break;

            default:
                clickMode = ClickMode.ChoosingRectanglePoints;
                break;
            }
        }
        private static bool IsValidClickMode(object o)
        {
            ClickMode clickMode = (ClickMode)o;

            switch (clickMode)
            {
            case ClickMode.Press:
            case ClickMode.Release:
                return(true);

            default:
                return(clickMode == ClickMode.Hover);
            }
        }
예제 #21
0
 public void SetClickMode(ClickMode mode)
 {
     switch (mode)
     {
         case ClickMode.TwoFinger:
             this.clickMode = new TwoFingerClickMode();
             break;
         case ClickMode.SecondHand:
             this.clickMode = new SecondHandClickMode();
             break;
         case ClickMode.Hand:
             this.clickMode = new HandClickMode();
             break;
     }
 }
예제 #22
0
파일: ButtonBase.cs 프로젝트: ynkbt/moon
        private static void OnClickModePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ButtonBase source = d as ButtonBase;

            Debug.Assert(source != null,
                         "The source is not an instance of ButtonBase!");

            Debug.Assert(typeof(ClickMode).IsInstanceOfType(e.NewValue),
                         "The value is not an instance of ClickMode!");
            ClickMode value = (ClickMode)e.NewValue;

            if (value != ClickMode.Release && value != ClickMode.Press && value != ClickMode.Hover)
            {
                throw new ArgumentException(Resource.ButtonBase_OnClickModePropertyChanged_InvalidValue, "value");
            }
        }
예제 #23
0
    void OnGUI()
    {
        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("ReStart"))
        {
            ReStart();
        }

        switch (clickMode)
        {
        case ClickMode.Normal:
        {
            if (GUILayout.Button("Normal"))
            {
                clickMode = ClickMode.Flag;
            }
        }
        break;

        case ClickMode.Flag:
        {
            if (GUILayout.Button("Flag"))
            {
                clickMode = ClickMode.Question;
            }
        }
        break;

        case ClickMode.Question:
        {
            if (GUILayout.Button("Question"))
            {
                clickMode = ClickMode.Normal;
            }
        }
        break;
        }

        smallMap = GUILayout.Toggle(smallMap, "SmallMap");
        GUILayout.EndHorizontal();

        ShowResult();

        GUILayout.EndVertical();
    }
예제 #24
0
        public void SetClickMode(ClickMode mode)
        {
            switch (mode)
            {
            case ClickMode.TwoFinger:
                this.clickMode = new TwoFingerClickMode();
                break;

            case ClickMode.SecondHand:
                this.clickMode = new SecondHandClickMode();
                break;

            case ClickMode.Hand:
                this.clickMode = new HandClickMode();
                break;
            }
        }
예제 #25
0
        public IActionProvider Click(IEnumerable <IWebElement> elements, ClickMode clickMode = ClickMode.ClickAll)
        {
            switch (clickMode)
            {
            case ClickMode.ClickOne:
                var element = elements.FirstOrDefault();

                if (element != null)
                {
                    element.Click();
                }
                break;

            case ClickMode.ClickAny:
                elements.Apply(c => c.Click());
                break;

            case ClickMode.ClickAll:
                bool found = false;

                elements.Apply(c => { c.Click(); found = true; });

                if (!found)
                {
                    throw new Exception("No elements found in collection");
                }
                break;

            case ClickMode.ClickFirst:
                elements.First().Click();
                break;
            }

            var configuration = _actionProvider.UsingFixture.Configuration;

            var waitTime = (int)(configuration.FixtureImplicitWait * 1000);

            if (waitTime >= 0)
            {
                Thread.Sleep(waitTime);
            }

            return(configuration.AlwaysWaitForAjax ? _actionProvider.Wait.ForAjax().Then : _actionProvider);
        }
예제 #26
0
        public virtual IActionProvider Click(By selector, ClickMode clickMode = ClickMode.ClickAll)
        {
            switch (clickMode)
            {
            case ClickMode.ClickOne:
                _actionProvider.FindElement(selector).Click();
                break;

            case ClickMode.ClickAny:
                _actionProvider.FindElements(selector).Apply(c => c.Click());
                break;

            case ClickMode.ClickAll:
                var all = _actionProvider.FindElements(selector);

                if (all.Count == 0)
                {
                    throw new Exception("Could not locate any using selector: " + selector);
                }
                all.Apply(c => c.Click());
                break;

            case ClickMode.ClickFirst:
                var firstList = _actionProvider.FindElements(selector);

                if (firstList.Count == 0)
                {
                    throw new Exception("Could not locate any using selector: " + selector);
                }
                firstList[0].Click();
                break;
            }

            var configuration = _actionProvider.UsingFixture.Configuration;

            var waitTime = (int)(configuration.FixtureImplicitWait * 1000);

            if (waitTime >= 0)
            {
                Thread.Sleep(waitTime);
            }

            return(configuration.AlwaysWaitForAjax ? _actionProvider.Wait.ForAjax().Then : _actionProvider);
        }
예제 #27
0
        public static void Click(int x, int y, ClickMode mode, double speed, int clickDuration, double scaleX, double scaleY)
        {
            x = (int)(x * 65535 / SystemParameters.PrimaryScreenWidth);
            y = (int)(y * 65535 / SystemParameters.PrimaryScreenHeight);
            MoveTo(x, y, speed, scaleX, scaleY);

            if (mode == ClickMode.PushAndRelease || mode == ClickMode.Push)
            {
                mouse_event(0x8002, x, y, 0, 0);
                if (clickDuration > 0)
                {
                    Thread.Sleep(clickDuration);
                }
            }
            if (mode == ClickMode.PushAndRelease || mode == ClickMode.Release)
            {
                mouse_event(0x8004, x, y, 0, 0);
            }
        }
예제 #28
0
        public static void Click(int x, int y, ClickMode mode, double speed, int clickDuration)
        {
            x = (int)((x * 65535) / SystemParameters.PrimaryScreenWidth);
            y = (int)((y * 65535) / SystemParameters.PrimaryScreenHeight);
            MoveTo(x, y, speed);

            if(mode == ClickMode.PushAndRelease || mode == ClickMode.Push)
            {
                mouse_event(0x8002, x, y, 0, 0);
                if(clickDuration > 0)
                {
                    Thread.Sleep(clickDuration);
                }
            }
            if(mode == ClickMode.PushAndRelease || mode == ClickMode.Release)
            {
                mouse_event(0x8004, x, y, 0, 0);
            }
        }
예제 #29
0
        private void pictureBox1_DoubleClick(object sender, EventArgs e)
        {
            if (this.Mode != ClickMode.AddRoom)
            {
                return;
            }


            //Add a room based on the current points.
            if (this.points.Count > 2)
            {
                AddRoom(new Room()
                {
                    points = this.points.ToList()
                });
            }
            this.points.Clear();
            this.Mode = ClickMode.Normal;
        }
예제 #30
0
 /// <summary>
 /// Clicks the specified element selector.
 /// </summary>
 /// <param name="elementSelector">The element selector.</param>
 /// <param name="clickMode">The click mode.</param>
 /// <param name="conditions">The conditions.</param>
 public void Click(string elementSelector, ClickMode clickMode, MatchConditions conditions)
 {
     if (this.EnableRemoteExecution)
     {
         this.RemoteCommands.Add(new RemoteCommands.RemoteCommandDetails()
         {
             Name      = "Click",
             Arguments = new Dictionary <string, dynamic>()
             {
                 { "selector", elementSelector },
                 { "clickMode", clickMode.ToString() },
                 { "matchConditions", conditions.ToString() }
             }
         });
     }
     else
     {
         CurrentActionBucket.Add(() =>
         {
             var field = Provider.GetElement(elementSelector, conditions);
             field.Click(clickMode);
         });
     }
 }
예제 #31
0
파일: Form1.cs 프로젝트: OhmGeek/TimeLord
 private void toolStripButton4_Click(object sender, EventArgs e)
 {
     if (lv_tray.SelectedItems.Count == 0) return;
     mainViewMode = ClickMode.InsertFromTray;
     pb_mainView.Focus();
 }
예제 #32
0
파일: Form1.cs 프로젝트: OhmGeek/TimeLord
 private void toolStripButton2_Click(object sender, EventArgs e)
 {
     mainViewMode = ClickMode.FindRooms;
 }
예제 #33
0
파일: Form1.cs 프로젝트: OhmGeek/TimeLord
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     lbl_status.Text = "Select a period on the main view to view free staff.";
     mainViewMode = ClickMode.FindStaff;
 }
예제 #34
0
파일: Form1.cs 프로젝트: OhmGeek/TimeLord
        private void pb_staffView_MouseDown(object sender, MouseEventArgs e)
        {
            sw = new System.Diagnostics.Stopwatch();

            if (displayedItem == null) return;
            if (currentTT == null) return;

            if (mainViewMode != ClickMode.Normal) return; //gets rid of the issue when returning from tray.
            sw.Start();
            mainViewMode = ClickMode.Move;
        }
예제 #35
0
파일: Form1.cs 프로젝트: OhmGeek/TimeLord
        private void pb_staffView_MouseClick(object sender, MouseEventArgs e)
        {
            //After adding the new feature, please be sure to update the system maintenance!!!

            if (sw != null) sw.Stop();
            if (displayedItem != null)
            {
                displayedItem.selected = false;
                btn_locked.Checked = false;
                btn_invisible.Checked = false;
            }

            //Console.WriteLine("");
            //Console.WriteLine("Click detected: ");
            Rectangle cursor = new Rectangle(e.X, e.Y, 1, 1);

            int DayIndex = -1;

            do
            {
                DayIndex++;
            } while ((DayIndex < currentTT.Week.Count - 1) && (!currentTT.Week[DayIndex].dayBounds.IntersectsWith(cursor)));
            //Console.WriteLine("DayIndex: " + DayIndex);
            if (DayIndex >= currentTT.Week.Count) return;
            //if (!currentTT.Week[DayIndex].dayBounds.IntersectsWith(cursor)) return;

            int PeriodIndex = -1;

            do
            {
                PeriodIndex++;
            } while ((PeriodIndex < currentTT.Week[DayIndex].PeriodsInDay.Count - 1) && (!currentTT.Week[DayIndex].PeriodsInDay[PeriodIndex].periodBounds.IntersectsWith(cursor)));
            //Console.WriteLine("Period Index: " + PeriodIndex);
            if (PeriodIndex >= currentTT.Week[DayIndex].PeriodsInDay.Count) return;

            // if (!currentTT.Week[DayIndex].PeriodsInDay[PeriodIndex].periodBounds.IntersectsWith(cursor)) return;

            int StaffIndex = -1;

            do
            {
                StaffIndex++;
            } while ((StaffIndex < currentTT.Staff.Count - 1) && (!currentTT.Staff[StaffIndex].staffBounds.IntersectsWith(cursor)));
            //Console.WriteLine("Staff Index: " + StaffIndex);
            // if (!currentTT.Years[YearIndex].yearBounds.IntersectsWith(cursor)) return;
            if (StaffIndex >= currentTT.Staff.Count) return;
            Lesson selectedLesson = null;
            try
            {
                selectedLesson = (Lesson)currentTT.staffTT[DayIndex][PeriodIndex][StaffIndex];
            }
            catch (Exception)
            {
                return;
            }
            //Console.WriteLine("Status: " + mainViewMode);
            if (mainViewMode == ClickMode.AddLessonViaMenu)
            {
                mainViewMode = ClickMode.Normal;
                lessonView = new AddLesson();
                lessonView.currentTT = currentTT;
                lessonView.LoadData();
                lessonView.cb_teacherCode.SelectedIndex = StaffIndex;
                lessonView.cb_day.SelectedIndex = DayIndex;
                lessonView.cb_periodStart.SelectedIndex = PeriodIndex;
                lessonView.ShowDialog();

                lbl_status.Text = "Ready";
                return;
            }

            if (mainViewMode == ClickMode.Move && sw.ElapsedMilliseconds > timeForMove)
            {
                if (displayedItem.locked)
                {
                    MessageBox.Show("One cannot move a locked lesson. To move it, please unlock the lesson.", "Lesson locking");
                    return;
                }
                bool ConditionA = (displayedItem.TeacherAbbreviation != currentTT.Staff[StaffIndex].TeacherAbbreviation);
                bool ConditionB = (displayedItem.PeriodIndex != PeriodIndex);
                bool eventAfter = ConditionA;

                if (ConditionA) AddNodeToUndo(Event.MoveStaff, currentTT.GetIndexOfStaff(displayedItem.TeacherAbbreviation), StaffIndex, displayedItem, false,ConditionB);
                if (ConditionB) AddNodeToUndo(Event.MovePeriod, displayedItem.PeriodIndex, PeriodIndex, displayedItem, eventAfter,false);

                currentTT.MoveTeacher(displayedItem, Convert.ToByte(StaffIndex));
                currentTT.MovePeriods(displayedItem, Convert.ToByte(PeriodIndex));

                mainViewMode = ClickMode.Normal;
                RefreshViews();
                displayedItem.selected = true;
                return;
            }
            if (selectedLesson == null) displayedItem = null;
            else
            {

                selectedLesson.selected = true;
                displayedItem = selectedLesson;
                pb_staffView.Refresh();

                cb_year.SelectedIndex = selectedLesson.YearIndex;
                cb_room.SelectedIndex = currentTT.GetIndexOfRoom(selectedLesson.RoomCode);
                cb_teacher.SelectedIndex = StaffIndex;
                cb_subject.SelectedIndex = currentTT.GetIndexOfSubject(selectedLesson.SubjectAbbreviation);
                btn_locked.Checked = selectedLesson.locked;
                btn_invisible.Checked = selectedLesson.invisible;

                if (selectedLesson.locked)
                {
                    editLessonToolStripMenuItem.Enabled = false; //we can't edit anything that's locked.

                }
                else
                {
                    editLessonToolStripMenuItem.Enabled = true;
                }

                cb_homework.Text = Convert.ToString(selectedLesson.homeworkAmount);
                cb_form.Text = currentTT.Years[selectedLesson.YearIndex].Forms[selectedLesson.FormIndex].FormName;
            }
            mainViewMode = ClickMode.Normal;
        }
예제 #36
0
파일: Form1.cs 프로젝트: OhmGeek/TimeLord
        private void pb_roomView_MouseDown(object sender, MouseEventArgs e)
        {
            sw = new System.Diagnostics.Stopwatch();

            if (displayedItem == null) return;
            if (currentTT == null) return;

            if (mainViewMode != ClickMode.Normal) return; // avoids return to tray issue
            sw.Start();
            mainViewMode = ClickMode.Move;
        }
예제 #37
0
 public virtual void ChangeClickMode(ClickMode click)
 {
     clickMode = click;
 }
예제 #38
0
 /// <summary>
 /// Clicks the specified element selector.
 /// </summary>
 /// <param name="elementSelector">The element selector.</param>
 /// <param name="clickMode">The click mode.</param>
 public void Click(string elementSelector, ClickMode clickMode)
 {
     Click(elementSelector, clickMode, MatchConditions.None);
 }
예제 #39
0
 /// <summary>
 /// Clicks the specified element selector.
 /// </summary>
 /// <param name="elementSelector">The element selector.</param>
 /// <param name="clickMode">The click mode.</param>
 /// <param name="conditions">The conditions.</param>
 public void Click(string elementSelector, ClickMode clickMode, MatchConditions conditions)
 {
     if (this.EnableRemoteExecution)
     {
         this.RemoteCommands.Add(new RemoteCommands.RemoteCommandDetails()
         {
             Name = "Click",
             Arguments = new Dictionary<string, dynamic>()
             {
                 { "selector", elementSelector },
                 { "clickMode", clickMode.ToString() },
                 { "matchConditions", conditions.ToString() }
             }
         });
     }
     else
     {
         CurrentActionBucket.Add(() =>
         {
             var field = Provider.GetElement(elementSelector, conditions);
             field.Click(clickMode);
         });
     }
 }
예제 #40
0
 public virtual void Click(ClickMode clickMode)
 {
     // Selenium implements all clicks as NoWait events
     Click();
 }
예제 #41
0
 /// <summary>
 /// Clicks the specified element selector.
 /// </summary>
 /// <param name="elementSelector">The element selector.</param>
 /// <param name="clickMode">The click mode.</param>
 public void Click(string elementSelector, ClickMode clickMode)
 {
     Click(elementSelector, clickMode, MatchConditions.None);
 }
예제 #42
0
 public ModeCombination(CursorMode cursorMode, ClickMode clickMode)
 {
     this.CursorMode = cursorMode;
     this.ClickMode = clickMode;
 }
예제 #43
0
파일: Form1.cs 프로젝트: OhmGeek/TimeLord
        //private void DetectClickForMain(out int DayIndex, out int PeriodIndex, out int YearIndex, out int FormIndex,out Lesson selectedLesson,Rectangle cursor)
        //{
        //    DayIndex = -1;
        //    FormIndex = -1;
        //    YearIndex = -1;
        //    PeriodIndex = -1;
        //    selectedLesson = null;
        //    do
        //    {
        //        DayIndex++;
        //    } while ((DayIndex < currentTT.Week.Count - 1) && (!currentTT.Week[DayIndex].dayBounds.IntersectsWith(cursor)));
        //    Console.WriteLine("DayIndex: " + DayIndex);
        //    if (DayIndex >= currentTT.Week.Count) return;
        //    //if (!currentTT.Week[DayIndex].dayBounds.IntersectsWith(cursor)) return;
        //    do
        //    {
        //        PeriodIndex++;
        //    } while ((PeriodIndex < currentTT.Week[DayIndex].PeriodsInDay.Count - 1) && (!currentTT.Week[DayIndex].PeriodsInDay[PeriodIndex].periodBounds.IntersectsWith(cursor)));
        //    Console.WriteLine("Period Index: " + PeriodIndex);
        //    if (PeriodIndex >= currentTT.Week[DayIndex].PeriodsInDay.Count) return;
        //    // if (!currentTT.Week[DayIndex].PeriodsInDay[PeriodIndex].periodBounds.IntersectsWith(cursor)) return;
        //    do
        //    {
        //        YearIndex++;
        //    } while ((YearIndex < currentTT.Years.Count - 1) && (!currentTT.Years[YearIndex].yearBounds.IntersectsWith(cursor)));
        //    Console.WriteLine("Year Index: " + YearIndex);
        //    // if (!currentTT.Years[YearIndex].yearBounds.IntersectsWith(cursor)) return;
        //    if (YearIndex >= currentTT.Years.Count) return;
        //    do
        //    {
        //        FormIndex++;
        //    } while ((FormIndex < currentTT.Years[YearIndex].Forms.Count() - 1) && (!currentTT.Years[YearIndex].Forms[FormIndex].formBounds.IntersectsWith(cursor)));
        //    Console.WriteLine("Form Index: " + FormIndex);
        //    if (FormIndex >= currentTT.Years[YearIndex].Forms.Count()) return;
        //    try
        //    {
        //        selectedLesson = currentTT.mainTT[DayIndex][PeriodIndex][YearIndex][FormIndex];
        //    }
        //    catch
        //    {
        //    }
        //}
        private void pb_mainView_MouseClick(object sender, MouseEventArgs e)
        {
            //RENAME TO MouseUp.
            if (sw != null) sw.Stop();
            if (displayedItem != null)
            {
                displayedItem.selected = false;

            }
            if (!currentTT.IsFinalised()) return;
            Rectangle cursor = new Rectangle(e.X, e.Y, 1, 1);

            int YearIndex;
            int PeriodIndex;
            int DayIndex;
            int FormIndex;
            Lesson selectedLesson;
            DayIndex = -1;
            FormIndex = -1;
            YearIndex = -1;
            PeriodIndex = -1;
            selectedLesson = null;
            do
            {
                DayIndex++;
            } while ((DayIndex < currentTT.Week.Count - 1) && (!currentTT.Week[DayIndex].dayBounds.IntersectsWith(cursor)));
            //Console.WriteLine("DayIndex: " + DayIndex);
            if (DayIndex >= currentTT.Week.Count) return;
            //if (!currentTT.Week[DayIndex].dayBounds.IntersectsWith(cursor)) return;

            do
            {
                PeriodIndex++;
            } while ((PeriodIndex < currentTT.Week[DayIndex].PeriodsInDay.Count - 1) && (!currentTT.Week[DayIndex].PeriodsInDay[PeriodIndex].periodBounds.IntersectsWith(cursor)));
            //Console.WriteLine("Period Index: " + PeriodIndex);
            if (PeriodIndex >= currentTT.Week[DayIndex].PeriodsInDay.Count) return;

            // if (!currentTT.Week[DayIndex].PeriodsInDay[PeriodIndex].periodBounds.IntersectsWith(cursor)) return;

            do
            {
                YearIndex++;
            } while ((YearIndex < currentTT.Years.Count - 1) && (!currentTT.Years[YearIndex].yearBounds.IntersectsWith(cursor)));
            //Console.WriteLine("Year Index: " + YearIndex);
            // if (!currentTT.Years[YearIndex].yearBounds.IntersectsWith(cursor)) return;
            if (YearIndex >= currentTT.Years.Count) return;

            do
            {
                FormIndex++;
            } while ((FormIndex < currentTT.Years[YearIndex].Forms.Count() - 1) && (!currentTT.Years[YearIndex].Forms[FormIndex].formBounds.IntersectsWith(cursor)));
            //Console.WriteLine("Form Index: " + FormIndex);
            if (FormIndex >= currentTT.Years[YearIndex].Forms.Count()) return;

            try
            {
                selectedLesson = currentTT.mainTT[DayIndex][PeriodIndex][YearIndex][FormIndex];
            }
            catch
            {

            }

            if (mainViewMode == ClickMode.AddLessonViaMenu)
            {
                lessonView = new AddLesson();
                lessonView.currentTT = currentTT;
                lessonView.LoadData();
                lessonView.cb_day.SelectedIndex = DayIndex;

                lessonView.cb_periodStart.SelectedIndex = PeriodIndex;
                lessonView.cb_yearGroup.SelectedIndex = YearIndex;
                lessonView.cb_class.SelectedIndex = FormIndex;
                mainViewMode = ClickMode.Normal;
                lessonView.ShowDialog();

                pb_mainView.Refresh();
                lbl_status.Text = "Ready";
                return;
            }
            if (mainViewMode == ClickMode.InsertFromTray)
            {
                if (lv_tray.SelectedIndices.Count == 0)
                {
                    mainViewMode = ClickMode.Normal;
                    return;
                }
                currentTT.MoveFromTrayToMainTT(DayIndex, PeriodIndex, YearIndex, FormIndex, lv_tray.SelectedIndices[0]);
                mainViewMode = ClickMode.Normal;
                RefreshTrayItems();
                return;
            }
            else if (mainViewMode == ClickMode.FindStaff)
            {
                mainViewMode = ClickMode.Normal;
                lbl_status.Text = currentTT.FreeStaffCodes(Convert.ToByte(DayIndex), Convert.ToByte(PeriodIndex));

            }
            else if (mainViewMode == ClickMode.FindRooms) {
                mainViewMode = ClickMode.Normal;
                lbl_status.Text =  currentTT.FreeRoomCodes(Convert.ToByte(DayIndex), Convert.ToByte(PeriodIndex));

            }

            selectedLesson = currentTT.mainTT[DayIndex][PeriodIndex][YearIndex][FormIndex];

            if (mainViewMode == ClickMode.Move && sw.ElapsedMilliseconds > timeForMove)
            {

                //MessageBox.Show("Move: " + FormIndex + " " + YearIndex);
                if (displayedItem.locked)
                {
                    MessageBox.Show("One cannot move a locked lesson. To move it, please unlock the lesson.", "Lesson locking");
                    mainViewMode = ClickMode.Normal;
                    return;
                }

                bool ConditionA = (displayedItem.YearIndex != YearIndex);
                bool ConditionB = (displayedItem.PeriodIndex != PeriodIndex);
                bool ConditionC = (displayedItem.FormIndex != FormIndex);

                if (ConditionA) AddNodeToUndo(Event.MoveYear, displayedItem.YearIndex, YearIndex, displayedItem,false,ConditionB|ConditionC);
                if (ConditionB) AddNodeToUndo(Event.MovePeriod, displayedItem.PeriodIndex, PeriodIndex, displayedItem, ConditionA,ConditionC);

                if (ConditionC) AddNodeToUndo(Event.MoveForm, displayedItem.FormIndex, FormIndex,displayedItem, ConditionA | ConditionB,false);
                currentTT.MoveForms(displayedItem, Convert.ToByte(FormIndex));

                currentTT.MovePeriods(displayedItem, Convert.ToByte(PeriodIndex));
                currentTT.MoveYears(displayedItem, Convert.ToByte(YearIndex));

                mainViewMode = ClickMode.Normal;
                RefreshViews();
                displayedItem.selected = true;
                return;
            }

            if (selectedLesson == null)
            {
                displayedItem = null;
                pb_mainView.Refresh();
            }

            else
            {
                selectedLesson.selected = true;
                displayedItem = selectedLesson;;
                pb_mainView.Refresh();

                cb_year.SelectedIndex = YearIndex;
                cb_room.SelectedIndex = currentTT.GetIndexOfRoom(selectedLesson.RoomCode);
                cb_teacher.SelectedIndex = currentTT.GetIndexOfStaff(selectedLesson.TeacherAbbreviation);
                cb_subject.SelectedIndex = currentTT.GetIndexOfSubject(selectedLesson.SubjectAbbreviation);

                cb_homework.Text = Convert.ToString(selectedLesson.homeworkAmount);
                cb_form.Text = currentTT.Years[YearIndex].Forms[FormIndex].FormName;
                btn_invisible.Checked = selectedLesson.invisible;
                btn_locked.Checked = selectedLesson.locked;
            }
            mainViewMode = ClickMode.Normal;
        }
예제 #44
0
파일: Form1.cs 프로젝트: OhmGeek/TimeLord
 private void btn_addLessonViaSelection_Click(object sender, EventArgs e)
 {
     mainViewMode = ClickMode.AddLessonViaMenu; //this makes sure that we select blank places to add new lessons to.
     if (displayedItem != null) displayedItem.selected = false; //deselect the current selected one.
     lbl_status.Text = "Click where the lesson should be added.";
 }
        public IWindowFixture RightClick(SearchCriteria by, ClickMode clickMode)
        {
            _fixture.ApplyClickAction(by, c => c.DoubleClick(), clickMode);

            return(_fixture);
        }