Ejemplo n.º 1
0
        public void AddFiles(List <FileModel> files)
        {
            foreach (FileModel file in files)
            {
                FileListItem item = new FileListItem(file);
                item.Margin = new Thickness(5);

                item.RenameFile      += Item_RenameFile;
                item.DownloadFile    += Item_DownloadFile;
                item.OpenFile        += Item_OpenFile;
                item.SelectedChanged += Item_SelectedChanged;
                item.DataChanged     += Item_DataChanged;

                if (SelectedFiles.Contains(file))
                {
                    item.Selected = true;
                }

                item.AllowSelect = AllowSelect;
                item.AllowDelete = false;

                Files.Add(item);
            }

            _innerStack.Children.Remove(NoElementsPlaceholder);

            Sort();
        }
Ejemplo n.º 2
0
        private void Item_SelectedChanged(object sender, EventArgs e)
        {
            FileListItem fileItem = (FileListItem)sender;

            if (fileItem.Selected)
            {
                SelectedFiles.Add(fileItem.File);
            }
            else
            {
                SelectedFiles.Remove(fileItem.File);
            }

            SelectedListChanged?.Invoke(this, EventArgs.Empty);
        }