예제 #1
0
 /// <summary>
 /// Clear the current screen and all properties.
 /// </summary>
 /// <since_tizen> 9 </since_tizen>
 public virtual void Clear()
 {
     if (VisibleItems != null)
     {
         foreach (RecyclerViewItem item in VisibleItems)
         {
             if (ItemsView != null)
             {
                 ItemsView.UnrealizeItem(item, false);
             }
         }
         VisibleItems.Clear();
     }
     if (CandidateMargin != null)
     {
         CandidateMargin.Dispose();
         CandidateMargin = null;
     }
     if (Container)
     {
         if (ItemsView != null)
         {
             Container.Size = ItemsView.Size;
         }
         Container.Position = new Position(0.0f, 0.0f);
         Container          = null;
     }
     ItemsView = null;
 }
예제 #2
0
 /// <summary>
 /// In the constructor I have passed in interfaces for IModel and IEventAggregator. the viewmodellocator
 /// uses the IOC container to get the class instances, and inject them into the viewmodel.
 /// </summary>
 /// <param name="model"></param>
 /// <param name="eventAggregator"></param>
 public MainViewModel(IModel model, IEventAggregator eventAggregator)
 {
     VisibleItems        = CollectionViewSource.GetDefaultView(model.ToDos);
     VisibleItems.Filter = new Predicate <object>(FilterPredicate);
     //Delegate command is basically a helper function you specify a delegate to run with.
     ToDoStateChangedCommand = new DelegateCommand <ToDo>((todo) => {
         eventAggregator.GetEvent <ToDoListChanged>()
         .Publish();
         VisibleItems.Refresh();
     });
     DeleteItemCommand = new DelegateCommand <ToDo>((todo) => {
         model.ToDos.Remove(todo);
         eventAggregator.GetEvent <ToDoListChanged>()
         .Publish();
     });
     //Any module can subscribe to or publish events on the event aggregator. The events themselves are
     //defined in a shared infrastructure project. The eventaggregator is responsible for telling the
     //various components to update themselves.
     eventAggregator.GetEvent <Infrastructure.FilterEvent>()
     .Subscribe(filter => {
         _filter = filter;
         VisibleItems.Refresh();
     });
     eventAggregator.GetEvent <ToDoListChanged>()
     .Subscribe(() => {
         VisibleItems.Refresh();
     });
 }
예제 #3
0
 /// <summary>
 /// Очистить представление
 /// </summary>
 public override void Clear()
 {
     base.Clear();
     Title = "";
     Items.Clear();
     VisibleItems.Clear();
 }
예제 #4
0
        private Character GetCharacter(int x, int y, RoomEditorState state)
        {
            foreach (Character character in _game.RootCharacterFolder.AllItemsFlat)
            {
                if (_room.Number != character.StartingRoom)
                {
                    continue;
                }

                if (!VisibleItems.Contains(character.ScriptName) || LockedItems.Contains(character.ScriptName))
                {
                    continue;
                }

                AgsView view = _game.FindViewByID(character.NormalView);

                if (view != null && view.Loops.Count > 0)
                {
                    if (HitTest(x, y, character, view))
                    {
                        return(character);
                    }
                }
            }
            return(null);
        }
예제 #5
0
        public virtual void PaintToHDC(IntPtr hDC, RoomEditorState state)
        {
            _objectBaselines.Clear();
            foreach (RoomObject obj in _room.Objects)
            {
                if (obj.Baseline <= 0)
                {
                    obj.EffectiveBaseline = obj.StartY;
                }
                else
                {
                    obj.EffectiveBaseline = obj.Baseline;
                }
                _objectBaselines.Add(obj);
            }
            _objectBaselines.Sort();

            foreach (RoomObject obj in _objectBaselines)
            {
                if (!VisibleItems.Contains(GetUniqueName(obj)))
                {
                    continue;
                }
                int height = GetSpriteHeightForGameResolution(obj.Image);
                int ypos   = AdjustYCoordinateForWindowScroll(obj.StartY, state) - (height * state.ScaleFactor);
                Factory.NativeProxy.DrawSpriteToBuffer(obj.Image, AdjustXCoordinateForWindowScroll(obj.StartX, state), ypos, state.ScaleFactor);
            }
        }
예제 #6
0
 /// <summary>
 /// Добавить элемент в списки элементов
 /// </summary>
 private void AddItem(Item item)
 {
     Items.Add(item);
     if (!item.Hidden)
     {
         VisibleItems.Add(item);
     }
 }
예제 #7
0
 private bool IsMoveable(SelectedEdge edge)
 {
     if (!VisibleItems.Contains(edge.ToString()) || LockedItems.Contains(edge.ToString()))
     {
         return(false);
     }
     return(true);
 }
예제 #8
0
 public void PaintToHDC(IntPtr hdc, RoomEditorState state)
 {
     foreach (Character character in _game.RootCharacterFolder.AllItemsFlat)
     {
         if (_room.Number == character.StartingRoom && VisibleItems.Contains(character.ScriptName))
         {
             DrawCharacter(character, state);
         }
     }
 }
예제 #9
0
 public virtual void Clear()
 {
     foreach (RecyclerViewItem item in VisibleItems)
     {
         if (ItemsView != null)
         {
             ItemsView.UnrealizeItem(item, false);
         }
     }
     VisibleItems.Clear();
     ItemsView = null;
     Container = null;
 }
예제 #10
0
        internal void ShowAutocomplete(bool forced)
        {
            if (forced)
            {
                forcedOpened = true;
            }

            if (TargetControlWrapper != null && TargetControlWrapper.Readonly)
            {
                Close();
                return;
            }

            if (!Enabled)
            {
                Close();
                return;
            }

            if (!forcedOpened && !AutoPopup)
            {
                Close();
                return;
            }

            //build list
            BuildAutocompleteList(forcedOpened);

            //show popup menu
            if (VisibleItems.Count > 0)
            {
#if USE_TEXT_WIDTH
                MaximumSize = new Size(VisibleItems.Max(vi => vi.TextWidth), MaximumSize.Height);
#endif
                if (forced && VisibleItems.Count == 1 && Host.ListView.SelectedItemIndex == 0)
                {
                    //do autocomplete if menu contains only one line and user press CTRL-SPACE
                    OnSelecting();
                    Close();
                }
                else
                {
                    ShowMenu();
                }
            }
            else
            {
                Close();
            }
        }
