public void Init(
            IList <SolutionsItemInfo> itemInfoList,
            SolutionsItemInfo 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;
        }
Example #2
0
        private void OnWipeButtonClick(object sender, EventArgs e)
        {
            ItemState        = NeedsSolutionsState.SolutionsItemState.Empty();
            _currentItemInfo = _sourceList.FirstOrDefault();

            UpdateDataControl();
            RaiseEditValueChanged();
        }
Example #3
0
        public void LoadData(NeedsSolutionsState.SolutionsItemState selectedItem)
        {
            ItemState = selectedItem;

            _currentItemInfo = _sourceList.FirstOrDefault(itemInfo =>
                                                          String.Equals(itemInfo.Title, ItemState.Title, StringComparison.OrdinalIgnoreCase)) ??
                               _sourceList.FirstOrDefault();

            UpdateDataControl();
        }
            public static SolutionsItemState FromItemInfo(SolutionsItemInfo itemInfo)
            {
                var itemState = new SolutionsItemState();

                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 <SolutionsItemInfo> items, SolutionsItemInfo 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();
        }
Example #6
0
        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        = NeedsSolutionsState.SolutionsItemState.FromItemInfo(_currentItemInfo);

            UpdateDataControl();
            RaiseEditValueChanged();
        }
 public static ListItemModel FromParent(SolutionsItemInfo 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.ButtonHeader,
                                            styleConfiguration.TopFontSize,
                                            styleConfiguration.TopForeColor.ToHex()),
                              String.Format("<p style=\"font-size: {2}pt; color: {3};\">{0}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;({1})</p>",
                                            parentItem.SubHeaderDefaultValue,
                                            parentItem.Title,
                                            styleConfiguration.BottomFontSize,
                                            styleConfiguration.BottomForeColor.ToHex()))
     });
 }
Example #8
0
        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        = NeedsSolutionsState.SolutionsItemState.FromItemInfo(_currentItemInfo);

                    UpdateDataControl();
                    RaiseEditValueChanged();
                }
            }
        }
Example #9
0
        public ItemControl(SolutionsItemInfo itemInfo, NeedsSolutionsTabCControl 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(SolutionsItemInfo itemInfo)
 {
     ItemInfo = itemInfo;
 }