/// <summary>
        /// Method Edit()
        /// </summary>
        /// <remarks>
        /// On edit, add scroll event handler, and display combobox
        /// </remarks>
        /// <param name="source"></param>
        /// <param name="rowNum"></param>
        /// <param name="bounds"></param>
        /// <param name="readOnly"></param>
        /// <param name="instantText"></param>
        /// <param name="cellIsVisible"></param>
        protected override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
        {
            base.Edit(source, rowNum, bounds, readOnly, instantText,cellIsVisible);

            if (!readOnly && cellIsVisible)
            {
                // Save current row in the DataGrid and currency manager
                // associated with the data source for the DataGrid
                this.iCurrentRow = rowNum;
                this.currencyManager = source;

                // Add event handler for DataGrid scroll notification
                this.DataGridTableStyle.DataGrid.Scroll += new EventHandler(DataGrid_Scroll);

                // Site the combobox control within the current cell
                this.comboBox.Parent = this.TextBox.Parent;
                Rectangle rect = this.DataGridTableStyle.DataGrid.GetCurrentCellBounds();
                this.comboBox.Location = rect.Location;
                this.comboBox.Size = new Size(this.TextBox.Size.Width,this.comboBox.Size.Height);

                // Set combobox selection to given text
                this.comboBox.SelectedIndex = this.comboBox.FindStringExact(this.TextBox.Text);

                // Make the combobox visible and place on top textbox control
                this.comboBox.Show();
                this.comboBox.BringToFront();
                this.comboBox.Focus();
            }
        }
        protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly,	string instantText, bool cellIsVisible)
        {
            DateTime value = DateTime.Today;
            try
            {
                value = (DateTime) GetColumnValueAtRow(source, rowNum);
            }
            catch {}

              if (cellIsVisible)
            {
                myDateTimePicker.Bounds = new Rectangle(bounds.X + 2, bounds.Y + 2, bounds.Width - 4, bounds.Height - 4);
                myDateTimePicker.Value = value;
                myDateTimePicker.Visible = true;
                myDateTimePicker.ValueChanged += new EventHandler(TimePickerValueChanged);
            }
            else
            {
                myDateTimePicker.Value = value;
                myDateTimePicker.Visible = false;
            }

            if (myDateTimePicker.Visible)
                DataGridTableStyle.DataGrid.Invalidate(bounds);
        }
Beispiel #3
0
 /// <summary>
 /// Standard override
 /// </summary>
 /// <param name="dataSource"></param>
 /// <param name="rowNum"></param>
 /// <returns></returns>
 protected override bool Commit(CurrencyManager dataSource, int rowNum)
 {
     if (!_inEdit)
     {
         return true;
     }
     try
     {
         object _value = _comboBox.SelectedValue;
         if (NullText.Equals(_value))
         {
             _value = System.Convert.DBNull;
         }
         this.SetColumnValueAtRow(dataSource, rowNum, _value);
     }
     catch
     {
         return false;
     }
     finally
     {
         _inEdit = false;
         _comboBox.Hide();
     }
     return true;
 }
        protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly,	string instantText, bool cellIsVisible)
        {
            if (isEditing)
                return;

            object value = GetColumnValueAtRow(source, rowNum);
            if (value != null && value != System.DBNull.Value && value.ToString().Equals("+"))
                    mCB.Checked = true;
            else
                    mCB.Checked = false;

            if (cellIsVisible)
            {
                mCB.Bounds = new Rectangle(bounds.X+2, bounds.Y+2 , bounds.Width-2, bounds.Height-2);
                mCB.Visible = true;
                isEditing = true;
                base.ColumnStartedEditing(mCB);
                AddEventHandlerCheckBoxChanged();
            }
            else
            {
                mCB.Visible = false;
            }

            if (mCB.Visible)
            {
                DataGridTableStyle.DataGrid.Invalidate(bounds);
                mCB.Focus();
            }
        }
 private void Form1_Load(object sender, System.EventArgs e)
 {
     sqlDataAdapter1.Fill(authorsDataSet1);
     textBox2.DataBindings.Add("Text", authorsDataSet1, "Authors.au_fname");
     MyCM = (CurrencyManager) this.BindingContext[authorsDataSet1, "authors"];
     MyCM.Position = 0;
 }
        protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly,	string instantText, bool cellIsVisible)
        {
            if (isEditing)
                return;

            if (cellIsVisible)
            {
                mSel.Bounds = new Rectangle(bounds.X + 2, bounds.Y + 2, bounds.Width, bounds.Height);
                mSel.Visible = true;
                mSel.OnControlChanged += new EventHandler(OpenDateValueChanged);
                object value = base.GetColumnValueAtRow( source, rowNum );
                if ( value == null )
                    mSel.pSelectedItem = new PlaceCode(0, 0);
                else
                    mSel.pSelectedItem = PlaceCode.PDC2PlaceCode(value.ToString());
                value = this.GetColumnValueAtRow( source, rowNum );
                if ( value == null )
                    mSel.pText = string.Empty;
                else
                    mSel.pText = value.ToString();
            }
            else
            {
                mSel.Visible = false;
            }

            if (mSel.Visible)
            {
                isEditing = true;
                base.ColumnStartedEditing(mSel);
                DataGridTableStyle.DataGrid.Invalidate(bounds);
            }
        }