예제 #11
0
 internal void DestroyStorage()
 {
     if (Layer != null)
     {
         Layer.Data = null;
     }
     if (VisibleItemsStorage != null)
     {
         VisibleItemsStorage.Items.Clear();
         VisibleItemsStorage.Dispose();
         VisibleItemsStorage = null;
         FixMapBug(VisibleItems);
         VisibleItems.Clear();
     }
 }
예제 #12
0
        protected void SaveInstanceViewport(object sender, EventArgs e)
        {
            var viewport = VisibleItems.ToList();

            if (viewport.Count == 0)
            {
                return;
            }

            var vpMaxId         = viewport.Max(x => x.Id);
            var vpMinId         = viewport.Min(x => x.Id);
            var upperAmpliation = Loader.Source.Where(x => x.Id > vpMaxId).OrderBy(x => x.Id).Take(10);
            var lowerAmpliation = Loader.Source.Where(x => x.Id < vpMinId).OrderByDescending(x => x.Id).Take(10);

            Loader.SaveToCache(viewport.Concat(upperAmpliation).Concat(lowerAmpliation).ToList());
        }
예제 #13
0
 private RoomObject GetObject(int x, int y)
 {
     for (int i = _objectBaselines.Count - 1; i >= 0; i--)
     {
         RoomObject obj  = _objectBaselines[i];
         string     name = GetUniqueName(obj);
         if (!VisibleItems.Contains(name) || LockedItems.Contains(name))
         {
             continue;
         }
         if (HitTest(obj, x, y))
         {
             return(obj);
         }
     }
     return(null);
 }
예제 #14
0
        public virtual void Paint(Graphics graphics, RoomEditorState state)
        {
            int xPos;
            int yPos;

            if (_selectedObject != null && VisibleItems.Contains(GetUniqueName(_selectedObject)))
            {
                int width  = GetSpriteWidthForGameResolution(_selectedObject.Image);
                int height = GetSpriteHeightForGameResolution(_selectedObject.Image);
                xPos = AdjustXCoordinateForWindowScroll(_selectedObject.StartX, state);
                yPos = AdjustYCoordinateForWindowScroll(_selectedObject.StartY, state) - (height * state.ScaleFactor);
                Pen pen = new Pen(Color.Goldenrod);
                pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                graphics.DrawRectangle(pen, xPos, yPos, width * state.ScaleFactor, height * state.ScaleFactor);

                if (_movingObjectWithMouse)
                {
                    System.Drawing.Font font = new System.Drawing.Font("Arial", 10.0f);
                    string toDraw            = String.Format("X:{0}, Y:{1}", _selectedObject.StartX, _selectedObject.StartY);

                    int scaledx = xPos + (width * state.ScaleFactor / 2) - ((int)graphics.MeasureString(toDraw, font).Width / 2);
                    int scaledy = yPos - (int)graphics.MeasureString(toDraw, font).Height;
                    if (scaledx < 0)
                    {
                        scaledx = 0;
                    }
                    if (scaledy < 0)
                    {
                        scaledy = 0;
                    }

                    graphics.DrawString(toDraw, font, pen.Brush, (float)scaledx, (float)scaledy);
                }
                else
                if (_selectedObject.Locked)
                {
                    pen  = new Pen(Color.Goldenrod, 2);
                    xPos = AdjustXCoordinateForWindowScroll(_selectedObject.StartX, state) + (GetSpriteWidthForGameResolution(_selectedObject.Image) / 2 * state.ScaleFactor);
                    yPos = AdjustYCoordinateForWindowScroll(_selectedObject.StartY, state) - (GetSpriteHeightForGameResolution(_selectedObject.Image) / 2 * state.ScaleFactor);
                    Point center = new Point(xPos, yPos);

                    graphics.DrawLine(pen, center.X - 3, center.Y - 3, center.X + 3, center.Y + 3);
                    graphics.DrawLine(pen, center.X - 3, center.Y + 3, center.X + 3, center.Y - 3);
                }
            }
        }
예제 #15
0
 /// <summary>
 /// Clear the current screen and all properties.
 /// </summary>
 /// <since_tizen> 9 </since_tizen>
 public virtual void Clear()
 {
     foreach (RecyclerViewItem item in VisibleItems)
     {
         if (ItemsView != null)
         {
             ItemsView.UnrealizeItem(item, false);
         }
     }
     VisibleItems.Clear();
     if (CandidateMargin != null)
     {
         CandidateMargin.Dispose();
         CandidateMargin = null;
     }
     ItemsView = null;
     Container = null;
 }
예제 #16
0
        public void Write(GamePacketWriter writer)
        {
            writer.Write(Guid);
            writer.Write(Type, 6);
            EntityModel.Write(writer);
            writer.Write(Unknown60);

            writer.Write((byte)Stats.Count, 5);
            Stats.ForEach(o => o.Write(writer));

            writer.Write(Unknown68);

            writer.Write((byte)Commands.Count, 5);
            foreach (KeyValuePair <EntityCommand, IEntityCommand> pair in Commands)
            {
                writer.Write(pair.Key, 5);
                pair.Value.Write(writer);
            }

            writer.Write((byte)Properties.Count);
            Properties.ForEach(o => o.Write(writer));

            writer.Write((byte)VisibleItems.Count, 7);
            VisibleItems.ForEach(o => o.Write(writer));

            writer.Write((short)Unknown88.Count, 9);
            Unknown88.ForEach(o => o.Write(writer));

            writer.Write(Unknown8C);
            writer.Write(Faction1, 14);
            writer.Write(Faction2, 14);
            writer.Write(Unknown98);
            writer.Write(Unknown9C);

            UnknownA8.Write(writer);
            UnknownB0.Write(writer);
            UnknownC8.Write(writer);

            writer.Write(UnknownD4, 14);
            writer.Write(DisplayInfo, 17);
            writer.Write(OutfitInfo, 15);
        }
예제 #17
0
        public void Write(GamePacketWriter writer)
        {
            writer.Write(Guid);
            writer.Write(Type, 6);
            EntityModel.Write(writer);
            writer.Write(CreateFlags);

            writer.Write((byte)Stats.Count, 5);
            Stats.ForEach(o => o.Write(writer));

            writer.Write(Time);

            writer.Write((byte)Commands.Count, 5);
            foreach (KeyValuePair <EntityCommand, IEntityCommand> pair in Commands)
            {
                writer.Write(pair.Key, 5);
                pair.Value.Write(writer);
            }

            writer.Write((byte)Properties.Count);
            Properties.ForEach(o => o.Write(writer));

            writer.Write((byte)VisibleItems.Count, 7);
            VisibleItems.ForEach(o => o.Write(writer));

            writer.Write((short)SpellInitData.Count, 9);
            SpellInitData.ForEach(o => o.Write(writer));

            writer.Write(CurrentSpellUniqueId);
            writer.Write(Faction1, 14);
            writer.Write(Faction2, 14);
            writer.Write(UnitTagOwner);
            writer.Write(GroupTagOwner);

            UnknownA8.Write(writer);
            UnknownB0.Write(writer);
            UnknownC8.Write(writer);

            writer.Write(MiniMapMarker, 14);
            writer.Write(DisplayInfo, 17);
            writer.Write(OutfitInfo, 15);
        }
