基本信息
源码名称:C# 快速打开文件夹(桌面快捷操作工具)
源码大小:0.22M
文件格式:.rar
开发语言:C#
更新时间:2020-08-20
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 6 元×
微信扫码支付:6 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Configuration;
using System.Diagnostics;
using System.Windows.Interop;
namespace 桌面操作工具
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
///
///
public partial class MainWindow : Window
{
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
public MainWindow()
{
InitializeComponent();
}
//private void BTN_Click(object sender, RoutedEventArgs e)
//{
// // OpenFileDialog fileDialog = new OpenFileDialog();
// // fileDialog.Multiselect = true;
// // fileDialog.OpenFile (TXB.Text.ToString());
// //fileDialog.Title = TXB.Text.ToString();
// // fileDialog.Filter = "所有文件(*.*)|*.*";
// // if (DialogResult.HasValue)
// // {
// // fileDialog.ShowDialog();
// // }
// // else
// // {
// // MessageBox.Show("无指定文件");
// // }
// //打开文件System.Diagnostics.Process.Start(v_OpenFilePath);
// //打开指定目录的文件夹string v_OpenFolderPath = @"目录路径";
// //System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
//// string v_OpenFolderPath =@"E:\6.4资料";
//// System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
//}
string No1_adress, No2_adress, No3_adress, No4_adress, No5_adress, No6_adress, No7_adress, No8_adress, No9_adress, No10_adress;
//[System.Runtime.InteropServices.DllImport("User32.dll")]
//private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);
//[System.Runtime.InteropServices.DllImport("user32.dll")]
//private static extern int SetForegroundWindow(IntPtr hWnd);
private void Window_Load(object sender, RoutedEventArgs e)
{
Process[] pro = Process.GetProcesses();
int n = pro.Where(p => p.ProcessName.Equals("桌面操作工具")).Count();
if (n > 1)
{
//ShowWindowAsync(new System.Windows.Interop.WindowInteropHelper(CommonHelper.view).Handle, 1);
//SetForegroundWindow(new System.Windows.Interop.WindowInteropHelper(CommonHelper.view).Handle);
MessageBox.Show("该程序重复开启");
Application.Current.Shutdown();
return;
}
Readconfig();
// OpenFileDialog openFileDialog1 = new OpenFileDialog();
// openFileDialog1.Filter = "文本文件(*.txt)|*.txt|(*.rtf)|*.rtf";
//if ((bool)openFileDialog1.ShowDialog())
// { }
}
public void Readconfig()
{
BTN_1.Content = ConfigurationManager.AppSettings["Name1"];
BTN_2.Content = ConfigurationManager.AppSettings["Name2"];
BTN_3.Content = ConfigurationManager.AppSettings["Name3"];
BTN_4.Content = ConfigurationManager.AppSettings["Name4"];
BTN_5.Content = ConfigurationManager.AppSettings["Name5"];
BTN_6.Content = ConfigurationManager.AppSettings["Name6"];
BTN_7.Content = ConfigurationManager.AppSettings["Name7"];
BTN_8.Content = ConfigurationManager.AppSettings["Name8"];
BTN_9.Content = ConfigurationManager.AppSettings["Name9"];
BTN_10.Content = ConfigurationManager.AppSettings["Name10"];
No1_adress = ConfigurationManager.AppSettings["Path1"];
No2_adress = ConfigurationManager.AppSettings["Path2"];
No3_adress = ConfigurationManager.AppSettings["Path3"];
No4_adress = ConfigurationManager.AppSettings["Path4"];
No5_adress = ConfigurationManager.AppSettings["Path5"];
No6_adress = ConfigurationManager.AppSettings["Path6"];
No7_adress = ConfigurationManager.AppSettings["Path7"];
No8_adress = ConfigurationManager.AppSettings["Path8"];
No9_adress = ConfigurationManager.AppSettings["Path9"];
No10_adress = ConfigurationManager.AppSettings["Path10"];
}
private void BTN_1_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No1_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void BTN_2_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No2_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void BTN_3_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No3_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void BTN_4_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No4_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void BTN_5_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No5_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void BTN_6_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No6_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void BTN_7_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No7_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void BTN_8_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No8_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void BTN_9_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No9_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void BTN_10_Click(object sender, RoutedEventArgs e)
{
string v_OpenFolderPath = @No10_adress;
System.Diagnostics.Process.Start("explorer.exe", v_OpenFolderPath);
}
private void Set_Click(object sender, RoutedEventArgs e)
{
Set set = new Set();
set.Show();
this.Close();
}
}
}