コード例 #1
0
        private void cmdShowInExplorer_Click(object sender, EventArgs e)
        {
            int intCount = 0;

            if (lstResults.SelectedItems.Count < 1)
            {
                MessageBox.Show("Please select an item", "Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (lstResults.SelectedItems.Count > 1)
            {
                MessageBox.Show("Ensure only a single item is selected", "Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                for (intCount = 0; intCount < lstResults.SelectedItems.Count; intCount++)
                {
                    ListViewItem selItem = lstResults.SelectedItems[intCount];
                    string       strFoo  = selItem.SubItems[0].Text.ToString() + "\\" + selItem.SubItems[1].Text.ToString(); // filename
                    if (strFoo == "N/A")
                    {
                        MessageBox.Show("No filename for this file", "No Manifest", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }

                    strFoo.Replace(@"\", @"\\");
                    ShowSelectedInExplorer.FileOrFolder(strFoo, false);
                }
            }
        }
コード例 #2
0
ファイル: frmBrowser.cs プロジェクト: nccgroup/ncccodenavi
        private void cmdShowInExplorer_Click(object sender, EventArgs e)
        {
            StringBuilder sbTemp = new StringBuilder();

            if (treeFiles.SelectedNode == null)
            {
                return;
            }

            sbTemp.Append(treeFiles.SelectedNode.Text);
            TreeNode treeNodeTmp = treeFiles.SelectedNode;

            while (true)
            {
                if (treeNodeTmp.Parent == null)
                {
                    break;
                }
                treeNodeTmp = treeNodeTmp.Parent;
                sbTemp.Insert(0, treeNodeTmp.Text + "\\");
            }

            ShowSelectedInExplorer.FileOrFolder(sbTemp.ToString(), false);
        }