예제 #18
0
        public void Paint(Graphics graphics, RoomEditorState state)
        {
            int scaleFactor = state.ScaleFactor;

            if (VisibleItems.Contains(SelectedEdge.Left.ToString()))
            {
                DrawDoubleWidthVerticalLine(graphics, _room.LeftEdgeX * scaleFactor - state.ScrollOffsetX, scaleFactor);
            }
            if (VisibleItems.Contains(SelectedEdge.Right.ToString()))
            {
                DrawDoubleWidthVerticalLine(graphics, _room.RightEdgeX * scaleFactor - state.ScrollOffsetX, scaleFactor);
            }
            if (VisibleItems.Contains(SelectedEdge.Top.ToString()))
            {
                DrawDoubleHeightHorizontalLine(graphics, _room.TopEdgeY * scaleFactor - state.ScrollOffsetY, scaleFactor);
            }
            if (VisibleItems.Contains(SelectedEdge.Bottom.ToString()))
            {
                DrawDoubleHeightHorizontalLine(graphics, _room.BottomEdgeY * scaleFactor - state.ScrollOffsetY, scaleFactor);
            }
        }
예제 #19
0
        /// <inheritdoc />
        protected override bool StoreControlValue(string propertyName)
        {
#if !STANDALONEGUI
            if (this.ProjectMgr == null)
            {
                return(false);
            }
#else
            if (this.CurrentProject == null)
            {
                return(false);
            }
#endif
            if (propertyName == "ApiFilter")
            {
                if (ucVisibilityPropertiesPageContent.ApiFilterHasChanges)
                {
#if !STANDALONEGUI
                    this.ProjectMgr.SetProjectProperty("ApiFilter",
                                                       ucVisibilityPropertiesPageContent.ApiFilter.ToXml());
#else
                    this.CurrentProject.MSBuildProject.SetProperty("ApiFilter",
                                                                   ucVisibilityPropertiesPageContent.ApiFilter.ToXml());
#endif
                    ucVisibilityPropertiesPageContent.ApiFilterHasChanges = false;
                }

                return(true);
            }

            VisibleItems items = ucVisibilityPropertiesPageContent.VisibleItems;

#if !STANDALONEGUI
            this.ProjectMgr.SetProjectProperty("VisibleItems", items.ToString());
#else
            this.CurrentProject.MSBuildProject.SetProperty("VisibleItems", items.ToString());
#endif
            return(true);
        }
예제 #20
0
 IVisibleNodeEnumerator IVisibleNodeCollection.GetFullEnumerator()
 {
     return((IVisibleNodeEnumerator)VisibleItems.GetEnumerator());
 }
예제 #21
0
        public override void RequestLayout(float scrollPosition, bool force = false)
        {
            // Layouting is only possible after once it initialized.
            if (!IsInitialized)
            {
                return;
            }
            int LastIndex = colView.InternalItemSource.Count - 1;

            if (!force && PrevScrollPosition == Math.Abs(scrollPosition))
            {
                return;
            }
            PrevScrollPosition = Math.Abs(scrollPosition);

            if (ItemSizeChanged >= 0)
            {
                for (int i = ItemSizeChanged; i <= LastIndex; i++)
                {
                    UpdatePosition(i);
                }
                ScrollContentSize = ItemPosition[LastIndex - 1] + GetItemSize(LastIndex);
            }

            int prevFirstVisible = FirstVisible;
            int prevLastVisible  = LastVisible;

            (float X, float Y)visibleArea = (PrevScrollPosition,
                                             PrevScrollPosition + (IsHorizontal ? colView.Size.Width : colView.Size.Height)
                                             );

            // 1. Set First/Last Visible Item Index.
            (int start, int end) = FindVisibleItems(visibleArea);
            FirstVisible         = start;
            LastVisible          = end;

            // 2. Unrealize invisible items.
            List <RecyclerViewItem> unrealizedItems = new List <RecyclerViewItem>();

            foreach (RecyclerViewItem item in VisibleItems)
            {
                if (item.Index < FirstVisible || item.Index > LastVisible)
                {
                    //Console.WriteLine("[NUI] Unrealize{0}!", item.Index);
                    unrealizedItems.Add(item);
                    colView.UnrealizeItem(item);
                }
            }
            VisibleItems.RemoveAll(unrealizedItems.Contains);

            // 3. Realize and placing visible items.
            for (int i = FirstVisible; i <= LastVisible; i++)
            {
                RecyclerViewItem item = null;
                // 4. Get item if visible or realize new.
                if (i >= prevFirstVisible && i <= prevLastVisible)
                {
                    item = GetVisibleItem(i);
                    if (item)
                    {
                        continue;
                    }
                }
                if (item == null)
                {
                    item = colView.RealizeItem(i);
                }

                VisibleItems.Add(item);

                // 5. Placing item.
                float posX = 0F, posY = 0F;
                if (isGrouped)
                {
                    //isHeader?
                    if (colView.Header == item)
                    {
                        posX = 0F;
                        posY = 0F;
                    }
                    else if (colView.Footer == item)
                    {
                        posX = (IsHorizontal ? ScrollContentSize - item.SizeWidth : 0F);
                        posY = (IsHorizontal ? 0F : ScrollContentSize - item.SizeHeight);
                    }
                    else
                    {
                        GroupInfo gInfo = GetGroupInfo(i);
                        posX = (IsHorizontal ? gInfo.GroupPosition + gInfo.ItemPosition[i - gInfo.StartIndex] : 0F);
                        posY = (IsHorizontal ? 0F : gInfo.GroupPosition + gInfo.ItemPosition[i - gInfo.StartIndex]);
                    }
                }
                else
                {
                    posX = (IsHorizontal ? ItemPosition[i] : 0F);
                    posY = (IsHorizontal ? 0F : ItemPosition[i]);
                }

                item.Position = new Position(posX, posY);
                //Console.WriteLine("[NUI] ["+item+"]["+item.Index+"] :: ["+item.Position.X+", "+item.Position.Y+"] ==== \n");
            }
        }
