public Package(int type, UserDirectory userDirectory, User user, DungeonFileInfo fileInfo) { Type = type; UserDirectory = userDirectory; Sub = user.sub; FileTransfer = fileInfo; }
public async void UploadButtonClick() { string filePath; using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.InitialDirectory = "c:\\"; openFileDialog.Filter = "All files (*.*)|*.*"; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { //Get the path of specified file filePath = openFileDialog.FileName; } else { return; } } FileInfo fileInfoForHumans = new FileInfo(filePath); DungeonFileInfo fileInfo = new DungeonFileInfo() { Path = fileInfoForHumans.FullName, Name = fileInfoForHumans.Name, FileSize = fileInfoForHumans.Length }; string pathFromRoot; try { pathFromRoot = UserDirectorySingletone.Instance.CurrentDirectory.Path; } catch { pathFromRoot = ""; } UserDirectorySingletone.Instance.UD = await Task.Factory.StartNew(() => SessionSingleton.Instance.NM.UploadNewFile(UserDirectorySingletone.Instance.UD, fileInfo, pathFromRoot, filePath)); }