Beispiel #1
0
 public void SelectUser(SelectionKind kind, IEnumerable <AccountInfo> defaultSelect, Action <IEnumerable <AccountInfo> > returning)
 {
     this.UserSelectionViewModel.BeginInteraction(kind, defaultSelect, returning);
     _isVisibleUserSelection = true;
     RaisePropertyChanged(() => IsVisibleUserSelection);
     RaisePropertyChanged(() => IsActivateMain);
 }
Beispiel #2
0
        private void SelectBy(SelectionKind selectionKind, object selection, bool blur, bool waitForItself = false, bool waitForDynamicContentLoad = true)
        {
            if (waitForItself)
            {
                WaitForElementVisibleAndEnabled();
            }

            //Assert.IsTrue(Element.Displayed, string.Format("Element {0} is not Displayed", Locator));		//TODO
            //Assert.IsTrue(Element.Enabled, string.Format("Element {0} is not Enabled", Locator));			//TODO

            Selector[selectionKind](selection);

            if (waitForDynamicContentLoad)
            {
                ParentPage.WaitForDynamicContentToLoad();
            }

            if (blur)
            {
                Blur(true, false);
            }

            if (waitForDynamicContentLoad)
            {
                ParentPage.WaitForDynamicContentToLoad();
            }

            LogSelection(selectionKind, selection, blur);
        }
Beispiel #3
0
        //enum InputSelected { None, KeyboardOne, KeyboardTwo, GamePadOne, GamePadTwo, GamePadThree, GamePadFour }

        public Selection(Texture2D selectionBoxTexture, Texture2D characterTexture, int characterWidth, int characterHeight,
                         Rectangle destination, Vector2 position, Player.Side side, string playerID)
        {
            this.position            = position;
            this.selectionBoxTexture = selectionBoxTexture;
            this.characterTexture    = characterTexture;
            this.selectionBoxDestinationRectangle = destination;
            this.side             = side;
            this.playerID         = playerID;
            maxCharacters         = 4;
            character             = Character.Dwarf;
            currentCharacterFrame = (int)character;
            selectionKind         = SelectionKind.InputSelection;
            //inputSelected = InputSelected.None;
            text                = "Press Start";
            textSize            = Game1.font24.MeasureString(text);
            characterName       = character.ToString();
            characterNameSize   = Game1.font36.MeasureString(characterName);
            showTextElapsedTime = 0;
            showText            = true;

            selectionBoxSourceRectangle   = new Rectangle(0, 0, boxWidth, boxHeight);
            characterDestinationRectangle = new Rectangle(destination.X, destination.Y + (destination.Y / 2), characterWidth, characterHeight);
            characterSourceRectangle      = new Rectangle((int)(currentCharacterFrame * characterSelectionWidth), 0, characterSelectionWidth, characterSelectionHeight);
        }
 public Selection(SelectionKind kind = default, Type recv = default, Object obj = default, slice <long> index = default, bool indirect = default)
 {
     this.kind     = kind;
     this.recv     = recv;
     this.obj      = obj;
     this.index    = index;
     this.indirect = indirect;
 }
Beispiel #5
0
        public void Update(GameTime gameTime)
        {
            switch (selectionKind)
            {
            case SelectionKind.InputSelection:
                showTextElapsedTime += (int)gameTime.ElapsedGameTime.TotalMilliseconds;

                if (showTextElapsedTime > 249)
                {
                    if (showText)
                    {
                        showText = false;
                    }
                    else
                    {
                        showText = true;
                    }

                    showTextElapsedTime = 0;
                }
                break;

            case SelectionKind.CharacterSelection:
                //input.GetInputs();

                if (input.SelectX() != 0)
                {
                    ChangeCharacter(input.SelectX());
                }

                if (input.PauseGame())
                {
                    selectionBoxSourceRectangle.X = boxWidth;
                    selectionKind = SelectionKind.CharacterSelected;
                    Game1.numberOfPlayersSelected++;

                    characterSourceRectangle = new Rectangle((int)((currentCharacterFrame + maxCharacters) * characterSelectionWidth), 0, characterSelectionWidth, characterSelectionHeight);
                }

                break;

            case SelectionKind.CharacterSelected:
                //input.GetInputs();

                if (input.Back())
                {
                    selectionBoxSourceRectangle.X = 0;
                    selectionKind = SelectionKind.CharacterSelection;
                    Game1.numberOfPlayersSelected--;

                    characterSourceRectangle = new Rectangle((int)(currentCharacterFrame * characterSelectionWidth), 0, characterSelectionWidth, characterSelectionHeight);
                }

                break;
            }
        }
Beispiel #6
0
        public ColumnSelection(PropertyInfo viewProperty, SelectionKind kind, ColumnSelectionAttribute reason)
        {
            if (!viewProperty.PropertyType.IsValueTypeOrString())
            {
                throw new NotSupportedException(Resources.CANT_SELECT);
            }

            ViewProperty = viewProperty;
            Kind         = kind;
            Reason       = reason;
        }
