public PostedFilesViewModel(BaseViewModel parent)
            : base(parent, false)
        {
            Rooms = new ObservableCollection <PostedFileRoomViewModel>();

            using (var client = ClientModel.Get())
            {
                var items = new Dictionary <string, PostedFileRoomViewModel>();

                foreach (var file in client.Chat.PostedFiles)
                {
                    foreach (var roomName in file.RoomNames)
                    {
                        PostedFileRoomViewModel item;
                        if (!items.TryGetValue(roomName, out item))
                        {
                            item = new PostedFileRoomViewModel(client, roomName, this);
                            items.Add(roomName, item);
                            Rooms.Add(item);
                        }

                        item.PostedFiles.Add(new PostedFileViewModel(client, file, item));
                    }
                }
            }
        }
        public PostedFileViewModel(ClientGuard client, PostedFile postedFile, PostedFileRoomViewModel parent)
            : base(parent, false)
        {
            this._parent = parent;

            FileId   = postedFile.File.Id;
            FileName = postedFile.File.Name;

            RemoveCommand = new Command(Remove, _ => ClientModel.Api != null);
        }
Пример #3
0
        public PostedFilesViewModel(BaseViewModel parent)
            : base(parent, false)
        {
            Rooms = new ObservableCollection<PostedFileRoomViewModel>();

              using (var client = ClientModel.Get())
              {
            var items = new Dictionary<string, PostedFileRoomViewModel>();

            foreach (var file in client.PostedFiles)
            {
              PostedFileRoomViewModel item;
              if (!items.TryGetValue(file.RoomName, out item))
              {
            item = new PostedFileRoomViewModel(client, file.RoomName, this);
            items.Add(file.RoomName, item);
            Rooms.Add(item);
              }

              item.PostedFiles.Add(new PostedFileViewModel(client, file, item));
            }
              }
        }
 public void RemoveRoom(PostedFileRoomViewModel item)
 {
     Rooms.Remove(item);
     item.Dispose();
 }
Пример #5
0
        public PostedFileViewModel(ClientGuard client, PostedFile postedFile, PostedFileRoomViewModel parent)
            : base(parent, false)
        {
            this.parent = parent;

              FileId = postedFile.File.Id;
              FileName = postedFile.File.Name;

              RemoveCommand = new Command(Remove, _ => ClientModel.Api != null);
        }
Пример #6
0
 public void RemoveRoom(PostedFileRoomViewModel item)
 {
     Rooms.Remove(item);
       item.Dispose();
 }