示例#1
0
        private bool FolderNameCheck(string name)
        {
            foreach (var item in FilesGridView.Items)
            {
                TemporaryFilesList file = item as TemporaryFilesList;

                if (FileType.Folder == file.Type)
                {
                    if (name == file.Name)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
示例#2
0
        private void FilesGridView_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
        {
            if (!OperationWaiting.IsIndeterminate && null != e.OriginalSource)
            {
                FrameworkElement   element = (FrameworkElement)e.OriginalSource;
                TemporaryFilesList file    = (TemporaryFilesList)element.DataContext;
                if (FileType.Folder == file.Type)
                {
                    BehindButton.IsEnabled = true;
                    FolderTree.Add(file.Name);
                    string path = "\\";
                    foreach (string i in FolderTree)
                    {
                        path += i + "\\";
                    }
                    FolderPath.Text = path;

                    RequestFiles();
                }
            }
        }
示例#3
0
        private async void DownloadButton_Click(object sender, RoutedEventArgs e)
        {
            if (!OperationWaiting.IsIndeterminate)
            {
                if (ListViewSelectionMode.Single == FilesGridView.SelectionMode)
                {
                    if (-1 != FilesGridView.SelectedIndex)
                    {
                        TemporaryFilesList file = FilesGridView.SelectedItem as TemporaryFilesList;
                        if (FileType.Folder == file.Type)
                        {
                            RunningDatas.ErrorNotify("不能下载文件夹");
                            return;
                        }

                        StorageFolder folder = await GetFolder();

                        if (null == folder)
                        {
                            return;
                        }

                        RunningDatas.FileWaiting.Add
                        (
                            FolderPath.Text,
                            file.Name,
                            new FileReqPackage
                        {
                            FileName = file.Name,
                            Path     = folder,
                            Size     = file.Size,
                            Type     = StreamType.Download
                        }
                        );
                    }
                    else
                    {
                        RunningDatas.ErrorNotify("请选择需要下载的文件");
                    }
                }
                else
                {
                    if (0 != FilesGridView.SelectedItems.Count)
                    {
                        StorageFolder folder = await GetFolder();

                        if (null == folder)
                        {
                            return;
                        }

                        foreach (var i in FilesGridView.SelectedItems)
                        {
                            TemporaryFilesList item = i as TemporaryFilesList;

                            if (FileType.Folder == item.Type)
                            {
                                RunningDatas.InfoNotify("不能下载文件夹:" + item.Name);
                                return;
                            }

                            RunningDatas.FileWaiting.Add
                            (
                                FolderPath.Text,
                                item.Name,
                                new FileReqPackage
                            {
                                FileName = item.Name,
                                Path     = folder,
                                Size     = item.Size,
                                Type     = StreamType.Download
                            }
                            );
                        }
                    }
                    else
                    {
                        RunningDatas.ErrorNotify("请选择需要下载的文件");
                    }
                }
            }
        }
示例#4
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            if (!OperationWaiting.IsIndeterminate)
            {
                if (ListViewSelectionMode.Single == FilesGridView.SelectionMode)
                {
                    if (-1 != FilesGridView.SelectedIndex)
                    {
                        TemporaryFilesList file = FilesGridView.SelectedItem as TemporaryFilesList;
                        if (FileType.Folder == file.Type)
                        {
                            RunningDatas.DataSender.DeleteFolder(new DeleteFolderFile
                            {
                                Path = FolderPath.Text,
                                Name = file.Name
                            });
                        }
                        else
                        {
                            RunningDatas.DataSender.DeleteFile(new DeleteFolderFile
                            {
                                Path = FolderPath.Text,
                                Name = file.Name
                            });
                        }
                        RequestFiles();
                    }
                    else
                    {
                        RunningDatas.ErrorNotify("请选择需要删除的文件或文件夹");
                    }
                }
                else
                {
                    if (0 != FilesGridView.SelectedItems.Count)
                    {
                        foreach (var i in FilesGridView.SelectedItems)
                        {
                            TemporaryFilesList item = i as TemporaryFilesList;

                            if (FileType.Folder == item.Type)
                            {
                                RunningDatas.DataSender.DeleteFolder(new DeleteFolderFile
                                {
                                    Path = FolderPath.Text,
                                    Name = item.Name
                                });
                            }
                            else
                            {
                                RunningDatas.DataSender.DeleteFile(new DeleteFolderFile
                                {
                                    Path = FolderPath.Text,
                                    Name = item.Name
                                });
                            }
                            RequestFiles();
                        }
                    }
                    else
                    {
                        RunningDatas.ErrorNotify("请选择需要删除的文件或文件夹");
                    }
                }
            }
        }