コード例 #1
0
        private void SetList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            IndividualRummySetXF <SU, CO, RU, GC, GW, SE, T> thisTemp;

            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                if (e.OldItems.Count != 1)
                {
                    throw new BasicBlankException("Cannot remove one item at a time");
                }
                _thisStack !.Children.RemoveAt(e.OldStartingIndex);
                return;
            }
            if (e.Action == NotifyCollectionChangedAction.Reset)
            {
                _thisStack !.Children.Clear(); //this is it.
            }
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (var thisItem in e.NewItems)
                {
                    var thisSet = (SE)thisItem !;
                    thisTemp             = new IndividualRummySetXF <SU, CO, RU, GC, GW, SE, T>();
                    thisTemp.Divider     = Divider;
                    thisTemp.Additionals = Additionals;
                    thisTemp.LoadList(thisSet, _tagUsed);

                    _thisStack !.Children.Add(thisTemp);
                }
            }
        }
コード例 #2
0
        public void Init(MainSetsObservable <SU, CO, RU, SE, T> thisMod, string tagUsed)
        {
            _tagUsed               = tagUsed;
            _thisStack             = new StackLayout();
            _thisStack.Orientation = StackOrientation.Horizontal;
            IndividualRummySetXF <SU, CO, RU, GC, GW, SE, T> thisTemp;
            Grid       firstGrid  = new Grid();
            ScrollView thisScroll = new ScrollView();

            thisScroll.Orientation = ScrollOrientation.Both;
            if (thisMod.HasFrame == true)
            {
                Text = thisMod.Text;
                var thisRect = ThisFrame.GetControlArea();
                thisScroll.Margin = new Thickness((double)thisRect.Left + (float)3, (double)thisRect.Top + (float)3, 3, 5); // try this way.
                firstGrid.Children.Add(ThisDraw);
                firstGrid.Children.Add(thisScroll);
            }
            else
            {
                firstGrid.Children.Add(thisScroll);// this alone.
            }
            _setList = thisMod.SetList;
            foreach (var thisSet in thisMod.SetList)
            {
                thisTemp             = new IndividualRummySetXF <SU, CO, RU, GC, GW, SE, T>();
                thisTemp.Divider     = Divider;
                thisTemp.Additionals = Additionals;
                thisTemp.LoadList(thisSet, tagUsed);
                _thisStack.Children.Add(thisTemp);
            }
            _setList.CollectionChanged += SetList_CollectionChanged;
            thisScroll.Content          = _thisStack;
            Content = firstGrid;
        }