/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { if (disposing) { // Clear up the class objects dt.Dispose(); robot = null; itp = null; if (components != null) { components.Dispose(); } } base.Dispose(disposing); }
/// <summary> /// The array of IImagingTasks last received /// </summary> //private IImagingTask[] tasks; #region IImagingTaskProvider Methods // public IImagingTask[] GetImagingTasks(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID) // public bool SupportsPriority(Formulatrix.Integrations.ImagerLink.IRobot robot) // public void UpdatedPriority(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID, DateTime dateToImage, int priority) // public string ImagingPlate(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID, bool scheduled, DateTime dateToImage, DateTime dateImaged) // public void ImagedPlate(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID, string imagingID) // public void SkippedImaging(Formulatrix.Integrations.ImagerLink.IRobot robot, string plateID, DateTime dateToImage) #endregion public ImagingTaskProviderTester() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); // TODO: Add any initialization after the InitializeComponent call // Get an ImagingTaskProvider //itp = new ImagingTaskProvider(); itp = new ImagingTaskProviderNew(); // Get a robot Robot r = new Robot(); r.SetID("1"); r.SetName("RI1000-0014"); robot = r; // Get a DataTable dt = new DataTable(); // Set the columns for the DataTable dt.Columns.Add(new DataColumn("Date To Image", typeof(DateTime))); dt.Columns.Add(new DataColumn("Priority", typeof(Int32))); dt.Columns.Add(new DataColumn("In Queue", typeof(bool))); dt.Columns.Add(new DataColumn("State", typeof(Formulatrix.Integrations.ImagerLink.Scheduling.ImagingState))); dt.Columns.Add(new DataColumn("Date Imaged UTC", typeof(DateTime))); dt.Columns.Add(new DataColumn("Date To Image UTC", typeof(DateTime))); dt.Columns.Add(new DataColumn("Date Imaged Local", typeof(DateTime))); dt.Columns.Add(new DataColumn("Date To Image Local", typeof(DateTime))); // Convert to something the DataGrid can show DataView dv = new DataView(dt); dv.AllowDelete = false; dv.AllowEdit = false; dv.AllowNew = false; dv.Sort = "Date To Image ASC"; // Show the table in the DataGrid dgImagingTasks.DataSource = dv; System.Windows.Forms.CurrencyManager cm = null; System.Windows.Forms.DataGridTableStyle ts = null; if (dgImagingTasks.TableStyles.Count > 0) { ts = dgImagingTasks.TableStyles[0]; } else { cm = (CurrencyManager)BindingContext[dv, dt.TableName]; ts = new System.Windows.Forms.DataGridTableStyle(cm); dgImagingTasks.TableStyles.Add(ts); } for (Int32 i = 0; i < dt.Columns.Count; i++) { System.Data.DataColumn dc = dt.Columns[i]; if (dc.DataType == typeof(System.DateTime)) { System.Windows.Forms.DataGridColumnStyle cs = dgImagingTasks.TableStyles[0].GridColumnStyles[i]; if ((cs != null) && (cs.GetType() == typeof(System.Windows.Forms.DataGridTextBoxColumn))) { ((System.Windows.Forms.DataGridTextBoxColumn)cs).Format = "yyyy-MM-dd HH:mm:ss"; ((System.Windows.Forms.DataGridTextBoxColumn)cs).Width = 150; } } else { System.Windows.Forms.DataGridTextBoxColumn dgcs = new System.Windows.Forms.DataGridTextBoxColumn(); ts.GridColumnStyles.Add(dgcs); } } //EdsDataGrid.TableStyles.Add(ts); }