private void btn_Copy_Click(object sender, EventArgs e) { CopyForm copyForm = new CopyForm(); copyForm.Show();//非模态单独窗口 //copyForm.ShowInTaskbar = false; //copyForm.ShowDialog(); }
/// <summary> /// Copy the given link the the clipboard. /// </summary> /// <param name="url"></param> private void CopyUrl(string url = null) { if (!ConfigService.Current.NoUrlCopy && !string.IsNullOrEmpty(url)) { Clipboard.SetText(url); if (VersionService.GetPlatform() != PlatformType.Windows) { var form = new CopyForm(url); form.FormClosed += (s, e) => Application.Exit(); form.Show(); } } }
private void CopyButton_Click(object sender, EventArgs e) { try { CopyForm copyForm = new CopyForm(); List <FileSystemInfo> checkedfilesAndDirectories = new List <FileSystemInfo>(); if (isLeftActive) { foreach (ListViewItem item in LeftListView.SelectedItems) { if (item.SubItems[2].Text.Equals("<папка>")) { checkedfilesAndDirectories.Add(new DirectoryInfo(Path.Combine(LeftViewRootPath, item.SubItems[0].Text))); } else if (!item.SubItems[0].Text.Equals("...")) { string filename = item.SubItems[0].Text; if (item.SubItems[1].Text != "") { filename = filename + "." + item.SubItems[1].Text; } checkedfilesAndDirectories.Add(new FileInfo(Path.Combine(LeftViewRootPath, filename))); } } if (checkedfilesAndDirectories.Count == 0) { copyForm.Dispose(); return; } copyForm.SetParametres(checkedfilesAndDirectories, LeftViewRootPath, RightViewRootPath); } else { foreach (ListViewItem item in RightListView.SelectedItems) { if (item.SubItems[2].Text.Equals("<папка>")) { checkedfilesAndDirectories.Add(new DirectoryInfo(Path.Combine(RightViewRootPath, item.SubItems[0].Text))); } else { string filename = item.SubItems[0].Text; if (item.SubItems[1].Text != "") { filename = filename + "." + item.SubItems[1].Text; } checkedfilesAndDirectories.Add(new FileInfo(Path.Combine(RightViewRootPath, filename))); } } if (checkedfilesAndDirectories.Count == 0) { copyForm.Dispose(); return; } copyForm.SetParametres(checkedfilesAndDirectories, RightViewRootPath, LeftViewRootPath); } copyForm.Show(); } catch (Exception ex) { MessageBox.Show("FATAL: " + ex.Message + "\n" + ex.StackTrace); } }