/// <summary> /// Take over control. When this function exits, Chronos is in charge again. /// </summary> /// <remarks> /// We show some dialog window to make clear what we are doing, and that we are in charge. /// </remarks> public void DoYourJob() { // Use the process' main window as owner, so that our blocking // window can not be hidden behind the main window. System.Windows.Window win = null; var mainHandle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; DoOnGUIThread(new Action(() => { win = new ShowPluginIsInCharge(); var wih = new System.Windows.Interop.WindowInteropHelper(win); var myHandle = wih.EnsureHandle(); wih.Owner = mainHandle; win.Show(); })); try { do { System.Threading.Thread.Sleep(5000); var ex = RunSampleList(this, new AxelSemrau.Chronos.Plugin.RunSampleListEventArgs() { //SampleListFile = @"C:\Users\Patrick\Documents\Chronos\MoveTest.csl" ExtendLastPlanner = true, StartAndWaitForEnd = false } ); if (ex != null) { System.Windows.Forms.MessageBox.Show("Error: " + ex.Message, "Plugin Provided Schedule", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } while (OneMoreScheduleWanted(mainHandle)); } finally { DoOnGUIThread(new Action(() => win.Close())); } }
/// <summary> /// Take over control. When this function exits, Chronos is in charge again. /// </summary> /// <remarks> /// We show some dialog window to make clear what we are doing, and that we are in charge. /// </remarks> public void DoYourJob() { // Use the process' main window as owner, so that our blocking // window can not be hidden behind the main window. System.Windows.Window win = null; var mainHandle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; DoOnGUIThread(new Action(() => { win = new ShowPluginIsInCharge(); var wih = new System.Windows.Interop.WindowInteropHelper(win); var myHandle = wih.EnsureHandle(); wih.Owner = mainHandle; win.Show(); })); try { do { System.Threading.Thread.Sleep(5000); var ex = RunSampleList(this, new AxelSemrau.Chronos.Plugin.RunSampleListEventArgs() { //SampleListFile = @"C:\Users\Patrick\Documents\Chronos\MoveTest.csl" ExtendLastPlanner = true, StartAndWaitForEnd = false } ); if (ex != null) { System.Windows.Forms.MessageBox.Show("Error: " + ex.Message, "Plugin Provided Schedule",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Error); } } while (OneMoreScheduleWanted(mainHandle)); } finally { DoOnGUIThread(new Action(() => win.Close())); } }