private void ButtonBrowse_Click(object sender, EventArgs e) { if (SavePackageDialog.ShowDialog(this) == DialogResult.OK) { TextDestination.Text = SavePackageDialog.FileName; } }
private void DoMerge() { if (!Directory.Exists(downloadsDir)) { MessageBox.Show("Invalid directory", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SavePackageDialog.InitialDirectory = downloadsDir; var saveDiag = SavePackageDialog.ShowDialog(); if (saveDiag != DialogResult.OK || string.IsNullOrWhiteSpace(SavePackageDialog.FileName)) { return; } target = SavePackageDialog.FileName; //waitForm.Show(); //waitForm.Focus(); BrowseButton.Enabled = false; DownloadsInputBox.Enabled = false; MergeButton.Enabled = false; packSize.Enabled = false; packFiles.Enabled = false; logBox.Enabled = false; isFinished = false; thread = new Thread(new ThreadStart(ThreadedStuff)); thread.Start(); timer1 = new System.Windows.Forms.Timer(); timer1.Tick += new EventHandler(timer1_Tick); timer1.Interval = 1; // in miliseconds timer1.Start(); }
private void OKBtn_Click(object sender, EventArgs e) { SavePackageDialog.FileName = m_filename; if (SavePackageDialog.ShowDialog(this) != DialogResult.OK) { return; } //Preparation: Update all resources with the correct path, and build a list with them List <ResourceItem> items = new List <ResourceItem>(); try { ResourceTree.PathSeparator = "/"; ResourceTree.Nodes[0].Text = "Library:/"; Queue <TreeNode> nl = new Queue <TreeNode>(); foreach (TreeNode n in ResourceTree.Nodes[0].Nodes) { nl.Enqueue(n); } while (nl.Count > 0) { TreeNode n = nl.Dequeue(); foreach (TreeNode tn in n.Nodes) { nl.Enqueue(tn); } if (n.Tag as ResourceItem != null && (n.Tag as ResourceItem).EntryType != EntryTypeEnum.Deleted) { ResourceItem ri = new ResourceItem(n.Tag as ResourceItem); ri.ResourcePath = n.FullPath + (ri.IsFolder ? "/" : ""); if (string.IsNullOrEmpty(ri.OriginalResourcePath)) { ri.OriginalResourcePath = ri.ResourcePath; } items.Add(ri); } } } finally { ResourceTree.Nodes[0].Text = "Library://"; } try { if (PackageProgress.RebuildPackage(this, _conn, m_filename, items, SavePackageDialog.FileName, InsertDeleteCommands.Checked) != DialogResult.OK) { return; } } catch (Exception ex) { if (ex is System.Reflection.TargetInvocationException && ex.InnerException != null) { ex = ex.InnerException; } string msg = NestedExceptionMessageProcessor.GetFullMessage(ex); MessageBox.Show(this, string.Format(Strings.PackageBuildError, msg), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } finally { } this.DialogResult = DialogResult.OK; this.Close(); }