예제 #22
0
        public override void Initialize(RecyclerView view)
        {
            colView = view as CollectionView;
            if (colView == null)
            {
                throw new ArgumentException("GridLayouter only can be applied CollectionView.", nameof(view));
            }

            // 1. Clean Up
            foreach (RecyclerViewItem item in VisibleItems)
            {
                colView.UnrealizeItem(item, false);
            }
            VisibleItems.Clear();
            groups.Clear();

            FirstVisible = 0;
            LastVisible  = 0;

            IsHorizontal = (colView.ScrollingDirection == ScrollableBase.Direction.Horizontal);

            RecyclerViewItem header = colView?.Header;
            RecyclerViewItem footer = colView?.Footer;
            float            width, height;
            int count = colView.InternalItemSource.Count;
            int pureCount = count - (header ? 1 : 0) - (footer ? 1 : 0);

            // 2. Get the header / footer and size deligated item and measure the size.
            if (header != null)
            {
                MeasureChild(colView, header);

                width = header.Layout != null?header.Layout.MeasuredWidth.Size.AsRoundedValue() : 0;

                height = header.Layout != null?header.Layout.MeasuredHeight.Size.AsRoundedValue() : 0;

                headerSize = IsHorizontal ? width : height;
                hasHeader  = true;

                colView.UnrealizeItem(header);
            }

            if (footer != null)
            {
                MeasureChild(colView, footer);

                width = footer.Layout != null?footer.Layout.MeasuredWidth.Size.AsRoundedValue() : 0;

                height = footer.Layout != null?footer.Layout.MeasuredHeight.Size.AsRoundedValue() : 0;

                footerSize   = IsHorizontal ? width : height;
                footer.Index = count - 1;
                hasFooter    = true;

                colView.UnrealizeItem(footer);
            }

            int firstIndex = header ? 1 : 0;

            if (colView.IsGrouped)
            {
                isGrouped = true;

                if (colView.GroupHeaderTemplate != null)
                {
                    while (!colView.InternalItemSource.IsGroupHeader(firstIndex))
                    {
                        firstIndex++;
                    }
                    //must be always true
                    if (colView.InternalItemSource.IsGroupHeader(firstIndex))
                    {
                        RecyclerViewItem groupHeader = colView.RealizeItem(firstIndex);
                        firstIndex++;

                        if (groupHeader == null)
                        {
                            throw new Exception("[" + firstIndex + "] Group Header failed to realize!");
                        }

                        // Need to Set proper hieght or width on scroll direciton.
                        if (groupHeader.Layout == null)
                        {
                            width  = groupHeader.WidthSpecification;
                            height = groupHeader.HeightSpecification;
                        }
                        else
                        {
                            MeasureChild(colView, groupHeader);

                            width  = groupHeader.Layout.MeasuredWidth.Size.AsRoundedValue();
                            height = groupHeader.Layout.MeasuredHeight.Size.AsRoundedValue();
                        }
                        //Console.WriteLine("[NUI] GroupHeader Size {0} :{0}", width, height);
                        // pick the StepCandidate.
                        groupHeaderSize = IsHorizontal ? width : height;
                        colView.UnrealizeItem(groupHeader);
                    }
                }
                else
                {
                    groupHeaderSize = 0F;
                }

                if (colView.GroupFooterTemplate != null)
                {
                    int firstFooter = firstIndex;
                    while (!colView.InternalItemSource.IsGroupFooter(firstFooter))
                    {
                        firstFooter++;
                    }
                    //must be always true
                    if (colView.InternalItemSource.IsGroupFooter(firstFooter))
                    {
                        RecyclerViewItem groupFooter = colView.RealizeItem(firstFooter);

                        if (groupFooter == null)
                        {
                            throw new Exception("[" + firstFooter + "] Group Footer failed to realize!");
                        }
                        // Need to Set proper hieght or width on scroll direciton.
                        if (groupFooter.Layout == null)
                        {
                            width  = groupFooter.WidthSpecification;
                            height = groupFooter.HeightSpecification;
                        }
                        else
                        {
                            MeasureChild(colView, groupFooter);

                            width  = groupFooter.Layout.MeasuredWidth.Size.AsRoundedValue();
                            height = groupFooter.Layout.MeasuredHeight.Size.AsRoundedValue();
                        }
                        // pick the StepCandidate.
                        groupFooterSize = IsHorizontal ? width : height;

                        colView.UnrealizeItem(groupFooter);
                    }
                }
                else
                {
                    groupFooterSize = 0F;
                }
            }
            else
            {
                isGrouped = false;
            }

            bool failed = false;

            //Final Check of FirstIndex
            while (colView.InternalItemSource.IsHeader(firstIndex) ||
                   colView.InternalItemSource.IsGroupHeader(firstIndex) ||
                   colView.InternalItemSource.IsGroupFooter(firstIndex))
            {
                if (colView.InternalItemSource.IsFooter(firstIndex))
                {
                    StepCandidate = 0F;
                    failed        = true;
                    break;
                }
                firstIndex++;
            }

            sizeCandidate = new Size2D(0, 0);
            if (!failed)
            {
                // Get Size Deligate. FIXME if group exist index must be changed.
                RecyclerViewItem sizeDeligate = colView.RealizeItem(firstIndex);
                if (sizeDeligate == null)
                {
                    throw new Exception("Cannot create content from DatTemplate.");
                }
                sizeDeligate.BindingContext = colView.InternalItemSource.GetItem(firstIndex);

                // Need to Set proper hieght or width on scroll direciton.
                if (sizeDeligate.Layout == null)
                {
                    width  = sizeDeligate.WidthSpecification;
                    height = sizeDeligate.HeightSpecification;
                }
                else
                {
                    MeasureChild(colView, sizeDeligate);

                    width  = sizeDeligate.Layout.MeasuredWidth.Size.AsRoundedValue();
                    height = sizeDeligate.Layout.MeasuredHeight.Size.AsRoundedValue();
                }
                //Console.WriteLine("[NUI] item Size {0} :{1}", width, height);

                // pick the StepCandidate.
                StepCandidate = IsHorizontal ? width : height;
                spanSize      = IsHorizontal ? Convert.ToInt32(Math.Truncate((double)(colView.Size.Height / height))) :
                                Convert.ToInt32(Math.Truncate((double)(colView.Size.Width / width)));

                sizeCandidate = new Size2D(Convert.ToInt32(width), Convert.ToInt32(height));

                colView.UnrealizeItem(sizeDeligate);
            }

            if (StepCandidate < 1)
            {
                StepCandidate = 1;
            }
            if (spanSize < 1)
            {
                spanSize = 1;
            }

            if (isGrouped)
            {
                float Current = 0.0F;
                IGroupableItemSource source       = colView.InternalItemSource;
                GroupInfo            currentGroup = null;

                for (int i = 0; i < count; i++)
                {
                    if (i == 0 && hasHeader)
                    {
                        Current += headerSize;
                    }
                    else if (i == count - 1 && hasFooter)
                    {
                        Current += footerSize;
                    }
                    else
                    {
                        //GroupHeader must always exist in group usage.
                        if (source.IsGroupHeader(i))
                        {
                            currentGroup = new GroupInfo()
                            {
                                GroupParent   = source.GetGroupParent(i),
                                StartIndex    = i,
                                Count         = 1,
                                GroupSize     = groupHeaderSize,
                                GroupPosition = Current
                            };
                            groups.Add(currentGroup);
                            Current += groupHeaderSize;
                        }
                        //optional
                        else if (source.IsGroupFooter(i))
                        {
                            //currentGroup.hasFooter = true;
                            currentGroup.Count++;
                            currentGroup.GroupSize += groupFooterSize;
                            Current += groupFooterSize;
                        }
                        else
                        {
                            currentGroup.Count++;
                            int index = i - currentGroup.StartIndex - 1; // groupHeader must always exist.
                            if ((index % spanSize) == 0)
                            {
                                currentGroup.GroupSize += StepCandidate;
                                Current += StepCandidate;
                            }
                        }
                    }
                }
                ScrollContentSize = Current;
            }
            else
            {
                // 3. Measure the scroller content size.
                ScrollContentSize = StepCandidate * Convert.ToInt32(Math.Ceiling((double)pureCount / (double)spanSize));
                if (hasHeader)
                {
                    ScrollContentSize += headerSize;
                }
                if (hasFooter)
                {
                    ScrollContentSize += footerSize;
                }
            }

            if (IsHorizontal)
            {
                colView.ContentContainer.SizeWidth = ScrollContentSize;
            }
            else
            {
                colView.ContentContainer.SizeHeight = ScrollContentSize;
            }

            base.Initialize(colView);
            //Console.WriteLine("Init Done, StepCnadidate{0}, spanSize{1}, Scroll{2}", StepCandidate, spanSize, ScrollContentSize);
        }
