public void SetItem(RemoteItemModelBase item, int xPosition, int yPosition) { RemoteItemModelBase existingItem = this.GetItem(xPosition, yPosition); if (existingItem != null) { this.Items.Remove(existingItem); } if (item != null) { item.XPosition = xPosition; item.YPosition = yPosition; this.Items.Add(item); } }
private void BuildBoardItems() { for (int x = 0; x < 5; x++) { for (int y = 0; y < 3; y++) { this.items[x, y] = null; RemoteItemModelBase item = this.model.GetItem(x, y); if (item != null) { if (item is RemoteCommandItemModel) { this.items[x, y] = new RemoteCommandItemViewModel((RemoteCommandItemModel)item); } else if (item is RemoteFolderItemModel) { this.items[x, y] = new RemoteFolderItemViewModel((RemoteFolderItemModel)item); } } else { this.items[x, y] = new RemoteEmptyItemViewModel(x, y); } } } if (this.model.IsSubBoard) { this.items[0, 0] = new RemoteBackItemViewModel(); } for (int x = 0; x < 5; x++) { for (int y = 0; y < 3; y++) { this.NotifyPropertyChanged("Item" + x + y); } } }