Example #1
0
        public void SubmitFileReceive(string taskid)
        {
            if (PaddingReceiveTask == null)
            {
                return;
            }

            ulong pkgid = ulong.Parse(taskid);

            FileTaskInfo task = PaddingReceiveTask.SingleOrDefault(m => m.PackageID == pkgid);

            if (task == null)
            {
                return;
            }

            PaddingReceiveTask.Remove(task);
            OnTaskAccepted(new FileTaskEventArgs(task));
        }
Example #2
0
        //选择保存文件夹的地方
        public string SelectSaveFolder(string description, string currentPath, string pkgid, string idx)
        {
            if (_folderBrowserDialog == null)
            {
                _folderBrowserDialog = new FolderBrowserDialog();
            }
            _folderBrowserDialog.Description = description;
            if (!string.IsNullOrEmpty(currentPath) && System.IO.Directory.Exists(currentPath))
            {
                _folderBrowserDialog.SelectedPath = currentPath;
            }

            if (_folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                Env.ClientConfig.FunctionConfig.Share_LastSelectedPath = _folderBrowserDialog.SelectedPath;

                //
                ulong        pid   = ulong.Parse(pkgid);
                int          index = int.Parse(idx);
                FileTaskInfo task  = PaddingReceiveTask.SingleOrDefault(m => m.PackageID == pid);
                if (task == null || task.TaskList.Count <= index || index < 0)
                {
                    return("");
                }
                task.TaskList[index].FullPath = _folderBrowserDialog.SelectedPath;
                if (Env.ClientConfig.FunctionConfig.Share_UseSameLocationToSave)
                {
                    task.TaskList.ForEach(s => s.FullPath = _folderBrowserDialog.SelectedPath);
                }


                return(_folderBrowserDialog.SelectedPath);
            }
            else
            {
                return("");
            }
        }