Ejemplo n.º 1
0
        private void SelectPocketPairs()
        {
            var length = HandHistories.Objects.Cards.Card.PossibleRanksHighCardFirst.Length;

            for (var i = 0; i < length; i++)
            {
                HoleCardsCollection.ElementAt(i * length + i).IsChecked = true;
            }
        }
Ejemplo n.º 2
0
        private void SelectedSuitedConnectors()
        {
            var length = HandHistories.Objects.Cards.Card.PossibleRanksHighCardFirst.Length;

            for (int i = 0; i < length - 1; i++)
            {
                HoleCardsCollection.ElementAt(i * length + i + 1).IsChecked = true;
            }
        }
Ejemplo n.º 3
0
        private void ResetFilterHoleCardsTo(IEnumerable <HoleCardsItem> holeCardsList)
        {
            foreach (var holeCard in holeCardsList)
            {
                var cur = HoleCardsCollection.FirstOrDefault(x => x.Name == holeCard.Name);

                if (cur != null)
                {
                    cur.IsChecked = holeCard.IsChecked;
                }
            }
        }
Ejemplo n.º 4
0
        public Expression <Func <Playerstatistic, bool> > GetFilterPredicate()
        {
            if (!HoleCardsCollection.Any(x => !x.IsChecked))
            {
                return(null);
            }

            var checkedHoleCards   = HoleCardsCollection.Where(x => x.IsChecked);
            var holeCardsPredicate = PredicateBuilder.Create <Playerstatistic>(x => FilterHelpers.CheckHoleCards(x.Cards, checkedHoleCards));

            return(holeCardsPredicate);
        }
Ejemplo n.º 5
0
        private void LoadNote()
        {
            if (SelectedNote != null)
            {
                HoleCardsCollection.ForEach(x => x.IsChecked = !SelectedNote.Settings.ExcludedCardsList.Contains(x.Name));
            }

            noteCopy = SelectedNote?.CopyTo();

            RefreshCurrentActionSettings();
            RefreshFiltersSettings();
            RefreshCurrentHandValuesSettings();

            RaiseFilterBasedPropertyChanged();
        }
Ejemplo n.º 6
0
 public void ResetHoleCardsCollection()
 {
     HoleCardsCollection.Where(x => !x.IsChecked).ToList().ForEach(x => x.IsChecked = true);
 }
Ejemplo n.º 7
0
        private void InitializeCommands()
        {
            var canAdd = this.WhenAny(x => x.SelectedStage, x => x.Value != null);

            AddNoteCommand = ReactiveCommand.Create(AddNote, canAdd);

            var canEdit = this.WhenAny(x => x.SelectedStage, x => x.Value != null && x.Value is NoteTreeEditableObject);

            EditNoteCommand = ReactiveCommand.Create(EditNote, canEdit);

            var canRemove = this.WhenAny(x => x.SelectedStage, x => (x.Value is InnerGroupObject) || (x.Value is NoteObject));

            RemoveNoteCommand = ReactiveCommand.Create(RemoveNote, canRemove);
            SwitchModeCommand = ReactiveCommand.Create(() => IsAdvancedMode = !IsAdvancedMode);

            HoleCardsLeftClickCommand                 = ReactiveCommand.Create <HoleCardsViewModel>(x => x.IsChecked = true);
            HoleCardsDoubleLeftClickCommand           = ReactiveCommand.Create <HoleCardsViewModel>(x => x.IsChecked = false);
            HoleCardsMouseEnterCommand                = ReactiveCommand.Create <HoleCardsViewModel>(x => x.IsChecked = true);
            HoleCardsSelectAllCommand                 = ReactiveCommand.Create(() => HoleCardsCollection.ForEach(x => x.IsChecked = true));
            HoleCardsSelectNoneCommand                = ReactiveCommand.Create(() => HoleCardsCollection.ForEach(x => x.IsChecked = false));
            HoleCardsSelectSuitedGappersCommand       = ReactiveCommand.Create(SelectSuitedGappers);
            HoleCardsSelectSuitedConnectorsCommand    = ReactiveCommand.Create(SelectedSuitedConnectors);
            HoleCardsSelectPocketPairsCommand         = ReactiveCommand.Create(SelectPocketPairs);
            HoleCardsSelectOffSuitedGappersCommand    = ReactiveCommand.Create(SelectOffSuitedGappers);
            HoleCardsSelectOffSuitedConnectorsCommand = ReactiveCommand.Create(SelectOffSuitedConnectors);

            AddToSelectedFiltersCommand = ReactiveCommand.Create(() =>
            {
                var selectedItem = filters.FirstOrDefault(f => f.IsSelected);

                if (selectedItem != null && !selectedFilters.Any(f => f.Filter == selectedItem.Filter))
                {
                    var filterToAdd        = selectedItem.Clone();
                    filterToAdd.IsSelected = false;

                    // if filter requires value
                    if (FiltersHelper.FiltersWithValueRequired.Contains(filterToAdd.Filter))
                    {
                        var setFilterValueViewModel = new SetFilterValueViewModel
                        {
                            Filter = filterToAdd.Filter
                        };

                        setFilterValueViewModel.OnSaveAction = () =>
                        {
                            filterToAdd.Value = setFilterValueViewModel.FilterValue;
                            selectedFilters.Add(filterToAdd);
                        };

                        var popupEventArgs = new RaisePopupEventArgs()
                        {
                            Title   = CommonResourceManager.Instance.GetResourceString("XRay_SetFilterValueView_Title"),
                            Content = new SetFilterValueView(setFilterValueViewModel)
                        };

                        eventAggregator.GetEvent <RaisePopupEvent>().Publish(popupEventArgs);
                    }
                    else
                    {
                        selectedFilters.Add(filterToAdd);
                    }
                }
            });

            RemoveFromSelectedFiltersCommand = ReactiveCommand.Create(() =>
            {
                var selectedItem = selectedFilters.FirstOrDefault(f => f.IsSelected);

                if (selectedItem != null)
                {
                    selectedFilters.Remove(selectedItem);
                }
            });

            NoteDragDropCommand = ReactiveCommand.Create <DragDropDataObject>(dataObject =>
            {
                if (dataObject == null)
                {
                    return;
                }

                var note = dataObject.DropData as NoteObject;

                if (note == null || ReferenceEquals(note, dataObject.Source))
                {
                    return;
                }

                var noteParent = FindNoteParent(note);

                if (dataObject.Source is InnerGroupObject)
                {
                    (dataObject.Source as InnerGroupObject).Notes.Add(note);
                }
                else if (dataObject.Source is NoteObject)
                {
                    var sourceNoteParent = FindNoteParent(dataObject.Source as NoteObject);

                    if (ReferenceEquals(sourceNoteParent, noteParent))
                    {
                        return;
                    }

                    if (sourceNoteParent is InnerGroupObject)
                    {
                        (sourceNoteParent as InnerGroupObject).Notes.Add(note);
                    }
                    else if (sourceNoteParent is StageObject)
                    {
                        (sourceNoteParent as StageObject).Notes.Add(note);
                    }
                }

                // remove note from parent object
                if (noteParent is InnerGroupObject)
                {
                    (noteParent as InnerGroupObject).Notes.Remove(note);
                }
                else if (noteParent is StageObject)
                {
                    (noteParent as StageObject).Notes.Remove(note);
                }
            });
        }