/// <summary> /// 导出 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripMenuItemOutput_Click(object sender, EventArgs e) { if (ListViewKit.hasSelectedItem(this.listViewRecordList)) { string fileName = this.listViewRecordList.SelectedItems[0].Text.Trim(); string saveFilePath = DialogKit.ShowSaveMediaDialog(fileName); if (saveFilePath != null) { string sourceFilePath = GetScreemRecordPath() + fileName; File.Copy(sourceFilePath, saveFilePath); } } }
private void buttonPushFile_Click(object sender, EventArgs e) { string[] filesPath = DialogKit.OpenFileDialog(); if (filesPath == null) { return; } foreach (string filePath in filesPath) { TaskInfo t = new TaskInfo(TaskType.PushFile); t.DataArray = new object[] { filePath, currentExplorerPath }; t.ResultHandler = new TaskInfo.EventResultHandler(pushFileResult); taskThread.SendTask(t); } }
private void ShowSaveFileDialog() { //设置文件类型 string filter = "PNG(*.png)|*.png|JPEG(*.jpg)|*.jpg|BMP(*.bmp)|*.bmp|Gif(*.gif)|*.gif|TIFF(*.tiff)|*.tiff|EXIF(*.exif)|*.exif"; string fileName = "screenshot" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png"; SaveFileDialog sfd = DialogKit.GetSaveFileDialog(fileName, filter); if (sfd != null) { string localFilePath = sfd.FileName.ToString(); //获得文件路径 string fileNameExt = Path.GetFileName(localFilePath); //获取文件名,不带路径 int selectIndex = sfd.FilterIndex; ImageFormat format; switch (selectIndex) { case 1: format = ImageFormat.Png; break; case 2: format = ImageFormat.Jpeg; break; case 3: format = ImageFormat.Bmp; break; case 4: format = ImageFormat.Gif; break; case 5: format = ImageFormat.Tiff; break; case 6: format = ImageFormat.Exif; break; default: format = ImageFormat.Png; break; } this.pictureBox1.Image.Save(localFilePath, format); } }
private void buttonSave_Click(object sender, EventArgs e) { string content = this.textBoxContent.Text; if (!string.IsNullOrEmpty(content)) { string defaultName = "logcat_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".log"; string savePath = DialogKit.ShowSaveLogDialog(defaultName); if (!string.IsNullOrEmpty(savePath)) { FileStream fs = new FileStream(savePath, FileMode.Create); StreamWriter sw = new StreamWriter(fs, Encoding.Default); sw.Write(content); sw.Close(); fs.Close(); } } }
private void ShowSaveFileDialog() { string filter = "PNG(*.png)|*.png|JPEG(*.jpg)|*.jpg|BMP(*.bmp)|*.bmp|Gif(*.gif)|*.gif|TIFF(*.tiff)|*.tiff|EXIF(*.exif)|*.exif"; string fileName = "screenshot" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".png"; SaveFileDialog dialog = DialogKit.GetSaveFileDialog(fileName, filter); if (dialog != null) { string path = dialog.FileName.ToString(); int selectIndex = dialog.FilterIndex; ImageFormat format; switch (selectIndex) { case 1: format = ImageFormat.Png; break; case 2: format = ImageFormat.Jpeg; break; case 3: format = ImageFormat.Bmp; break; case 4: format = ImageFormat.Gif; break; case 5: format = ImageFormat.Tiff; break; case 6: format = ImageFormat.Exif; break; default: format = ImageFormat.Png; break; } this.pictureBoxPreview.Image.Save(path, format); } }
private void mToolStripMenuItemExport_Click(object sender, EventArgs e) { if (ListViewKit.hasSelectedItem(this.listViewExplorer)) { ExplorerFileInfo file = (ExplorerFileInfo)this.listViewExplorer.SelectedItems[0].Tag; string savePath = null; if (file.IsFolder) { // 选择文件夹 savePath = DialogKit.ShowSaveFolderDialog(); savePath = Path.Combine(savePath, Path.GetFileName(file.FileFullPath)); } else { // 选择文件存储路径 savePath = DialogKit.ShowSaveDialog(file.FileName); } pullFileFromDevice(file.FileFullPath, savePath); } }