Beispiel #7
0
        //
        // Commit Changes
        //
        protected override bool Commit(CurrencyManager DataSource,int RowNum)
        {
            HideCombo();
              if(!InEdit)
              {
            return true;
              }

              try
              {
            object Value = mCombo.SelectedValue;
            if(NullText.Equals(Value))
            {
              Value = System.Convert.DBNull;
            }
            SetColumnValueAtRow(DataSource, RowNum, Value);
              }
              catch
              {
            RollBack();
            return false;
              }

              this.EndEdit();
              return true;
        }
 private void filterChanged(object sender, EventArgs e)
 {
     FilterControl component = (FilterControl)base.Component;
     CurrencyManager manager = null;
     if ((component.DataSource != null) && (component.BindingContext != null))
     {
         manager = (CurrencyManager)component.BindingContext[component.DataSource, component.DataMember];
     }
     if (manager != this.cm)
     {
         if (this.cm != null)
         {
             this.cm.MetaDataChanged -= new EventHandler(this.dataGridViewMetaDataChanged);
         }
         this.cm = manager;
         if (this.cm != null)
         {
             this.cm.MetaDataChanged += new EventHandler(this.dataGridViewMetaDataChanged);
         }
     }
     if (component.BindingContext == null || component.DataSource != null)
     {
         MakeSureColumnsAreSited(component);
     }
     else
     {
         this.RefreshColumnCollection();
     }
 }
        protected override bool Commit(CurrencyManager dataSource, int rowNum)
        {
            customComboBoxPicker1.Bounds = Rectangle.Empty;

            customComboBoxPicker1.TextChanged -=
                new EventHandler(ComboBoxTextChanged);

            if (!isEditing)
                return true;

            isEditing = false;

            try
            {
                string value = customComboBoxPicker1.Text;
                SetColumnValueAtRow(dataSource, rowNum, value);
            }
            catch (Exception)
            {
                Abort(rowNum);
                return false;
            }

            Invalidate();
            return true;
        }
        protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly,	string instantText, bool cellIsVisible)
        {
            if (isEditing)
                return;

            object value = GetColumnValueAtRow(source, rowNum);
            if (value != null && value != System.DBNull.Value && value.ToString().Length > 0)
                mME.Text = value.ToString();
            else
                mME.Text = mME.EditMask; //string.Empty;

            if (cellIsVisible)
            {
                mME.Bounds = new Rectangle(bounds.X+2, bounds.Y+2 , bounds.Width-2, bounds.Height-2);
                mME.Visible = true;
                isEditing = true;
                base.ColumnStartedEditing(mME);
                AddEventHandlerMaskEditChanged();
            }
            else
            {
                mME.Visible = false;
            }

            if (mME.Visible)
            {
                DataGridTableStyle.DataGrid.Invalidate(bounds);
                mME.Select(0,1);
                mME.Focus();
            }
        }
        protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly,	string instantText, bool cellIsVisible)
        {
            if (isEditing)
                return;

            object value = GetColumnValueAtRow(source, rowNum);
            if (value != null && value != System.DBNull.Value)
                    mPSI.pImageCollection.pCurrentIndex = (int)value;
            else
                    mPSI.pImageCollection.pCurrentIndex = 0;

            if (cellIsVisible)
            {
                mPSI.Bounds = new Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height);
                mPSI.Visible = true;
                isEditing = true;
                base.ColumnStartedEditing(mPSI);
                AddEventHandlerPicSwitchChanged();
            }
            else
            {
                mPSI.Visible = false;
            }

            if (mPSI.Visible)
            {
                DataGridTableStyle.DataGrid.Invalidate(bounds);
                mPSI.Invalidate();
                mPSI.Focus();
            }
        }
        public GraphicDatabase()
        {
            InitializeComponent();

            tv = new TilesetViewer(picTilesetViewer.Handle, picTilesetViewer.Width, picTilesetViewer.Height);
            vs = new ViewSprite(picSprite.Handle);
            vf = new ViewFace(picFace.Handle);
            vas = new ViewAnimateSprite(picSpriteAnimation.Handle);
            vs.SetView(picSprite.Width, picSprite.Height);

            //tv.LoadTileset(new Texture("0.png"));
            tv.yOffSet = vTilesetScroll.Value;
            tv.UpdateView();

            lstTileset.DataSource = Editor.Instance.curGame.TM.myTileset;
            lstTileset.DisplayMember = "Name";

            lstSprite.DataSource = Editor.Instance.curGame.AM.MySprite;
            lstSprite.DisplayMember = "Name";

            lstFace.DataSource = Editor.Instance.curGame.AM.MyFace;

            cmts = (CurrencyManager)BindingContext[Editor.Instance.curGame.TM.myTileset];
            cms = (CurrencyManager)BindingContext[Editor.Instance.curGame.AM.MySprite];
            cmf = (CurrencyManager)BindingContext[Editor.Instance.curGame.AM.MyFace];

            RefreshTilesetDatabase();
            RefreshSpriteDatabase();
            RefreshFaceDatabase();

            tmrRefresher.Start();
        }
        public MapViewerForm(TileMap map)
        {
            InitializeComponent();
            Map = map;
            mv = new MapViewer(picMapViewer.Handle, picMapViewer.Width, picMapViewer.Height);
            mv.changeMap(Map);
            mv.UpdateView();

            lstLayer.DataSource = Map.myLayer;
            lstLayer.DisplayMember = "Name";

            updateLayer();
            ve = new ViewEvent();

            _layerCache = new List<LayerCache>();
            for (int i = 0; i < Map.myLayer.Count; i++ )
            {
                LayerCache lc = new LayerCache(Map.maxX, map.maxY, Map.myLayer[i]);
                _layerCache.Add(lc);
            }

            cm = (CurrencyManager)BindingContext[Map.myLayer];

            SetScrollSize();

            tmrRefresh.Interval = 180;
            tmrRefresh.Start();
        }
		protected override void Edit (CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
		{
			Console.WriteLine ("TextBox bounds = {0} and is {1}, parent = {2}", TextBox.Bounds, TextBox.Visible ? "visible" : "not visible", TextBox.Parent == null ? "null" : TextBox.Parent.GetType().ToString());
			Console.WriteLine ("Edit\n{0}", Environment.StackTrace);
			base.Edit (source, rowNum, bounds, readOnly, instantText, cellIsVisible);
			Console.WriteLine ("TextBox bounds = {0} and is {1}, parent = {2}", TextBox.Bounds, TextBox.Visible ? "visible" : "not visible", TextBox.Parent == null ? "null" : TextBox.Parent.GetType().ToString());
		}
Beispiel #15
0
        //
        // Edit Grid
        //
        protected override void Edit(
      CurrencyManager Source ,
      int Rownum,
      Rectangle Bounds, 
      bool ReadOnly,
      string InstantText, 
      bool CellIsVisible
      )
        {
            mCombo.Text = string.Empty;
              Rectangle OriginalBounds = Bounds;
              OldVal = mCombo.Text;

              if(CellIsVisible)
              {
            Bounds.Offset(xMargin, yMargin);
            Bounds.Width -= xMargin * 2;
            Bounds.Height -= yMargin;
            mCombo.Bounds = Bounds;
            mCombo.Visible = true;
              }
              else
              {
            mCombo.Bounds = OriginalBounds;
            mCombo.Visible = false;
              }
              try
              {
            mCombo.SelectedValue = GetText(GetColumnValueAtRow(Source, Rownum));
              }
              catch {}

              if(InstantText!=null)
              {
            mCombo.SelectedValue = InstantText;
              }
              mCombo.RightToLeft = this.DataGridTableStyle.DataGrid.RightToLeft;
              //			Combo.Focus();

              if(InstantText==null)
              {
            mCombo.SelectAll();

            // Pre-selects an item in the combo when user tries to add
            // a new record by moving the columns using tab.

            // Combo.SelectedIndex = 0;
              }
              else
              {
            int End = mCombo.Text.Length;
            mCombo.Select(End, 0);
              }
              if(mCombo.Visible)
              {
            DataGridTableStyle.DataGrid.Invalidate(OriginalBounds);
              }

              InEdit = true;
        }
 /// <summary>
 /// 获取数据项
 /// </summary>
 /// <param name="dataManager">数据管理对象</param>
 /// <param name="index">索引</param>
 /// <returns>返回指定位置的数据项</returns>
 public static object GetItem(CurrencyManager dataManager, int index)
 {
     if (index > -1 && dataManager != null && index < dataManager.List.Count)
     {
         return dataManager.List[index];
     }
     return null;
 }
 protected void zmienKolorWeakendu(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
 {
     bool pWeekend = model.podajCzyJestWeekendem (rowNum + 1);
     Brush pBrush = backBrush;
     if (pWeekend)
         pBrush = Brushes.LightBlue;
     formatujTimeSpan (g,bounds,source,rowNum,pBrush,foreBrush,alignToRight);
 }
 /// <summary>
 /// Function that binds values from the database to controls on the form.
 /// </summary>
 public void BindControls()
 {
     equipmentIDDisplayLabel.DataBindings.Add("Text", dataModule.greenDataSet, "EQUIPMENT.EquipmentID");
     descriptionDisplayLabel.DataBindings.Add("Text", dataModule.greenDataSet, "EQUIPMENT.Description");
     equipmentListBox.DataSource = dataModule.greenDataSet;
     equipmentListBox.DisplayMember = "EQUIPMENT.Description";
     equipmentListBox.ValueMember = "EQUIPMENT.EquipmentID";
     currencyManager = (CurrencyManager)this.BindingContext[dataModule.greenDataSet, "Equipment"];
 }
Beispiel #19
0
		public DataGridDataSource (DataGrid owner, CurrencyManager list_manager, object data_source, string data_member, object view_data, DataGridCell current)
		{
			this.owner = owner;
			this.list_manager = list_manager;
			this.view = view_data;
			this.data_source = data_source;
			this.data_member = data_member;
			this.current = current;
		}
 public void BindControls()
 {
     lstServiceType.DataSource = DM.DSGreen;
     lstServiceType.DisplayMember = "ServiceType.Description";
     lstServiceType.ValueMember = "ServiceType.Description";
     currencyManager = (CurrencyManager)this.BindingContext[DM.DSGreen, "ServiceType"];
     txtServiceTypeID.DataBindings.Add("Text", DM.DSGreen, "ServiceType.ServiceTypeID");
     txtServiceTypeDescription.DataBindings.Add("Text", DM.DSGreen, "ServiceType.Description");
     txtHourlyRate.DataBindings.Add("Text", DM.DSGreen, "ServiceType.HourlyRate");
 }
        protected override void Edit(CurrencyManager source, int rowNum, Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
        {
            base.Edit(source,rowNum,bounds,readOnly,instantText,cellIsVisible);

            _rowNum = rowNum;
            _source = source;

            BtnSettings();
            ColumnButton.Focus();
        }
 public void BindControls()
 {
     lblEquipmentID.DataBindings.Add("Text", DM.DSGreen, "Equipment.EquipmentID");
     txtDescription.DataBindings.Add("Text", DM.DSGreen, "Equipment.Description");
     txtDescription.Enabled = false;
     lstEquipments.DataSource = DM.DSGreen;
     lstEquipments.DisplayMember = "Equipment.Description";
     lstEquipments.ValueMember = "Equipment.Description";
     currencyManager = (CurrencyManager)this.BindingContext[DM.DSGreen, "EQUIPMENT"];
 }
        public ViewVariable()
        {
            InitializeComponent();

            lstVariable.DataSource = Editor.Instance.curGame.MyVariable;
            lstVariable.DisplayMember = "Name";

            cm = (CurrencyManager)BindingContext[Editor.Instance.curGame.MyVariable];

            RefreshDatabase();
        }
Beispiel #24
0
        public ViewSwitch()
        {
            InitializeComponent();

            lstSwitch.DataSource = Editor.Instance.curGame.MySwitch;
            lstSwitch.DisplayMember = "Name";

            cm = (CurrencyManager)BindingContext[Editor.Instance.curGame.MySwitch];

            RefreshDatabase();
        }
        protected override bool Commit(CurrencyManager dataSource, int rowNum)
        {
            if(_isEditing)
            {
                _isEditing = false;
                dataSource.Position = rowNum;
                SetColumnValueAtRow(dataSource,rowNum,"");

            }
            return false;
        }
        // Constructor - create combobox,
        // register selection change event handler,
        // register lose focus event handler
        public DataGridComboBoxColumn()
        {
            this.cmanager = null;

            // Create combobox and force DropDownList style
            this.comboBox = new ComboBox();
            this.comboBox.DropDownStyle = ComboBoxStyle.DropDownList;

            // Add event handler for notification when combobox loses focus
            this.comboBox.Leave += new EventHandler(comboBox_Leave);
        }
 public ServiceTypeEquipmentForm(DataModule dm, MainForm mnu)
 {
     InitializeComponent();
     DM = dm;
     frmMenu = mnu;
     cmEquipment = (CurrencyManager)this.BindingContext[DM.DSGreen, "Equipment"];
     cmServiceType = (CurrencyManager)this.BindingContext[DM.DSGreen, "ServiceType"];
     cmServiceTypeEquipment = (CurrencyManager)this.BindingContext[DM.DSGreen,"ServiceTypeEquipment"];
     cmDt = (CurrencyManager)this.BindingContext[dt];
     cmSSTE = (CurrencyManager)this.BindingContext[DM.DSGreen, "ServiceType.InvestigatorAssignment"];
     BindControls();
 }
        private void frmUnassignedIncidents_Load(object sender, EventArgs e)
        {
            SQLDataContext.SetConnectionString(ConfigurationManager.
                                ConnectionStrings["SportsPro.Properties.Settings.TechSupportConnectionString"].
                                    ConnectionString);

            techSupport = SQLDataContext.GetTechSupportDataContext();
            LoadUnassignedIncidents();

            //set up currency control
            cm = (CurrencyManager)sQLIncidentDataGridView.BindingContext[incidentList];
        }
        public DataGridComboBoxColumn()
        {
            _source = null;
            _isEditing = false;
            RowCnt = - 1;

            ColumnComboBox = new NoKeyUpCombo();
            ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList;

            ColumnComboBox.Leave += new System.EventHandler(LeaveComboBox);
            ColumnComboBox.SelectionChangeCommitted += new System.EventHandler(ComboStartEditing);
        }
        public DataGridComboBoxColumn()
        {
            _source = null;
            _isEditing = false;
            _RowCount = -1;

            ColumnComboBox = new NoKeyUpCombo();
            ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList;

            ColumnComboBox.Leave += LeaveComboBox;
            ColumnComboBox.SelectionChangeCommitted += ComboStartEditing;
        }
 public static PropertyDescriptor GetSortProperty(this CurrencyManager manager)
 {
     return((PropertyDescriptor)manager.GetType().GetMethod("GetSortProperty", BindingFlags.NonPublic | BindingFlags.Instance)
            .Invoke(manager, new object[] { }));
 }
Beispiel #32
0
 protected override bool Commit(System.Windows.Forms.CurrencyManager dataSource, int rowNum)
 {
     return(true);
 }
 public static string GetListName(this CurrencyManager manager)
 {
     return((string)manager.GetType().GetMethod("GetListName", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { }, null)
            .Invoke(manager, null));
 }
Beispiel #34
0
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
        {
            object o = this.GetColumnValueAtRow(source, rowNum);

            if (o != null)
            {
                int i = (int)o;
                g.FillRectangle(backBrush, bounds);

                Bitmap bmp = (Bitmap)theImages[i];

                GridImageCellDrawOption cellDrawOption = GridImageCellDrawOption.NoResize;
                //GridImageCellDrawOption cellDrawOption = GridImageCellDrawOption.FitProportionally;
                //GridImageCellDrawOption cellDrawOption = GridImageCellDrawOption.FitToCell;


                System.Drawing.GraphicsUnit gu = System.Drawing.GraphicsUnit.Point;

                RectangleF srcRect  = bmp.GetBounds(ref gu);
                Rectangle  destRect = Rectangle.Empty;

                Region saveRegion = g.Clip;

                int DrawX = bounds.X + (bounds.Width - (int)srcRect.Width) / 2;
                int DrawY = bounds.Y + (bounds.Height - (int)srcRect.Height) / 2;

                destRect = new Rectangle(DrawX, DrawY, (int)srcRect.Width, (int)srcRect.Height);
                g.Clip   = new Region(bounds);

//				switch(cellDrawOption)
//				{
//					case GridImageCellDrawOption.FitToCell:
//						destRect = bounds;
//						break;
//					case GridImageCellDrawOption.NoResize:
//						destRect = new Rectangle(bounds.X, bounds.Y, (int) srcRect.Width, (int) srcRect.Height);
//						g.Clip = new Region(bounds);
//						break;
//					case GridImageCellDrawOption.FitProportionally:
//					{
//						float srcRatio =  srcRect.Width / srcRect.Height;
//						float tarRatio = (float) bounds.Width / bounds.Height;
//						destRect = bounds;
//						if( tarRatio < srcRatio )
//						{
//							destRect.Height = (int) (destRect.Width * srcRatio);
//						}
//						else
//						{
//							destRect.Width = (int) (destRect.Height * srcRatio);
//						}
//					}
//						break;
//
//					default:
//						break;
//				}

                if (!destRect.IsEmpty)
                {
                    g.DrawImage(bmp, destRect, srcRect, gu);
                }

                g.Clip = saveRegion;
            }
        }
Beispiel #35
0
 //turn off tracking bool changes
 protected override bool Commit(System.Windows.Forms.CurrencyManager dataSource, int rowNum)
 {
     lockValue   = true;
     beingEdited = false;
     return(base.Commit(dataSource, rowNum));
 }
Beispiel #36
0
 public DataGridTableStyle(CurrencyManager listManager)
 {
     throw null;
 }
        /// <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);
        }
 public static void SetSort(this CurrencyManager manager, PropertyDescriptor property, ListSortDirection sortDirection)
 {
     manager.GetType().GetMethod("SetSort", BindingFlags.NonPublic | BindingFlags.Instance)
     .Invoke(manager, new object[] { property, sortDirection });
 }
 protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight)
 {
     Paint(g, bounds, source, rowNum, ThemeEngine.Current.ResPool.GetSolidBrush(DataGridTableStyle.BackColor),
           ThemeEngine.Current.ResPool.GetSolidBrush(DataGridTableStyle.ForeColor), alignToRight);
 }
 public static ListSortDirection GetSortDirection(this CurrencyManager manager)
 {
     return((ListSortDirection)manager.GetType().GetMethod("GetSortDirection", BindingFlags.NonPublic | BindingFlags.Instance)
            .Invoke(manager, new object[] { }));
 }
        private string GetFormattedValue(CurrencyManager source, int rowNum)
        {
            object obj = GetColumnValueAtRow(source, rowNum);

            return(GetFormattedValue(obj));
        }
        /// <include file='doc\DataGridTextBoxColumn.uex' path='docs/doc[@for="DataGridTextBoxColumn.Edit"]/*' />
        /// <devdoc>
        ///    <para>Prepares a cell for editing.</para>
        /// </devdoc>
        protected internal override void Edit(CurrencyManager source,
                                              int rowNum,
                                              Rectangle bounds,
                                              bool readOnly,
                                              string displayText,
                                              bool cellIsVisible)
        {
            DebugOut("Begining Edit, rowNum :" + rowNum.ToString(CultureInfo.InvariantCulture));

            Rectangle originalBounds = bounds;

            edit.ReadOnly = readOnly || ReadOnly || this.DataGridTableStyle.ReadOnly;

            edit.Text = GetText(GetColumnValueAtRow(source, rowNum));
            if (!edit.ReadOnly && displayText != null)
            {
                // tell the grid that we are changing stuff
                this.DataGridTableStyle.DataGrid.ColumnStartedEditing(bounds);
                // tell the edit control that the user changed it
                this.edit.IsInEditOrNavigateMode = false;
                edit.Text = displayText;
            }

            if (cellIsVisible)
            {
                bounds.Offset(xMargin, 2 * yMargin);
                bounds.Width  -= xMargin;
                bounds.Height -= 2 * yMargin;
                DebugOut("edit bounds: " + bounds.ToString());
                edit.Bounds = bounds;

                edit.Visible = true;

                edit.TextAlign = this.Alignment;
            }
            else
            {
                edit.Bounds = Rectangle.Empty;
                // edit.Bounds = originalBounds;
                // edit.Visible = false;
            }

            edit.RightToLeft = this.DataGridTableStyle.DataGrid.RightToLeft;

            edit.FocusInternal();

            editRow = rowNum;

            if (!edit.ReadOnly)
            {
                oldValue = edit.Text;
            }

            // select the text even if the text box is read only
            // because the navigation code in the DataGridTextBox::ProcessKeyMessage
            // uses the SelectedText property
            if (displayText == null)
            {
                edit.SelectAll();
            }
            else
            {
                int end = edit.Text.Length;
                edit.Select(end, 0);
            }

            if (edit.Visible)
            {
                DataGridTableStyle.DataGrid.Invalidate(originalBounds);
            }
        }
Beispiel #43
0
        //used to fire an event to retrieve formatting info
        //and then draw the cell with this formatting info
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
        {
            DataGridFormatCellEventArgs e = null;

            bool callBaseClass = true;

            //fire the formatting event
            if (SetCellFormat != null)
            {
                int col = this.DataGridTableStyle.GridColumnStyles.IndexOf(this);
                e = new DataGridFormatCellEventArgs(rowNum, col, this.GetColumnValueAtRow(source, rowNum));
                SetCellFormat(this, e);

                if (e.BackBrush != null)
                {
                    backBrush = e.BackBrush;
                }

                //if these properties set, then must call drawstring
                if (e.ForeBrush != null || e.TextFont != null)
                {
                    if (e.ForeBrush == null)
                    {
                        e.ForeBrush = foreBrush;
                    }
                    if (e.TextFont == null)
                    {
                        e.TextFont = this.DataGridTableStyle.DataGrid.Font;
                    }
                    g.FillRectangle(backBrush, bounds);
                    Region    saveRegion = g.Clip;
                    Rectangle rect       = new Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height);
                    using (Region newRegion = new Region(rect))
                    {
                        g.Clip = newRegion;
                        int charWidth = (int)Math.Ceiling(g.MeasureString("c", e.TextFont, 20, StringFormat.GenericTypographic).Width);

                        string s        = this.GetColumnValueAtRow(source, rowNum).ToString();
                        int    maxChars = Math.Min(s.Length, (bounds.Width / charWidth));

                        try
                        {
                            g.DrawString(s.Substring(0, maxChars), e.TextFont, e.ForeBrush, bounds.X, bounds.Y + 2);
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message.ToString());
                        }                         //empty catch
                        finally
                        {
                            g.Clip = saveRegion;
                        }
                    }
                    callBaseClass = false;
                }

                if (!e.UseBaseClassDrawing)
                {
                    callBaseClass = false;
                }
            }
            if (callBaseClass)
            {
                base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
            }

            //clean up
            if (e != null)
            {
                if (e.BackBrushDispose)
                {
                    e.BackBrush.Dispose();
                }
                if (e.ForeBrushDispose)
                {
                    e.ForeBrush.Dispose();
                }
                if (e.TextFontDispose)
                {
                    e.TextFont.Dispose();
                }
            }
        }
 /// <include file='doc\DataGridTextBoxColumn.uex' path='docs/doc[@for="DataGridTextBoxColumn.Paint"]/*' />
 /// <devdoc>
 /// <para>Paints the a System.Windows.Forms.DataGridColumnStyle with the specified System.Drawing.Graphics,
 /// System.Drawing.Rectangle, DataView.Rectangle, and row number. </para>
 /// </devdoc>
 protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum)
 {
     Paint(g, bounds, source, rowNum, false);
 }
