public void Init( IList <ApproachItemInfo> itemInfoList, ApproachItemInfo defaultItem, string comboPlaceholder, TextEditorConfiguration comboConfiguration, TextEditorConfiguration subheaderConfiguration, MainFormStyleConfiguration styleConfiguration) { _allowHandleEvents = false; _itemInfoList.Clear(); _itemInfoList.AddRange(itemInfoList); _defaultItem = defaultItem; _styleConfiguration = styleConfiguration; comboBoxEditCombo.EnableSelectAll().RaiseNullValueIfEditorEmpty().AssignConfiguration(comboConfiguration); memoEditSubheader.EnableSelectAll().RaiseNullValueIfEditorEmpty().AssignConfiguration(subheaderConfiguration); comboBoxEditCombo.Properties.Items.Clear(); comboBoxEditCombo.Properties.Items.AddRange(_itemInfoList); comboBoxEditCombo.Properties.NullText = comboPlaceholder ?? comboBoxEditCombo.Properties.NullText; comboBoxEditCombo.EditValue = _defaultItem; memoEditSubheader.EditValue = _defaultItem?.SubHeaderDefaultValue; _allowHandleEvents = true; }
private void OnWipeButtonClick(object sender, EventArgs e) { ItemState = ApproachState.ApproachItemState.Empty(); _currentItemInfo = _sourceList.FirstOrDefault(); UpdateDataControl(); RaiseEditValueChanged(); }
public void LoadData(ApproachState.ApproachItemState selectedItem) { ItemState = selectedItem; _currentItemInfo = _sourceList.FirstOrDefault(itemInfo => String.Equals(itemInfo.Title, ItemState.Title, StringComparison.OrdinalIgnoreCase)) ?? _sourceList.FirstOrDefault(); UpdateDataControl(); }
public static ApproachItemState FromItemInfo(ApproachItemInfo itemInfo) { var itemState = new ApproachItemState(); if (itemInfo != null) { itemState.Id = itemInfo.Id; itemState.Clipart = ImageClipartObject.FromFile(itemInfo.ImagePath); itemState.Title = itemInfo.Title; itemState.Subheader = itemInfo.SubHeaderDefaultValue; } return(itemState); }
public void LoadData(List <ApproachItemInfo> items, ApproachItemInfo defaultItem, FormListConfiguration formConfiguration) { _items = items; _defaultItem = defaultItem; gridView.Appearance.Row.BackColor = formConfiguration.BackgroundColor; gridView.Appearance.RowSeparator.BackColor = formConfiguration.BackgroundColor; gridView.Appearance.Empty.BackColor = formConfiguration.BackgroundColor; gridControl.DataSource = _items .Select(item => ListItemModel.FromParent(item, formConfiguration)) .ToList(); }
public static ListItemModel FromParent(ApproachItemInfo parentItem, FormListConfiguration styleConfiguration) { return(new ListItemModel { Parent = parentItem, Text = String.Format("{0}{1}", String.Format("<p style=\"font-size: {1}pt; color: {2};\">{0}</p>", parentItem.Title, styleConfiguration.TopFontSize, styleConfiguration.TopForeColor.ToHex()), String.Format("<p style=\"font-size: {1}pt; color: {2};\">{0}</p>", parentItem.SubHeaderDefaultValue, styleConfiguration.BottomFontSize, styleConfiguration.BottomForeColor.ToHex())) }); }
private void OnDownButtonClick(object sender, EventArgs e) { if (!_sourceList.Any()) { return; } var currentItemIndex = _sourceList.IndexOf(_currentItemInfo); var nextIndex = currentItemIndex < _sourceList.Count - 1 ? currentItemIndex + 1 : 0; _currentItemInfo = _sourceList[nextIndex]; ItemState = ApproachState.ApproachItemState.FromItemInfo(_currentItemInfo); UpdateDataControl(); RaiseEditValueChanged(); }
private void OnListButtonClick(object sender, EventArgs e) { if (!_sourceList.Any()) { return; } using (var form = new FormList()) { form.LoadData(_sourceList, _currentItemInfo, _container.CustomTabInfo.FormListConfiguration); if (form.ShowDialog() == DialogResult.OK) { _currentItemInfo = form.SelectedItem; ItemState = ApproachState.ApproachItemState.FromItemInfo(_currentItemInfo); UpdateDataControl(); RaiseEditValueChanged(); } } }
public ItemControl(ApproachItemInfo itemInfo, ApproachTabAControl container) : base(container) { InitializeComponent(); ItemInfo = itemInfo; Text = ItemInfo.Title; memoEditSubheader.EnableSelectAll().RaiseNullValueIfEditorEmpty(); if (ItemInfo.SubheaderConfiguration.FontSize.HasValue) { var fontSizeDelte = ItemInfo.SubheaderConfiguration.FontSize.Value - TextEditorConfiguration.DefaultFontSize; layoutControl.Appearance.Control.FontSizeDelta = fontSizeDelte; layoutControl.Appearance.ControlFocused.FontSizeDelta = fontSizeDelte; layoutControl.Appearance.ControlDropDown.FontSizeDelta = fontSizeDelte; layoutControl.Appearance.ControlDropDownHeader.FontSizeDelta = fontSizeDelte; layoutControl.Appearance.ControlDisabled.FontSizeDelta = fontSizeDelte; layoutControl.Appearance.ControlReadOnly.FontSizeDelta = fontSizeDelte; } if (!ItemInfo.SubheaderConfiguration.BackColor.IsEmpty) { layoutControl.Appearance.Control.BackColor = ItemInfo.SubheaderConfiguration.BackColor; layoutControl.Appearance.ControlFocused.BackColor = ItemInfo.SubheaderConfiguration.BackColor; } if (!ItemInfo.SubheaderConfiguration.ForeColor.IsEmpty) { layoutControl.Appearance.Control.ForeColor = ItemInfo.SubheaderConfiguration.ForeColor; layoutControl.Appearance.ControlFocused.ForeColor = ItemInfo.SubheaderConfiguration.ForeColor; } if (!ItemInfo.SubheaderConfiguration.DropdownForeColor.IsEmpty) { layoutControl.Appearance.ControlDropDown.ForeColor = ItemInfo.SubheaderConfiguration.DropdownForeColor; layoutControl.Appearance.ControlDropDownHeader.ForeColor = ItemInfo.SubheaderConfiguration.DropdownForeColor; } }
public ItemButton(ApproachItemInfo itemInfo) { ItemInfo = itemInfo; }