Example #1
0
        string J_VerInfo;// 软件版本号
        // 程序创建前
        private void Form1_Load(object sender, EventArgs e)
        {
            if (args.Length > 0)
            {
                //Debug.Print(args[0]);
                Handling_File_Drop(args[0]);
            }
            FileDroper = new FileDropAdmin(this);
            FileVersionInfo VerInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath);

            J_VerInfo = VerInfo.FileVersion;
            J_VerInfo = J_VerInfo.Replace(".0.0", "");
            this.Text = "UAC白名单小工具 v" + J_VerInfo;
            Task.Run(() => Check_Updates(false));
            NotKey();
        }
Example #2
0
        private void Form_Load(object sender, EventArgs e) // 主窗口创建前
        {
            // 创建互斥体,防止多开
            newMutex = new System.Threading.Mutex(true, "a8851f5e-cbb5-4466-bd72-d95c9bea4dea", out bool WExist);
            if (WExist == false)
            {
                // 判断是不是右键菜单启动的
                if (args.Length > 0 && args[0] != "")
                {
                    Kill_SameNameProcess();
                }
                else
                {
                    _ = MessageBox.Show("请勿多开!", "注意:", MessageBoxButtons.OK, MessageBoxIcon.Information);//弹出提示信息
                    Environment.Exit(0);
                }
            }

            // 判断系统版本
            if (Environment.OSVersion.Version.Major != 10)
            {
                _ = MessageBox.Show("该软件仅支持 Windows10 系统!", "错误:", MessageBoxButtons.OK);
            }

            // 获取软件当前版本号
            Now_VerInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath).FileVersion;
            Now_VerInfo = Now_VerInfo.Substring(0, Now_VerInfo.Length - 2);
            this.Text   = "磁贴美化小工具 v" + Now_VerInfo;

            // 检查DLL依赖
            Check_Dll();

            // 获取主题色并设置图片框背景颜色
            SystemColor = "#" + Registry_SystemColor.Get_SystemColor();
            PictureBox_磁贴图片预览.BackColor = ColorTranslator.FromHtml(SystemColor);
            NewTileState = Registry_Other.Get_NewTileState(); // 获取是否开启新版磁贴样式,或系统 2004 版本以上
            //Debug.Print(NewTileState.ToString());

            // 磁贴预览标签背景透明
            Label_磁贴名称预览.BackColor = Color.Transparent;
            Label_磁贴名称预览.Parent    = PictureBox_磁贴图片预览;
            Label_磁贴名称预览.Location  = new Point(5, 79);

            // 检查是否以管理员身份运行
            IsRunAsAdmin = Other_cs.Other.IsRunAsAdmin();
            if (IsRunAsAdmin)
            {
                this.AllowDrop = false;
                FileDroper     = new FileDropAdmin(this);
            }

            // 读入程序配置文件
            Read_AppConfig();

            // 创建线程检查更新
            if (Button_自动检查更新.Text == "自动检查更新 [√]")
            {
                _ = Task.Run(() => Check_Update(false));
            }

            // 检查是否添加右键菜单
            Check_RightClickMenu();

            if (args.Length > 0 && args[0] != "")
            {
                File_DragDrop(args[0]);
                // Debug.Print(args[0]);
            }
        }