Beispiel #45
0
            protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
            {
                try
                {
                    foreBrush = new SolidBrush(_getColorRowCol(rowNum, this._column));
                    //backBrush = new SolidBrush(Color.GhostWhite);
                }

                catch {}
                finally
                {
                    base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
                }
            }
        /// <include file='doc\DataGridTextBoxColumn.uex' path='docs/doc[@for="DataGridTextBoxColumn.Paint1"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Paints a System.Windows.Forms.DataGridColumnStyle with the specified System.Drawing.Graphics, System.Drawing.Rectangle, DataView, row number, and alignment.
        ///    </para>
        /// </devdoc>
        protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight)
        {
            string text = GetText(GetColumnValueAtRow(source, rowNum));

            PaintText(g, bounds, text, alignToRight);
        }
Beispiel #47
0
        /// <include file='doc\BindingContext.uex' path='docs/doc[@for="BindingContext.EnsureListManager"]/*' />
        /// <devdoc>
        ///    Create a suitable binding manager for the specified dataSource/dataMember combination.
        ///    - If one has already been created and cached by this BindingContext, return that instead.
        ///    - If the data source is an ICurrencyManagerProvider, just delegate to the data source.
        /// </devdoc>
        internal BindingManagerBase EnsureListManager(object dataSource, string dataMember)
        {
            BindingManagerBase bindingManagerBase = null;

            if (dataMember == null)
            {
                dataMember = "";
            }

            // Check whether data source wants to provide its own binding managers
            // (but fall through to old logic if it fails to provide us with one)
            //
            if (dataSource is ICurrencyManagerProvider)
            {
                bindingManagerBase = (dataSource as ICurrencyManagerProvider).GetRelatedCurrencyManager(dataMember);

                if (bindingManagerBase != null)
                {
                    return(bindingManagerBase);
                }
            }

            // Check for previously created binding manager
            //
            HashKey       key = GetKey(dataSource, dataMember);
            WeakReference wRef;

            wRef = listManagers[key] as WeakReference;
            if (wRef != null)
            {
                bindingManagerBase = (BindingManagerBase)wRef.Target;
            }
            if (bindingManagerBase != null)
            {
                return(bindingManagerBase);
            }

            if (dataMember.Length == 0)
            {
                // No data member specified, so create binding manager directly on the data source
                //
                if (dataSource is IList || dataSource is IListSource)
                {
                    // IListSource so we can bind the dataGrid to a table and a dataSet
                    bindingManagerBase = new CurrencyManager(dataSource);
                }
                else
                {
                    // Otherwise assume simple property binding
                    bindingManagerBase = new PropertyManager(dataSource);
                }
            }
            else
            {
                // Data member specified, so get data source's binding manager, and hook a 'related' binding manager to it
                //
                int    lastDot   = dataMember.LastIndexOf(".");
                string dataPath  = (lastDot == -1) ? "" : dataMember.Substring(0, lastDot);
                string dataField = dataMember.Substring(lastDot + 1);

                BindingManagerBase formerManager = EnsureListManager(dataSource, dataPath);

                PropertyDescriptor prop = formerManager.GetItemProperties().Find(dataField, true);
                if (prop == null)
                {
                    throw new ArgumentException(string.Format(SR.RelatedListManagerChild, dataField));
                }

                if (typeof(IList).IsAssignableFrom(prop.PropertyType))
                {
                    bindingManagerBase = new RelatedCurrencyManager(formerManager, dataField);
                }
                else
                {
                    bindingManagerBase = new RelatedPropertyManager(formerManager, dataField);
                }
            }

            // if wRef == null, then it is the first time we want this bindingManagerBase: so add it
            // if wRef != null, then the bindingManagerBase was GC'ed at some point: keep the old wRef and change its target
            if (wRef == null)
            {
                listManagers.Add(key, new WeakReference(bindingManagerBase, false));
            }
            else
            {
                wRef.Target = bindingManagerBase;
            }

            ScrubWeakRefs();
            // Return the final binding manager
            return(bindingManagerBase);
        }
