public uc_rbfx() { InitializeComponent(); try { //External exe inside WPF Window System.Windows.Forms.Panel _pnlSched = new System.Windows.Forms.Panel(); WindowsFormsHost windowsFormsHost1 = new WindowsFormsHost(); windowsFormsHost1.Child = _pnlSched; _Grid.Children.Add(windowsFormsHost1); #if false //_Grid.Children.Add(_pnlSched); //ProcessStartInfo psi = new ProcessStartInfo(@"C:\Program Files\Atwin\Atwin2k2.exe"); //psi.WindowStyle = ProcessWindowStyle.Normal; //Process PR = Process.Start(psi); //PR.WaitForInputIdle(); // true if the associated process has reached an idle state. //System.Threading.Thread.Sleep(3000); //IntPtr hwd = PR.MainWindowHandle; //SetParent(PR.MainWindowHandle, _pnlSched.Handle); // loading exe to the wpf window. #endif DemoApplication.Parent = _pnlSched.Handle; Loaded += delegate { Task.Run(() => { using (var context = new Context()) { using (var application = new DemoApplication(context)) { App3d = application; application.Run(); } } }); }; } catch (Exception ex) { //Nothing... } }
public DemoApplication(Context context) : base(context) { Instance = this; }