예제 #23
0
        public override void Initialize(RecyclerView view)
        {
            colView = view as CollectionView;
            if (colView == null)
            {
                throw new ArgumentException("LinearLayouter only can be applied CollectionView.", nameof(view));
            }
            // 1. Clean Up
            foreach (RecyclerViewItem item in VisibleItems)
            {
                colView.UnrealizeItem(item, false);
            }
            VisibleItems.Clear();
            ItemPosition.Clear();
            ItemSize.Clear();
            groups.Clear();

            FirstVisible = 0;
            LastVisible  = 0;

            IsHorizontal = (colView.ScrollingDirection == ScrollableBase.Direction.Horizontal);

            RecyclerViewItem header = colView?.Header;
            RecyclerViewItem footer = colView?.Footer;
            float            width, height;
            int count = colView.InternalItemSource.Count;

            if (header != null)
            {
                MeasureChild(colView, header);

                width = header.Layout != null?header.Layout.MeasuredWidth.Size.AsRoundedValue() : 0;

                height = header.Layout != null?header.Layout.MeasuredHeight.Size.AsRoundedValue() : 0;

                headerSize = IsHorizontal ? width : height;
                hasHeader  = true;

                colView.UnrealizeItem(header);
            }
            else
            {
                hasHeader = false;
            }

            if (footer != null)
            {
                MeasureChild(colView, footer);

                width = footer.Layout != null?footer.Layout.MeasuredWidth.Size.AsRoundedValue() : 0;

                height = footer.Layout != null?footer.Layout.MeasuredHeight.Size.AsRoundedValue() : 0;

                footerSize   = IsHorizontal ? width : height;
                footer.Index = count - 1;
                hasFooter    = true;

                colView.UnrealizeItem(footer);
            }
            else
            {
                hasFooter = false;
            }

            //No Internal Source exist.
            if (count == (hasHeader ? (hasFooter ? 2 : 1) : 0))
            {
                return;
            }

            int firstIndex = hasHeader ? 1 : 0;

            if (colView.IsGrouped)
            {
                isGrouped = true;

                if (colView.GroupHeaderTemplate != null)
                {
                    while (!colView.InternalItemSource.IsGroupHeader(firstIndex))
                    {
                        firstIndex++;
                    }
                    //must be always true
                    if (colView.InternalItemSource.IsGroupHeader(firstIndex))
                    {
                        RecyclerViewItem groupHeader = colView.RealizeItem(firstIndex);
                        firstIndex++;

                        if (groupHeader == null)
                        {
                            throw new Exception("[" + firstIndex + "] Group Header failed to realize!");
                        }

                        // Need to Set proper height or width on scroll direction.
                        if (groupHeader.Layout == null)
                        {
                            width  = groupHeader.WidthSpecification;
                            height = groupHeader.HeightSpecification;
                        }
                        else
                        {
                            MeasureChild(colView, groupHeader);

                            width  = groupHeader.Layout.MeasuredWidth.Size.AsRoundedValue();
                            height = groupHeader.Layout.MeasuredHeight.Size.AsRoundedValue();
                        }
                        //Console.WriteLine("[NUI] GroupHeader Size {0} :{0}", width, height);
                        // pick the StepCandidate.
                        groupHeaderSize = IsHorizontal ? width : height;
                        colView.UnrealizeItem(groupHeader);
                    }
                }
                else
                {
                    groupHeaderSize = 0F;
                }

                if (colView.GroupFooterTemplate != null)
                {
                    int firstFooter = firstIndex;
                    while (!colView.InternalItemSource.IsGroupFooter(firstFooter))
                    {
                        firstFooter++;
                    }
                    //must be always true
                    if (colView.InternalItemSource.IsGroupFooter(firstFooter))
                    {
                        RecyclerViewItem groupFooter = colView.RealizeItem(firstFooter);

                        if (groupFooter == null)
                        {
                            throw new Exception("[" + firstFooter + "] Group Footer failed to realize!");
                        }
                        // Need to Set proper height or width on scroll direction.
                        if (groupFooter.Layout == null)
                        {
                            width  = groupFooter.WidthSpecification;
                            height = groupFooter.HeightSpecification;
                        }
                        else
                        {
                            MeasureChild(colView, groupFooter);

                            width  = groupFooter.Layout.MeasuredWidth.Size.AsRoundedValue();
                            height = groupFooter.Layout.MeasuredHeight.Size.AsRoundedValue();
                        }
                        // pick the StepCandidate.
                        groupFooterSize = IsHorizontal ? width : height;

                        colView.UnrealizeItem(groupFooter);
                    }
                }
                else
                {
                    groupFooterSize = 0F;
                }
            }
            else
            {
                isGrouped = false;
            }

            bool failed = false;

            //Final Check of FirstIndex
            while (colView.InternalItemSource.IsHeader(firstIndex) ||
                   colView.InternalItemSource.IsGroupHeader(firstIndex) ||
                   colView.InternalItemSource.IsGroupFooter(firstIndex))
            {
                if (colView.InternalItemSource.IsFooter(firstIndex))
                {
                    StepCandidate = 0F;
                    failed        = true;
                    break;
                }
                firstIndex++;
            }

            if (!failed)
            {
                RecyclerViewItem sizeDeligate = colView.RealizeItem(firstIndex);
                if (sizeDeligate == null)
                {
                    // error !
                    throw new Exception("Cannot create content from DatTemplate.");
                }

                sizeDeligate.BindingContext = colView.InternalItemSource.GetItem(firstIndex);

                // Need to Set proper height or width on scroll direction.
                if (sizeDeligate.Layout == null)
                {
                    width  = sizeDeligate.WidthSpecification;
                    height = sizeDeligate.HeightSpecification;
                }
                else
                {
                    MeasureChild(colView, sizeDeligate);

                    width  = sizeDeligate.Layout.MeasuredWidth.Size.AsRoundedValue();
                    height = sizeDeligate.Layout.MeasuredHeight.Size.AsRoundedValue();
                }
                //Console.WriteLine("[NUI] Layout Size {0} :{0}", width, height);
                // pick the StepCandidate.
                StepCandidate = IsHorizontal ? width : height;
                if (StepCandidate == 0)
                {
                    StepCandidate = 1;                     //????
                }
                colView.UnrealizeItem(sizeDeligate);
            }

            float Current = 0.0F;
            IGroupableItemSource source       = colView.InternalItemSource;
            GroupInfo            currentGroup = null;

            for (int i = 0; i < count; i++)
            {
                if (colView.SizingStrategy == ItemSizingStrategy.MeasureAll)
                {
                    if (i == 0 && hasHeader)
                    {
                        ItemSize.Add(headerSize);
                    }
                    else if (i == count - 1 && hasFooter)
                    {
                        ItemSize.Add(footerSize);
                    }
                    else if (source.IsGroupHeader(i))
                    {
                        ItemSize.Add(groupHeaderSize);
                    }
                    else if (source.IsGroupFooter(i))
                    {
                        ItemSize.Add(groupFooterSize);
                    }
                    else
                    {
                        ItemSize.Add(StepCandidate);
                    }
                }
                if (isGrouped)
                {
                    if (i == 0 && hasHeader)
                    {
                        //ItemPosition.Add(Current);
                        Current += headerSize;
                    }
                    else if (i == count - 1 && hasFooter)
                    {
                        //ItemPosition.Add(Current);
                        Current += footerSize;
                    }
                    else
                    {
                        //GroupHeader must always exist in group usage.
                        if (source.IsGroupHeader(i))
                        {
                            currentGroup = new GroupInfo()
                            {
                                GroupParent = source.GetGroupParent(i),
                                //hasHeader = true,
                                //hasFooter = false,
                                StartIndex    = i,
                                Count         = 1,
                                GroupSize     = groupHeaderSize,
                                GroupPosition = Current
                            };
                            currentGroup.ItemPosition.Add(0);
                            groups.Add(currentGroup);
                            Current += groupHeaderSize;
                        }
                        //optional
                        else if (source.IsGroupFooter(i))
                        {
                            //currentGroup.hasFooter = true;
                            currentGroup.Count++;
                            currentGroup.GroupSize += groupFooterSize;
                            currentGroup.ItemPosition.Add(Current - currentGroup.GroupPosition);
                            Current += groupFooterSize;
                        }
                        else
                        {
                            currentGroup.Count++;
                            currentGroup.GroupSize += StepCandidate;
                            currentGroup.ItemPosition.Add(Current - currentGroup.GroupPosition);
                            Current += StepCandidate;
                        }
                    }
                }
                else
                {
                    ItemPosition.Add(Current);

                    if (i == 0 && hasHeader)
                    {
                        Current += headerSize;
                    }
                    else if (i == count - 1 && hasFooter)
                    {
                        Current += footerSize;
                    }
                    else
                    {
                        Current += StepCandidate;
                    }
                }
            }

            ScrollContentSize = Current;
            if (IsHorizontal)
            {
                colView.ContentContainer.SizeWidth = ScrollContentSize;
            }
            else
            {
                colView.ContentContainer.SizeHeight = ScrollContentSize;
            }


            base.Initialize(view);
            //Console.WriteLine("[NUI] Init Done, StepCnadidate{0}, Scroll{1}", StepCandidate, ScrollContentSize);
        }