Beispiel #48
0
        private void SetDataConnection(object newDataSource, BindingMemberInfo newDisplayMember, bool force)
        {
            bool flag  = this.dataSource != newDataSource;
            bool flag2 = !this.displayMember.Equals(newDisplayMember);

            if (!this.inSetDataConnection)
            {
                try
                {
                    if ((force || flag) || flag2)
                    {
                        this.inSetDataConnection = true;
                        IList list  = (this.DataManager != null) ? this.DataManager.List : null;
                        bool  flag3 = this.DataManager == null;
                        this.UnwireDataSource();
                        this.dataSource    = newDataSource;
                        this.displayMember = newDisplayMember;
                        this.WireDataSource();
                        if (this.isDataSourceInitialized)
                        {
                            CurrencyManager manager = null;
                            if (((newDataSource != null) && (this.BindingContext != null)) && (newDataSource != Convert.DBNull))
                            {
                                manager = (CurrencyManager)this.BindingContext[newDataSource, newDisplayMember.BindingPath];
                            }
                            if (this.dataManager != manager)
                            {
                                if (this.dataManager != null)
                                {
                                    this.dataManager.ItemChanged     -= new ItemChangedEventHandler(this.DataManager_ItemChanged);
                                    this.dataManager.PositionChanged -= new EventHandler(this.DataManager_PositionChanged);
                                }
                                this.dataManager = manager;
                                if (this.dataManager != null)
                                {
                                    this.dataManager.ItemChanged     += new ItemChangedEventHandler(this.DataManager_ItemChanged);
                                    this.dataManager.PositionChanged += new EventHandler(this.DataManager_PositionChanged);
                                }
                            }
                            if (((this.dataManager != null) && (flag2 || flag)) && (((this.displayMember.BindingMember != null) && (this.displayMember.BindingMember.Length != 0)) && !this.BindingMemberInfoInDataManager(this.displayMember)))
                            {
                                throw new ArgumentException(System.Windows.Forms.SR.GetString("ListControlWrongDisplayMember"), "newDisplayMember");
                            }
                            if (((this.dataManager != null) && ((flag || flag2) || force)) && (flag2 || (force && ((list != this.dataManager.List) || flag3))))
                            {
                                this.DataManager_ItemChanged(this.dataManager, new ItemChangedEventArgs(-1));
                            }
                        }
                        this.displayMemberConverter = null;
                    }
                    if (flag)
                    {
                        this.OnDataSourceChanged(EventArgs.Empty);
                    }
                    if (flag2)
                    {
                        this.OnDisplayMemberChanged(EventArgs.Empty);
                    }
                }
                finally
                {
                    this.inSetDataConnection = false;
                }
            }
        }
