private void ChildWindow_Loaded(object sender, RoutedEventArgs e)
        {
            CurrentSetupState           = SetupState.Default;
            LocalInstallTesting.Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            long   size   = LocalInstallTesting.GetHardDiskFreeSpace(InstallPath.Substring(0, 1));
            double gbSize = Convert.ToDouble(Convert.ToDouble(size) / 1024 / 1024 / 1024);

            if (gbSize >= 10)
            {
                ColorDisk = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF888888"));
                DiskSize  = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G";
            }
            else
            {
                ColorDisk = new SolidColorBrush(Colors.Red);
                DiskSize  = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G(尽量选择剩余空间10G以上的盘符)";
            }
        }
        private void btnSelectFolder_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
            dialog.SelectedPath = InstallPath;
            var    result       = dialog.ShowDialog();
            string selectedPath = "";

            if (dialog.SelectedPath.EndsWith("\\"))
            {
                selectedPath = dialog.SelectedPath.Substring(dialog.SelectedPath.Length - 3, 2);
            }
            else
            {
                selectedPath = dialog.SelectedPath;
            }
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                if (!selectedPath.Contains("MusicTeachingWindow"))
                {
                    InstallPath = selectedPath + @"\MusicTeachingWindow";
                }
            }
            else
            {
                InstallPath = selectedPath;
            }

            long   size   = LocalInstallTesting.GetHardDiskFreeSpace(InstallPath.Substring(0, 1));
            double gbSize = Convert.ToDouble(Convert.ToDouble(size) / 1024 / 1024 / 1024);

            if (gbSize >= 10)
            {
                ColorDisk = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FF888888"));
                DiskSize  = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G";
            }
            else
            {
                ColorDisk = new SolidColorBrush(Colors.Red);
                DiskSize  = InstallPath.Substring(0, 1).ToUpper() + "盘可用空间:" + gbSize.ToString("f2") + "G(尽量选择剩余空间10G以上的盘符)";
            }
        }
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            worker.ReportProgress(2);
            string unzipPath = InstallPath.Replace('\\', '/');

            try
            {
                if (!LocalInstallTesting.GetDotNetRelease())
                {
                    //LocalInstallTesting.CopyFile(unzipPath, @"Environmental/NDP452-KB2901907-x86-x64-AllOS-ENU.exe");
                    //Process.Start(unzipPath + @"/Environmental/NDP452-KB2901907-x86-x64-AllOS-ENU.exe").WaitForExit();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("检测并安装.Net版本错误:" + ex.Message);
            }

            worker.ReportProgress(10);
            try
            {
                if (!LocalInstallTesting.IsInstallVC1() && !LocalInstallTesting.IsInstallVC2())
                {
                    if (LocalInstallTesting.Is64Bit())
                    {
                        //LocalInstallTesting.CopyFile(unzipPath, @"Environmental/vc_redist.x64.exe");
                        //Process.Start(unzipPath + @"/Environmental/vc_redist.x64.exe").WaitForExit();
                    }
                    else
                    {
                        //LocalInstallTesting.CopyFile(unzipPath, @"Environmental/vc_redist.x86.exe");
                        //Process.Start(unzipPath + @"/Environmental/vc_redist.x86.exe").WaitForExit();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("检测并安装VC运行环境错误:" + ex.Message);
            }

            worker.ReportProgress(15);
            Process[] ExeList = Process.GetProcessesByName("MusicTeachingWindow");
            for (int i = 0; i < ExeList.Length; i++)
            {
                ExeList[i].Kill();
            }
            worker.ReportProgress(20);

            LocalInstallTesting.CopyAllFile(unzipPath, new Action <int>((p) =>
            {
                worker.ReportProgress(p);
            }));
            try
            {
                LocalInstallTesting.CreateShortcut(InstallPath);
                LocalInstallTesting.CreateProgramsShortcut(InstallPath, "音乐教学云平台");
                LocalInstallTesting.CreateProgramsUninstallShortcut(InstallPath, "音乐教学云平台");
            }
            catch (Exception ex)
            {
                MessageBox.Show("生成快捷方式错误:" + ex.Message);
            }
            worker.ReportProgress(95);
            try
            {
                LocalInstallTesting.AddRegedit(InstallPath);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            worker.ReportProgress(100);
            CurrentSetupState = SetupState.SetupComplete;
        }