public override void AddGridRow(IHTMLElement element) { int RowIndex = gridElement.RowsCount++; //gbFindElement.Height = (gridElement.RowsCount + 1) * gridElement.Rows.GetHeight(RowIndex); gridElement.Rows[RowIndex].Tag = element; gridElement[RowIndex, 0] = new Cell(element.tagName, new TextBox(typeof(string))); var id = element.getAttribute("id", 0) == null ? "" : element.getAttribute("id", 0).ToString(); gridElement[RowIndex, 1] = new Cell(id, new TextBox(typeof(string))); var val = element.getAttribute("value", 0) == null ? "" : element.getAttribute("value", 0).ToString(); gridElement[RowIndex, 2] = new Cell(val, new TextBox(typeof(string))); var btnDelete = new Button(""); gridElement[RowIndex, 3] = btnDelete; var bmpDelete = new Bitmap(ucBaseElement.GetIconFullPath("db-Delete.bmp")); bmpDelete.MakeTransparent(Color.Fuchsia); gridElement[RowIndex, 3].Image = bmpDelete; var buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += DeleteFindButton_Click; gridElement[RowIndex, 3].Controller.AddController(buttonClickEvent); }
private Cell CreateButtonCell(ICrudGridColumn columnBinding, object entity, string caption, System.Drawing.Image image, Action <object> clickHandler) { var button = new SourceGrid.Cells.Button(caption) { Image = image }; var clickHandlerController = new SourceGrid.Cells.Controllers.Button(); clickHandlerController.Executed += (o, e) => clickHandler(entity); button.AddController(clickHandlerController); return(button); }
public override void OnValueChanged(SourceGrid.CellContext sender, EventArgs e) { base.OnValueChanged(sender, e); Grid grid1 = (Grid)sender.Grid; StrengthTrainingItemDTO entry = null; var row = grid1.Rows[sender.Position.Row]; if (row == null) { return; } if (row.Tag == null) { entry = new StrengthTrainingItemDTO(); row.Tag = entry; strengthEntry.AddEntry(entry); parent.AddEmptyRow(parent.GetSeriesNumber()); } else { entry = (StrengthTrainingItemDTO)row.Tag; } Guid newId = (Guid)sender.Value; if (newId == Guid.Empty) { sender.Value = entry.ExerciseId; return; } entry.ExerciseId = newId; parent.UpdateCellsReadOnlyMode(row); if (!(grid1[row.Index, usrStrengthTrainingSourceGridBase.DeleteRowColumnIndex] is SourceGrid.Cells.Button)) { grid1[row.Index, usrStrengthTrainingSourceGridBase.ExerciseColumnIndex].View.ForeColor = Color.Black; if (parent.ReadOnly) { return; } var bnCol1 = new SourceGrid.Cells.Button(null); bnCol1.Image = StrengthTrainingResources.Delete; bnCol1.ToolTipText = StrengthTrainingEntryStrings.DeleteThisEntryBtn; var ctrButton1 = new SourceGrid.Cells.Controllers.Button(); ctrButton1.Executed += new EventHandler(deleteRowBtn_Execute); bnCol1.View = new SourceGrid.Cells.Views.Button(); bnCol1.AddController(ctrButton1); grid1[row.Index, usrStrengthTrainingSourceGridBase.DeleteRowColumnIndex] = bnCol1; } }
private void buttonClickEvent_Executed(object sender, EventArgs e) { CellContext context = (CellContext)sender; Button cell = (Button)context.Cell; try { IConfigure plugin = cell.Row.Tag as IConfigure; if (plugin != null) { plugin.Configure(this); } } catch (Exception ex) { IrssLog.Error(ex); MessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void AddGridRow(FindAttribute attribute) { int RowIndex = gridElement.RowsCount++; gridElement[RowIndex, 0] = new Cell(FindMethods.XPath.ToString(), new TextBox(typeof(string))); var id = attribute.FindName == null ? "" : attribute.FindName; gridElement[RowIndex, 1] = new Cell(id, new TextBox(typeof(string))); var val = attribute.FindValue; gridElement[RowIndex, 2] = new Cell(val, new TextBox(typeof(string))); var btnDelete = new Button(""); gridElement[RowIndex, 3] = btnDelete; var bmpDelete = new Bitmap(ucBaseElement.GetIconFullPath("db-Delete.bmp")); bmpDelete.MakeTransparent(Color.Fuchsia); gridElement[RowIndex, 3].Image = bmpDelete; var buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += DeleteFindButton_Click; gridElement[RowIndex, 3].Controller.AddController(buttonClickEvent); }
public virtual void AddGridRow(IHTMLElement element) { int RowIndex = gridElement.RowsCount++; gridElement[RowIndex, 0] = new Cell(FindMethods.XPath.ToString(), new TextBox(typeof(string))); var id = element.getAttribute("id", 0) == null ? "" : element.getAttribute("id", 0).ToString(); gridElement[RowIndex, 1] = new Cell(id, new TextBox(typeof(string))); var val = XPathFinder.GetXPath(element); gridElement[RowIndex, 2] = new Cell(val, new TextBox(typeof(string))); var btnDelete = new Button(""); gridElement[RowIndex, 3] = btnDelete; var bmpDelete = new Bitmap(ucBaseElement.GetIconFullPath("db-Delete.bmp")); bmpDelete.MakeTransparent(Color.Fuchsia); gridElement[RowIndex, 3].Image = bmpDelete; var buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += DeleteFindButton_Click; gridElement[RowIndex, 3].Controller.AddController(buttonClickEvent); }
private void CreateGrid() { IrssLog.Info("Creating configuration grid ..."); try { int row = 0; gridPlugins.Rows.Clear(); gridPlugins.Columns.SetCount(5); // Setup Column Headers gridPlugins.Rows.Insert(row); ColumnHeader header = new ColumnHeader(" "); header.AutomaticSortEnabled = false; gridPlugins[row, ColIcon] = header; gridPlugins[row, ColName] = new ColumnHeader("Name"); gridPlugins[row, ColReceive] = new ColumnHeader("Receive"); gridPlugins[row, ColTransmit] = new ColumnHeader("Transmit"); gridPlugins[row, ColConfigure] = new ColumnHeader("Configure"); gridPlugins.FixedRows = 1; foreach (PluginBase transceiver in _transceivers) { gridPlugins.Rows.Insert(++row); gridPlugins.Rows[row].Tag = transceiver; // Icon Cell if (transceiver.DeviceIcon != null) { Image iconCell = new Image(transceiver.DeviceIcon); iconCell.Editor.EnableEdit = false; gridPlugins[row, ColIcon] = iconCell; } else { gridPlugins[row, ColIcon] = new Cell(); } // Name Cell Cell nameCell = new Cell(transceiver.Name); CustomEvents nameCellController = new CustomEvents(); nameCellController.DoubleClick += PluginDoubleClick; nameCell.AddController(nameCellController); nameCell.AddController(new ToolTipText()); nameCell.ToolTipText = String.Format("{0}\nVersion: {1}\nAuthor: {2}\n{3}", transceiver.Name, transceiver.Version, transceiver.Author, transceiver.Description); gridPlugins[row, ColName] = nameCell; // Receive Cell if (transceiver is IRemoteReceiver || transceiver is IMouseReceiver || transceiver is IKeyboardReceiver) { gridPlugins[row, ColReceive] = new CheckBox(); } else { gridPlugins[row, ColReceive] = new Cell(); } // Transmit Cell if (transceiver is ITransmitIR) { CheckBox checkbox = new CheckBox(); CustomEvents checkboxcontroller = new CustomEvents(); checkboxcontroller.ValueChanged += TransmitChanged; checkbox.Controller.AddController(checkboxcontroller); gridPlugins[row, ColTransmit] = checkbox; } else { gridPlugins[row, ColTransmit] = new Cell(); } // Configure Cell if (transceiver is IConfigure) { Button button = new Button("Configure"); SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += buttonClickEvent_Executed; button.Controller.AddController(buttonClickEvent); gridPlugins[row, ColConfigure] = button; } else { gridPlugins[row, ColConfigure] = new Cell(); } } gridPlugins.Columns[ColIcon].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.Columns[ColName].AutoSizeMode = SourceGrid.AutoSizeMode.Default; gridPlugins.Columns[ColReceive].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.Columns[ColTransmit].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.Columns[ColConfigure].AutoSizeMode = SourceGrid.AutoSizeMode.EnableAutoSize; gridPlugins.AutoStretchColumnsToFitWidth = true; gridPlugins.AutoSizeCells(); gridPlugins.SortRangeRows(new RangeFullGridNoFixedRows(), ColName, true, new ValueCellComparer()); } catch (Exception ex) { IrssLog.Error(ex); MessageBox.Show(this, ex.ToString(), "Error setting up plugin grid", MessageBoxButtons.OK, MessageBoxIcon.Error); } }