예제 #24
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <overloads>There are five overloads for the constructor</overloads>
        protected SandcastleProject()
        {
            characterMatchEval = new MatchEvaluator(this.OnCharacterMatch);
            buildVarMatchEval = new MatchEvaluator(this.OnBuildVarMatch);

            docSources = new DocumentationSourceCollection(this);
            docSources.ListChanged += docSources_ListChanged;

            namespaceSummaries = new NamespaceSummaryItemCollection(this);
            namespaceSummaries.ListChanged += ItemList_ListChanged;

            references = new ReferenceItemCollection(this);
            references.ListChanged += ItemList_ListChanged;

            componentConfigs = new ComponentConfigurationDictionary(this);
            plugInConfigs = new PlugInConfigurationDictionary(this);

            apiFilter = new ApiFilterCollection(this);
            apiFilter.ListChanged += ItemList_ListChanged;

            helpAttributes = new MSHelpAttrCollection(this);
            helpAttributes.ListChanged += ItemList_ListChanged;

            try
            {
                loadingProperties = removeProjectWhenDisposed = true;

                contentPlacement = ContentPlacement.AboveNamespaces;
                cleanIntermediates = keepLogFile = binaryTOC = includeStopWordList = true;

                this.BuildLogFile = null;

                missingTags = MissingTags.Summary | MissingTags.Parameter | MissingTags.TypeParameter |
                    MissingTags.Returns | MissingTags.AutoDocumentCtors | MissingTags.Namespace |
                    MissingTags.AutoDocumentDispose;

                visibleItems = VisibleItems.InheritedFrameworkMembers | VisibleItems.InheritedMembers |
                    VisibleItems.Protected | VisibleItems.ProtectedInternalAsProtected;

                buildAssemblerVerbosity = BuildAssemblerVerbosity.OnlyWarningsAndErrors;
                helpFileFormat = HelpFileFormats.HtmlHelp1;
                htmlSdkLinkType = websiteSdkLinkType = HtmlSdkLinkType.Msdn;
                help2SdkLinkType = MSHelp2SdkLinkType.Msdn;
                helpViewerSdkLinkType = MSHelpViewerSdkLinkType.Msdn;
                sdkLinkTarget = SdkLinkTarget.Blank;
                presentationStyle = Constants.DefaultPresentationStyle;
                namingMethod = NamingMethod.Guid;
                syntaxFilters = ComponentUtilities.DefaultSyntaxFilter;
                collectionTocStyle = CollectionTocStyle.Hierarchical;
                helpFileVersion = "1.0.0.0";
                tocOrder = -1;
                maximumGroupParts = 2;

                this.OutputPath = null;
                this.HtmlHelp1xCompilerPath = this.HtmlHelp2xCompilerPath = this.WorkingPath =
                    this.ComponentPath = null;

                this.HelpTitle = this.HtmlHelpName = this.CopyrightHref = this.CopyrightText =
                    this.FeedbackEMailAddress = this.FeedbackEMailLinkText = this.HeaderText = this.FooterText =
                    this.ProjectSummary = this.RootNamespaceTitle = this.PlugInNamespaces = this.TopicVersion =
                    this.TocParentId = this.TocParentVersion = this.CatalogProductId = this.CatalogVersion =
                    this.CatalogName = null;
                this.FrameworkVersion = null;

                language = new CultureInfo("en-US");
            }
            finally
            {
                loadingProperties = false;
            }
        }