Beispiel #7
0
 public void ResetSelection()
 {
     character             = Character.Dwarf;
     currentCharacterFrame = (int)character;
     selectionKind         = SelectionKind.InputSelection;
     characterName         = character.ToString();
     characterNameSize     = Game1.font36.MeasureString(characterName);
     showTextElapsedTime   = 0;
     showText = true;
     selectionBoxSourceRectangle = new Rectangle(0, 0, boxWidth, boxHeight);
     characterSourceRectangle    = new Rectangle((int)(currentCharacterFrame * characterSelectionWidth), 0, characterSelectionWidth, characterSelectionHeight);
 }
 public void BeginInteraction(SelectionKind kind, IEnumerable <AccountInfo> defaultSelect, Action <IEnumerable <AccountInfo> > interact)
 {
     this._kind  = kind;
     curInteract = interact;
     _userSelectorViewModel.LinkElements = defaultSelect;
     RaisePropertyChanged(() => IsFavoriteAndRetweet);
     RaisePropertyChanged(() => IsFavorite);
     RaisePropertyChanged(() => IsRetweet);
     RaisePropertyChanged(() => IsSteal);
     RaisePropertyChanged(() => IsFavoriteAndSteal);
     RaisePropertyChanged(() => SelectedUsers);
     OkCommand.RaiseCanExecuteChanged();
 }
Beispiel #9
0
        // Sets the current selection. No feedback is provided as to whether the selection
        // is valid; if invalid, the selection will simply be cleared when it is retrieved.
        private void SetSelection(SelectionKind selectionKind, Id<CourseControl> courseControlId, Id<CourseControl> courseControlId2, LegInsertionLoc legInsertionLoc, 
                                  Id<ControlPoint> controlId, Id<Special> specialId, Symbol keySymbol, DescriptionLine.TextLineKind textLineKind)
        {
            if (this.selectionKind != selectionKind || this.selectedCourseControl != courseControlId ||
                this.selectedCourseControl2 != courseControlId2 || this.selectedControl != controlId || this.selectedSpecial != specialId) 
            {
                controller.ScrollHighlightIntoView = true;     // scroll the newly selection item into view.
            }

            ++selectionChangeNum;
            this.selectionKind = selectionKind;
            this.selectedCourseControl = courseControlId;
            this.selectedCourseControl2 = courseControlId2;
            this.legInsertionLoc = legInsertionLoc;
            this.selectedControl = controlId;
            this.selectedSpecial = specialId;
            this.selectedKeySymbol = keySymbol;
            this.selectedTextLineKind = textLineKind;
        }
Beispiel #10
0
        // Sets the current selection. No feedback is provided as to whether the selection
        // is valid; if invalid, the selection will simply be cleared when it is retrieved.
        private void SetSelection(SelectionKind selectionKind, Id<CourseControl> courseControlId, Id<CourseControl> courseControlId2, Id<ControlPoint> controlId, Id<Special> specialId, Symbol keySymbol, DescriptionLine.TextLineKind textLineKind)
        {
            if (this.selectionKind != selectionKind || this.selectedCourseControl != courseControlId ||
                this.selectedCourseControl2 != courseControlId2 || this.selectedControl != controlId || this.selectedSpecial != specialId)
            {
                controller.ScrollHighlightIntoView = true;     // scroll the newly selection item into view.
            }

            ++selectionChangeNum;
            this.selectionKind = selectionKind;
            this.selectedCourseControl = courseControlId;
            this.selectedCourseControl2 = courseControlId2;
            this.selectedControl = controlId;
            this.selectedSpecial = specialId;
            this.selectedKeySymbol = keySymbol;
            this.selectedTextLineKind = textLineKind;
        }
Beispiel #11
0
 private void LogSelection(SelectionKind selectionKind, object selection, bool blur)
 {
     Trace.WriteLine(string.Format("Selected option {0} by {1} from {2} ", selectionKind, selection, Identifier));
 }
Beispiel #12
0
 public void SelectUser(SelectionKind kind, IEnumerable<AccountInfo> defaultSelect, Action<IEnumerable<AccountInfo>> returning)
 {
     this.UserSelectionViewModel.BeginInteraction(kind, defaultSelect, returning);
     _isVisibleUserSelection = true;
     RaisePropertyChanged(() => IsVisibleUserSelection);
     RaisePropertyChanged(() => IsActivateMain);
 }
 public void BeginInteraction(SelectionKind kind, IEnumerable<AccountInfo> defaultSelect, Action<IEnumerable<AccountInfo>> interact)
 {
     this._kind = kind;
     curInteract = interact;
     _userSelectorViewModel.LinkElements = defaultSelect;
     RaisePropertyChanged(() => IsFavoriteAndRetweet);
     RaisePropertyChanged(() => IsFavorite);
     RaisePropertyChanged(() => IsRetweet);
     RaisePropertyChanged(() => IsSteal);
     RaisePropertyChanged(() => IsFavoriteAndSteal);
     RaisePropertyChanged(() => SelectedUsers);
     OkCommand.RaiseCanExecuteChanged();
 }
 private void LogSelection(SelectionKind selectionKind, object selection, bool blur)
 {
     Trace.WriteLine(string.Format("Selected option {0} by {1} from {2} ", selectionKind, selection, Identifier));
 }
        private void SelectBy(SelectionKind selectionKind, object selection, bool blur, bool waitForItself = false, bool waitForDynamicContentLoad = true)
        {
            if (waitForItself)
                WaitForElementVisibleAndEnabled();

            //Assert.IsTrue(Element.Displayed, string.Format("Element {0} is not Displayed", Locator));		//TODO
            //Assert.IsTrue(Element.Enabled, string.Format("Element {0} is not Enabled", Locator));			//TODO

            Selector[selectionKind](selection);

            if (waitForDynamicContentLoad)
                ParentPage.WaitForDynamicContentToLoad();

            if (blur)
                Blur(true, false);

            if (waitForDynamicContentLoad)
                ParentPage.WaitForDynamicContentToLoad();

            LogSelection(selectionKind, selection, blur);
        }