public void AddEmptyRow() { int newRowIndex = Rows.Count; Rows.Insert(newRowIndex); SuplementTypeCellValueChangedController suplementController = new SuplementTypeCellValueChangedController(this, entry); var lookupEditor = new LookupEditEditor(typeof(Guid)); this[newRowIndex, SuplementTypeColumn] = new SourceGrid.Cells.Cell(null, lookupEditor); SourceGrid.Cells.Views.Cell readOnlyView = new SourceGrid.Cells.Views.Cell(); this[newRowIndex, SuplementTypeColumn].View = readOnlyView; this[newRowIndex, SuplementTypeColumn].View.ForeColor = ApplicationColors.FGNullText; this[newRowIndex, SuplementTypeColumn].AddController(suplementController); this[newRowIndex, SuplementTypeColumn].Editor.NullDisplayString = SuplementsEntryStrings.SelectSuplementType; readOnlyView = new SourceGrid.Cells.Views.Cell(); var textBox = new SourceGrid.Cells.Editors.TextBox(typeof(string)); textBox.Control.MaxLength = Constants.NameColumnLength; this[newRowIndex, SuplementNameColumn] = new SourceGrid.Cells.Cell(null, textBox); this[newRowIndex, SuplementNameColumn].View = readOnlyView; readOnlyView = new SourceGrid.Cells.Views.Cell(); ////grid1[newRowIndex, 1].AddController(ee); this[newRowIndex, InfoColumn] = new SourceGrid.Cells.Cell(null, new MemoExEditEditor()); this[newRowIndex, InfoColumn].View = readOnlyView; this[newRowIndex, InfoColumn].AddController(commentableCellController); this[newRowIndex, InfoColumn].Column.Width = 80; var maskEditor = new MaskEditEditor(); maskEditor.MaskRegEx = string.Format("[0-9]*{0}?[0-9]*", System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator); this[newRowIndex, DosageColumn] = new SourceGrid.Cells.Cell(null, maskEditor); this[newRowIndex, DosageColumn].View = readOnlyView; SourceGrid.Cells.Editors.ComboBox cbEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(ComboBoxItem)); //cbEditor.StandardValues = Enum.GetValues(typeof (DosageType)); foreach (DosageType type in Enum.GetValues(typeof(DosageType))) { cbEditor.Control.Items.Add(new BodyArchitect.Controls.ComboBoxItem(type, EnumLocalizer.Default.Translate(type))); } cbEditor.Control.DropDownStyle = ComboBoxStyle.DropDownList; this[newRowIndex, DosageTypeColumn] = new SourceGrid.Cells.Cell(null, cbEditor); this[newRowIndex, DosageTypeColumn].View = readOnlyView; this[newRowIndex, DosageTypeColumn].Column.Width = 80; var timeEditor = new TimeEditEditor(); this[newRowIndex, TimeColumn] = new SourceGrid.Cells.Cell(null, timeEditor); this[newRowIndex, TimeColumn].View = new TimeEditView(); UpdateCellsReadOnlyMode(Rows[newRowIndex]); }
public void AddEmptyRow() { int newRowIndex = grid1.Rows.Count; grid1.Rows.Insert(newRowIndex); var lookupEditor = new LookupEditEditor(typeof(Guid)); LookUpColumnInfo selectedCol = (LookUpColumnInfo)((ComboBoxItem)cmbExerciseViewType.SelectedItem).Tag; lookupEditor.Control.SetDisplayColumn(selectedCol); grid1[newRowIndex, FromExerciseColumn] = new SourceGrid.Cells.Cell(null, lookupEditor); SourceGrid.Cells.Views.Cell readOnlyView = new SourceGrid.Cells.Views.Cell(); grid1[newRowIndex, FromExerciseColumn].View = readOnlyView; grid1[newRowIndex, FromExerciseColumn].View.ForeColor = ApplicationColors.FGNullText; grid1[newRowIndex, FromExerciseColumn].AddController(mapperCtrl); grid1[newRowIndex, FromExerciseColumn].Editor.NullDisplayString = StrengthTrainingEntryStrings.SelectExercise; grid1[newRowIndex, FromExerciseColumn].Column.Width = 250; readOnlyView = new SourceGrid.Cells.Views.Cell(); lookupEditor = new LookupEditEditor(typeof(Guid)); lookupEditor.Control.SetDisplayColumn(selectedCol); grid1[newRowIndex, ToExerciseColumn] = new SourceGrid.Cells.Cell(null, lookupEditor); readOnlyView = new SourceGrid.Cells.Views.Cell(); grid1[newRowIndex, ToExerciseColumn].View = readOnlyView; grid1[newRowIndex, ToExerciseColumn].View.ForeColor = ApplicationColors.FGNullText; grid1[newRowIndex, ToExerciseColumn].AddController(mapperCtrl); grid1[newRowIndex, ToExerciseColumn].Editor.NullDisplayString = StrengthTrainingEntryStrings.SelectExercise; grid1[newRowIndex, ToExerciseColumn].Column.Width = 250; SourceGrid.Cells.Editors.ComboBox cbEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(ComboBoxItem)); //cbEditor.StandardValues = Enum.GetValues(typeof(MapperEntryOperation)); foreach (MapperEntryOperation type in Enum.GetValues(typeof(MapperEntryOperation))) { cbEditor.Control.Items.Add(new ComboBoxItem(type, EnumLocalizer.Default.Translate(type))); } cbEditor.Control.DropDownStyle = ComboBoxStyle.DropDownList; cbEditor.Control.SelectedIndex = 0; readOnlyView = new SourceGrid.Cells.Views.Cell(); grid1[newRowIndex, OperationColumn] = new SourceGrid.Cells.Cell(null, cbEditor); grid1[newRowIndex, OperationColumn].View = readOnlyView; grid1[newRowIndex, OperationColumn].Column.Width = 80; UpdateCellsReadOnlyMode(grid1.Rows[newRowIndex]); }
public void AddEmptyRow(int setNumber) { SerieCellValueChangedController serieCellValueChangedController = new SerieCellValueChangedController(this); int newRowIndex = grid1.Rows.Count; grid1.Rows.Insert(newRowIndex); var lookupEditor = new LookupEditEditor(typeof(Guid)); LookUpColumnInfo selectedCol = (LookUpColumnInfo)cmbExerciseColumns.SelectedItem; lookupEditor.Control.SetDisplayColumn(selectedCol); grid1[newRowIndex, ExerciseColumnIndex] = new SourceGrid.Cells.Cell(null, lookupEditor); SourceGrid.Cells.Views.Cell readOnlyView = new SourceGrid.Cells.Views.Cell(); grid1[newRowIndex, ExerciseColumnIndex].View = readOnlyView; grid1[newRowIndex, ExerciseColumnIndex].View.ForeColor = ApplicationColors.FGNullText; grid1[newRowIndex, ExerciseColumnIndex].AddController(exerciseCellController); grid1[newRowIndex, ExerciseColumnIndex].Editor.NullDisplayString = StrengthTrainingEntryStrings.SelectExercise; grid1[newRowIndex, ExerciseColumnIndex].Column.Width = 250; grid1[newRowIndex, CommentColumnIndex] = new SourceGrid.Cells.Cell(null, new MemoExEditEditor()); readOnlyView = new SourceGrid.Cells.Views.Cell(); //grid1[newRowIndex, 1].AddController(ee); grid1[newRowIndex, CommentColumnIndex].View = readOnlyView; grid1[newRowIndex, CommentColumnIndex].AddController(CommentableCellController); grid1[newRowIndex, CommentColumnIndex].Column.Width = 80; //string SerieRepetitionMask = string.Format(@"[0-9]*x[0-9]*[\{0}]?[0-9]*",System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator); for (int i = 0; i < setNumber; i++) { //readOnlyView = new SourceGrid.Cells.Views.Cell(); var maskEditor = new SetEditor(); //maskEditor.MaskRegEx = SerieRepetitionMask; grid1[newRowIndex, StandardColumnNumber + i] = new SourceGrid.Cells.Cell(null, maskEditor); grid1[newRowIndex, StandardColumnNumber + i].AddController(serieCellValueChangedController); grid1[newRowIndex, StandardColumnNumber + i].AddController(popupMenuController); grid1[newRowIndex, StandardColumnNumber + i].View = new SetView(); } UpdateCellsReadOnlyMode(grid1.Rows[newRowIndex]); }