예제 #25
0
    public void OnMouseDown()
    {
        selectCheck = GameObject.Find("Selected Card").transform;

        if (PlayGameAssets.cashAmount >= Selected.cardCost) //Checks if finances are enough to purchase
        {
            PlayGameAssets.cashAmount = PlayGameAssets.cashAmount - Selected.cardCost;
            //Money available Text
            PlayGameAssets.moneyTxt = GameObject.Find("Cash").GetComponent <Text>();
            string e = "Cash Amount: " + PlayGameAssets.cashAmount + "k"; //updates current finances
            Debug.Log(e);
            PlayGameAssets.moneyTxt.text = e;

            //Sends cards out of the game after they are purchased
            if (selectCheck.transform.childCount == 0)
            {
                errorMessage = GameObject.Find("ErrorMessage").GetComponent <Text>();
                string p = "Select a Card first!";
                errorMessage.text = p;

                StartCoroutine(DeleteMessage.coroutineA()); //it deletes the displayed message after X seconds
            }
            else if (Selected.selected.transform.childCount == 1)
            {
                EndTurn.AdminMessage = GameObject.Find("EndOfTurnMessage").GetComponent <Text>();

                myTest = GameObject.FindObjectOfType(typeof(VisibleItems)) as VisibleItems;
                myTest.DisableItems();
                defencesBought.Add(Selected.cardname);
                //setVisibleObject.DisableItems();

                Debug.Log("We got before the check");
                if (Selected.cardname == "Threat Assessment") // the only card that can be bought multiple times
                {
                    EndTurn.AdminMessage.text = " Organised crime attackers have high skills and clear motivations: they will use advanced attack techniques, such as sophisticated phishing email, Remote Access Tools(RATs) and bespoke malware, in order to steal sensitive data or disrupt a target in subtle ways. Unlike script kiddies who hit indiscriminately all systems that they can reach, such advanced attackers choose specific, valuable targets, which makes their attacks less likely. However, the probability of facing them cannot be underestimated: it would be surprising if at least one of them did not take interest in the company at some point in time." + " " + EndTurn.AdminMessage.text;


                    EndTurn.AdminMessage.text = " Script kiddies have low computer skills: they only use tools built by others and their attack repertoire is limited to simple, known techniques, such as scanning an infrastructure for known vulnerabilities, spreading malware found on the Internet via poorly - written email, or running small Denial of Service attacks with experimental tools.They are motivated by the “fun” aspect of hacking more than anything else.Due to the number of such low-skilled attackers and the wide availability of their techniques, their attacks are expected to be targeting the company’s infrastructure at all times.They are probably already at work as we speak! " + " " + EndTurn.AdminMessage.text;
                    StartCoroutine(DeleteMessage.coroutineC());
                }
                if (Selected.cardname == "Security Training")
                {
                    EndTurn.AdminMessage.text = DeploymentText.SecurityTraining;
                }
                if (Selected.cardname == "Plant Firewall" || Selected.cardname == "Office Firewall")
                {
                    EndTurn.AdminMessage.text = DeploymentText.Firewall;
                }
                if (Selected.cardname == "Network Monitoring O." || Selected.cardname == "Network Monitoring P.")
                {
                    EndTurn.AdminMessage.text = DeploymentText.NetworkMon;
                }
                if (Selected.cardname == "Antivirus")
                {
                    EndTurn.AdminMessage.text = DeploymentText.Antivirus;
                }
                if (Selected.cardname == "Office CCTV" || Selected.cardname == "Plant CCTV")
                {
                    EndTurn.AdminMessage.text = DeploymentText.CCTV;
                }
                if (Selected.cardname == "Server Upgrade")
                {
                    EndTurn.AdminMessage.text = DeploymentText.ServerUpgrade;
                }
                if (Selected.cardname == "Pc Upgrade")
                {
                    EndTurn.AdminMessage.text = DeploymentText.PCUpgrade;
                }
                if (Selected.cardname == "PC Encryption")
                {
                    EndTurn.AdminMessage.text = DeploymentText.PCEncryption;
                }
                if (Selected.cardname == "Controller Upgrade")
                {
                    EndTurn.AdminMessage.text = DeploymentText.ControllerUpgrade;
                }
                if (Selected.cardname == "Database Encryption")
                {
                    EndTurn.AdminMessage.text = DeploymentText.DatabaseEncryption;
                }

                if (Selected.cardname == "Asset Audit")
                {
                    //Recursibely sets active all objects with parent "hand"
                    Selected.hand.gameObject.SetActiveRecursively(true);

                    // and still deletes the selected card
                    Selected.child = Selected.selected.transform.GetChild(0);
                    Destroy(Selected.child.gameObject);
                    EndTurn.AdminMessage.text = DeploymentText.AssetAudit;
                }
                else
                {
                    Selected.child = Selected.selected.transform.GetChild(0);
                    Destroy(Selected.child.gameObject);
                }

                StartCoroutine(DeleteMessage.coroutineC());
            }
        }
        else
        {
            errorMessage = GameObject.Find("ErrorMessage").GetComponent <Text>();
            string p = "ERROR, not enough funds";
            errorMessage.text = p;

            StartCoroutine(DeleteMessage.coroutineA());
        }
    }
        /// <inheritdoc />
        /// <remarks>For this page, we only need to bind one control as all the values are stored in a single
        /// property.</remarks>
        protected override bool StoreControlValue(Control control)
        {
            VisibleItems items = VisibleItems.None;

#if !STANDALONEGUI
            if (this.ProjectMgr == null)
            {
                return(false);
            }

            if (control.Name == "lblAPIFilterState")
            {
                if (filterChanged)
                {
                    this.ProjectMgr.SetProjectProperty("ApiFilter", apiFilter);
                    filterChanged = false;
                }

                return(true);
            }
#else
            if (this.CurrentProject == null)
            {
                return(false);
            }

            if (control.Name == "lblAPIFilterState")
            {
                if (filterChanged)
                {
                    this.CurrentProject.MSBuildProject.SetProperty("ApiFilter", apiFilter);
                    filterChanged = false;
                }

                return(true);
            }
#endif
            if (chkAttributes.Checked)
            {
                items |= VisibleItems.Attributes;
            }

            if (chkExplicitInterfaceImplementations.Checked)
            {
                items |= VisibleItems.ExplicitInterfaceImplementations;
            }

            if (chkInheritedFrameworkInternalMembers.Checked)
            {
                items |= VisibleItems.InheritedFrameworkInternalMembers;
            }

            if (chkInheritedFrameworkMembers.Checked)
            {
                items |= VisibleItems.InheritedFrameworkMembers;
            }

            if (chkInheritedFrameworkPrivateMembers.Checked)
            {
                items |= VisibleItems.InheritedFrameworkPrivateMembers;
            }

            if (chkInheritedMembers.Checked)
            {
                items |= VisibleItems.InheritedMembers;
            }

            if (chkInternals.Checked)
            {
                items |= VisibleItems.Internals;
            }

            if (chkPrivateFields.Checked)
            {
                items |= VisibleItems.PrivateFields;
            }

            if (chkPrivates.Checked)
            {
                items |= VisibleItems.Privates;
            }

            if (chkProtected.Checked)
            {
                items |= VisibleItems.Protected;
            }

            if (chkProtectedInternalAsProtected.Checked)
            {
                items |= VisibleItems.ProtectedInternalAsProtected;
            }

            if (chkSealedProtected.Checked)
            {
                items |= VisibleItems.SealedProtected;
            }

            if (chkNoPIATypes.Checked)
            {
                items |= VisibleItems.NoPIATypes;
            }

            if (chkPublicCompilerGenerated.Checked)
            {
                items |= VisibleItems.PublicCompilerGenerated;
            }

#if !STANDALONEGUI
            this.ProjectMgr.SetProjectProperty("VisibleItems", items.ToString());
#else
            this.CurrentProject.MSBuildProject.SetProperty("VisibleItems", items.ToString());
#endif
            return(true);
        }