Beispiel #49
0
 protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum)
 {
 }
Beispiel #50
0
        /// <summary>
        /// This function is overriden so we can draw the link colors depending on whether the link is active or not.
        /// </summary>
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source,
                                      int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
        {
            if (rowNum == this.activeRow)
            {
                this.textBrush = Brushes.Red;
            }
            else
            {
                this.textBrush = new SolidBrush(this.DataGridTableStyle.LinkColor);
            }

            base.Paint(g, bounds, source, rowNum, backBrush, this.textBrush, alignToRight);
        }
Beispiel #51
0
 protected override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly1, string displayText, bool cellIsVisiblen)
 {
 }
 protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source,
                               int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
 {
     try
     {
         object o = this.GetColumnValueAtRow(source, rowNum);
         if (o != null)
         {
             if (compareValue == "CLOSINGDATE")
             {
                 if (Convert.ToDateTime(o.ToString()) < DateTime.Now)
                 {
                     //backBrush = new LinearGradientBrush(bounds, Color.FromArgb(255, 200, 200), Color.FromArgb(255, 20, 20), LinearGradientMode.BackwardDiagonal);
                     backBrush = new LinearGradientBrush(bounds, Color.Honeydew, Color.PaleGoldenrod, LinearGradientMode.BackwardDiagonal);
                     foreBrush = new SolidBrush(Color.OrangeRed);
                 }
             }
         }
     }
     catch (Exception ex) { /* empty catch */ }
     finally { base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight); }
 }
