void View_SelectionChanged(object sender, EventArgs e)
        {
            if (longUpdateRunning)
            {
                return;
            }

            ResourceItem selectedItem = SelectedItems.OfType <ResourceItem>().FirstOrDefault();

            if (selectedItem != null)
            {
                if (itemViews.ContainsKey(selectedItem.ResourceType))
                {
                    var itemView = itemViews[selectedItem.ResourceType];
                    itemView.ResourceItem = selectedItem;
                    view.SetItemView(itemView);
                }
                else
                {
                    view.SetItemView(null);
                }
            }

            // When selection is changed, reset any new item marked with IsNew to pass the filter
            foreach (var newItem in ResourceItems.Where(ri => ri.IsNew))
            {
                newItem.IsNew = false;
            }
        }
Exemple #2
0
        private void DownloadSelected()
        {
            var view = ServiceLocator.Current.GetInstance <IContentView>(RegionNames.CloudDriveTransferView);

            if (view == null)
            {
                return;
            }
            FolderBrowserDialog openBrowserDialog = new FolderBrowserDialog {
                ShowNewFolderButton = true, SelectedPath = KnownFolders.GetPath(KnownFolder.Downloads)
            };
            DialogResult result = openBrowserDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                this.NotifyMessageInfo("正在下载文件,请稍后...");
                var downloadItems = ResourceItems.Where(resourceItem => resourceItem.IsSelected && !resourceItem.IsFolder).ToList();
                this._eventAggregator.GetEvent <PubSubEvent <TransferActionInfo> >().Publish(new TransferActionInfo()
                {
                    DownloadFileList = downloadItems,
                    TargetPath       = openBrowserDialog.SelectedPath,
                    WorkingType      = WorkingTypeEnum.Download
                });
                //TransferList();
            }
        }