安装后显示pdf文件

时间:2011-02-22 12:07:56

标签: c# winforms

我有windows应用程序检查adobe acrobat是否安装在pc中如果安装了pdf文件将从cd显示如果没有安装安装程序窗口出现设置acrobat然后pdf文件显示我做了我的代码将但我想在运行安装程序(process.start())时,pdf文件没有显示,并在完成设置后显示pdf文件。

private void OK_Click_1(object sender, EventArgs e)
    {
        DriveInfo[] allDrives = DriveInfo.GetDrives();
        try
        {
            foreach (DriveInfo d in allDrives)
            {
                switch (d.DriveType)
                {

                    case DriveType.CDRom:
                        Process myProcess = new Process();
                        myProcess.StartInfo.FileName = d.Name + "AdbeRdr90_en_US";
                        myProcess.Start();
                        AfterStube();
                        break;
                }
            }
        }
        catch (Exception ex)
        {

            MessageBox.Show("Pleas Eject All Virtual CD-ROMs");

        }




    }


 private void AfterStube()
    {

        DriveInfo[] allDrives = DriveInfo.GetDrives();


        foreach (DriveInfo d in allDrives)
        {
            switch (d.DriveType)
            {
                case DriveType.CDRom:
                    Process myProcess = new Process();
                    myProcess.StartInfo.FileName = d.Name + "lamp.pdf";

                    myProcess.Start();
                    panel1.Hide();
                    panel2.Show();

                    break;

            }

        }
    }

1 个答案:

答案 0 :(得分:0)

嗯......很难理解你想要什么,但也许你想等到acrobat安装完成?如果是这样,请尝试这样做:

myProcess.WaitForExit();

使用此应用程序将等待安装acrobat,然后调用AfterStube()以显示pdf文件。