Beispiel #53
0
 protected override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
 {
     // Don't call the base class here so the text box doesn't get created.
     return;
 }
 public static bool AllowRemove(this CurrencyManager manager)
 {
     return((bool)manager.GetType().GetProperty("AllowRemove", BindingFlags.NonPublic | BindingFlags.Instance)
            .GetValue(manager, new object[] { }));
 }
Beispiel #55
0
 /// <summary>
 /// 重写父类方法
 /// </summary>
 /// <param name="source"></param>
 /// <param name="rowNum"></param>
 /// <param name="bounds"></param>
 /// <param name="readOnly"></param>
 /// <param name="instantText"></param>
 /// <param name="cellIsVisible"></param>
 protected override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly, string instantText, bool cellIsVisible)
 {
     // dont call the baseclass so no editing done...
     //	base.Edit(source, rowNum, bounds, readOnly, instantText, cellIsVisible);
 }
Beispiel #56
0
        /// <summary>
        /// 重写父类方法
        /// </summary>
        /// <param name="g"></param>
        /// <param name="bounds"></param>
        /// <param name="source"></param>
        /// <param name="rowNum"></param>
        /// <param name="backBrush"></param>
        /// <param name="foreBrush"></param>
        /// <param name="alignToRight"></param>
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
        {
            //base.Paint(g, bounds, source, rowNum, backBrush, foreBrush, alignToRight);
            try
            {
                DataGrid parent  = this.DataGridTableStyle.DataGrid;
                bool     current = parent.IsSelected(rowNum) ||
                                   (parent.CurrentRowIndex == rowNum &&
                                    parent.CurrentCell.ColumnNumber == this._columnNum);



                //draw the button
                Bitmap bm = _pressedRow == rowNum ? this._buttonFacePressed : this._buttonFace;
                this.DrawButton(g, bm, bounds, rowNum);
            }
            catch (System.Exception err)
            {
                throw new Exception("绘制按钮出错\n" + err.Message);
            }
            //font.Dispose();
        }
