Ejemplo n.º 1
0
        private void RunCustomD2(string path, D2HostPanel diabloPanel)
        {
            if (diabloWindow == null)
            {
                if (!string.IsNullOrEmpty(path) && System.IO.File.Exists(path))
                {
                    Process          diabloProcess = new Process();
                    ProcessStartInfo info          = new ProcessStartInfo();
                    info.FileName  = path;
                    info.Arguments = "-w";

                    diabloProcess = Process.Start(info);
                    diabloProcess.EnableRaisingEvents = true;
                    diabloProcess.Exited += new EventHandler(diabloProcess_Exited);

                    // Wait for the app to load
                    diabloProcess.WaitForInputIdle();

                    diabloHandle = diabloProcess.MainWindowHandle;

                    // If greater than Windows XP
                    if (System.Environment.OSVersion.Version.Major > 5)
                    {
                        diabloWindow = new D2Window(Application.OpenForms[0], diabloPanel, diabloHandle);
                        diabloPanel.BindDiabloWindow(diabloWindow);
                    }
                }
            }
            //diabloPanel.DiabloWindow.Activate();
        }
Ejemplo n.º 2
0
 public void ReleaseDiabloWindow()
 {
     if (this.d2window != null)
     {
         this.d2window.Show();
         this.d2window.UnRegisterThumbnail();
         this.d2window = null;
     }
 }
Ejemplo n.º 3
0
        void diabloProcess_Exited(object sender, EventArgs e)
        {
            if (this.InvokeRequired)
            {
                try
                {
                    this.Invoke(new ProcessExitedDelegate(diabloProcess_Exited), sender, e);
                }
                catch (Exception)
                {
                }
            }
            else
            {
                diabloPanel.ReleaseDiabloWindow();

                if (diabloWindow != null)
                {
                    diabloWindow.Close();
                    diabloWindow = null;
                }
            }
        }
Ejemplo n.º 4
0
 public void BindDiabloWindow(D2Window diabloWindow)
 {
     this.d2window = diabloWindow;
 }