예제 #27
0
        /// <summary>
        /// This is called to find out where items are lain out according to current scroll position.
        /// </summary>
        /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
        /// <param name="force">boolean force flag to layouting forcely.</param>
        public override void RequestLayout(float scrollPosition, bool force = false)
        {
            // Layouting is only possible after once it intialized.
            if (!IsInitialized)
            {
                return;
            }
            int LastIndex = colView.InternalItemSource.Count;

            if (!force && PrevScrollPosition == Math.Abs(scrollPosition))
            {
                return;
            }
            PrevScrollPosition = Math.Abs(scrollPosition);

            int  prevFirstVisible = FirstVisible;
            int  prevLastVisible  = LastVisible;
            bool IsHorizontal     = (colView.ScrollingDirection == ScrollableBase.Direction.Horizontal);

            (float X, float Y)visibleArea = (PrevScrollPosition,
                                             PrevScrollPosition + (IsHorizontal ? colView.Size.Width : colView.Size.Height)
                                             );

            //Console.WriteLine("[NUI] itemsView [{0},{1}] [{2},{3}]", colView.Size.Width, colView.Size.Height, colView.ContentContainer.Size.Width, colView.ContentContainer.Size.Height);

            // 1. Set First/Last Visible Item Index.
            (int start, int end) = FindVisibleItems(visibleArea);
            FirstVisible         = start;
            LastVisible          = end;

            //Console.WriteLine("[NUI] {0} :visibleArea before [{1},{2}] after [{3},{4}]", scrollPosition, prevFirstVisible, prevLastVisible, FirstVisible, LastVisible);

            // 2. Unrealize invisible items.
            List <RecyclerViewItem> unrealizedItems = new List <RecyclerViewItem>();

            foreach (RecyclerViewItem item in VisibleItems)
            {
                if (item.Index < FirstVisible || item.Index > LastVisible)
                {
                    //Console.WriteLine("[NUI] Unrealize{0}!", item.Index);
                    unrealizedItems.Add(item);
                    colView.UnrealizeItem(item);
                }
            }
            VisibleItems.RemoveAll(unrealizedItems.Contains);

            //Console.WriteLine("Realize Begin [{0} to {1}]", FirstVisible, LastVisible);
            // 3. Realize and placing visible items.
            for (int i = FirstVisible; i <= LastVisible; i++)
            {
                //Console.WriteLine("[NUI] Realize!");
                RecyclerViewItem item = null;
                // 4. Get item if visible or realize new.
                if (i >= prevFirstVisible && i <= prevLastVisible)
                {
                    item = GetVisibleItem(i);
                    if (item)
                    {
                        continue;
                    }
                }
                if (item == null)
                {
                    item = colView.RealizeItem(i);
                }
                VisibleItems.Add(item);

                (float x, float y) = GetItemPosition(i);
                // 5. Placing item.
                item.Position = new Position(x, y);
                //Console.WriteLine("[NUI] ["+item.Index+"] ["+item.Position.X+", "+item.Position.Y+" ==== \n");
            }
            //Console.WriteLine("Realize Done");
        }