Beispiel #57
0
 /// <include file='doc\DataGridBoolColumn.uex' path='docs/doc[@for="DataGridBoolColumn.Paint1"]/*' />
 /// <internalonly/>
 /// <devdoc>
 /// <para>Draws the <see cref='System.Windows.Forms.DataGridBoolColumn'/>
 /// with the given <see cref='System.Drawing.Graphics'/>, <see cref='System.Drawing.Rectangle'/>,
 /// row number, and alignment settings. </para>
 /// </devdoc>
 protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, bool alignToRight)
 {
     Paint(g, bounds, source, rowNum, this.DataGridTableStyle.BackBrush, this.DataGridTableStyle.ForeBrush, alignToRight);
 }
Beispiel #58
0
        //overridden to fire BoolChange event and Formatting event
        protected override void Paint(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Brush backBrush, System.Drawing.Brush foreBrush, bool alignToRight)
        {
            int colNum = this.DataGridTableStyle.GridColumnStyles.IndexOf(this);

            //used to handle the boolchanging
            ManageBoolValueChanging(rowNum, colNum);

            //fire formatting event
            DataGridFormatCellEventArgs e = null;
            bool callBaseClass            = true;

            if (SetCellFormat != null)
            {
                e = new DataGridFormatCellEventArgs(rowNum, colNum, this.GetColumnValueAtRow(source, rowNum));
                SetCellFormat(this, e);
                if (e.BackBrush != null)
                {
                    backBrush = e.BackBrush;
                }
                callBaseClass = e.UseBaseClassDrawing;
            }
            if (callBaseClass)
            {
                base.Paint(g, bounds, source, rowNum, backBrush, new SolidBrush(Color.Red), alignToRight);
            }

            //clean up
            if (e != null)
            {
                if (e.BackBrushDispose)
                {
                    e.BackBrush.Dispose();
                }
                if (e.ForeBrushDispose)
                {
                    e.ForeBrush.Dispose();
                }
                if (e.TextFontDispose)
                {
                    e.TextFont.Dispose();
                }
            }
        }
 public static object Items(this CurrencyManager manager, int index)
 {
     return(manager.GetType().GetProperty("Item", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(manager, new object[] { index }));
 }
 protected internal override void Paint(Graphics g, Rectangle bounds, CurrencyManager source, int rowNum, Brush backBrush, Brush foreBrush, bool alignToRight)
 {
     PaintText(g, bounds, GetFormattedValue(source, rowNum), backBrush, foreBrush, alignToRight);
 }