public override void LoadData()
        {
            if (Initialized)
            {
                return;
            }

            _allowHandleEvents = false;

            memoEditBundleLine1.EnableSelectAll().RaiseNullValueIfEditorEmpty().AssignConfiguration(TabInfo.Item1Configuration);
            memoEditBundleLine2.EnableSelectAll().RaiseNullValueIfEditorEmpty().AssignConfiguration(TabInfo.Item2Configuration);
            memoEditBundleLine3.EnableSelectAll().RaiseNullValueIfEditorEmpty().AssignConfiguration(TabInfo.Item3Configuration);

            memoEditBundleLine1.Properties.NullText = TabInfo.Placeholder1 ?? memoEditBundleLine1.Properties.NullText;
            memoEditBundleLine2.Properties.NullText = TabInfo.Placeholder2 ?? memoEditBundleLine2.Properties.NullText;
            memoEditBundleLine3.Properties.NullText = TabInfo.Placeholder3 ?? memoEditBundleLine3.Properties.NullText;

            toggleSwitch.IsOn = TabState.Toggled ?? TabInfo.ToggleSwitch.Value;

            var savedListItem = TabState.BundleState?.ToLitsItem();

            _defaultItem     = TabInfo.BundleInfo.Items.FirstOrDefault(item => item.IsDefault);
            _currentListItem = TabInfo.BundleInfo.Items.FirstOrDefault(bundleListItem =>
                                                                       ResearchInfo.BundleListItem.Equals(bundleListItem, savedListItem)) ??
                               TabInfo.BundleInfo.Items.FirstOrDefault();

            memoEditBundleLine1.EditValue = (savedListItem ?? _defaultItem)?.Value1;
            memoEditBundleLine2.EditValue = (savedListItem ?? _defaultItem)?.Value2;
            memoEditBundleLine3.EditValue = (savedListItem ?? _defaultItem)?.Value3;

            _allowHandleEvents = true;

            Initialized = true;
        }
Ejemplo n.º 2
0
        public void LoadData(List <ResearchInfo.BundleListItem> items, ResearchInfo.BundleListItem defaultItem)
        {
            _items       = items;
            _defaultItem = defaultItem;


            gridControl.DataSource = _items
                                     .Select(ListItemModel.FromParent)
                                     .ToList();
        }
Ejemplo n.º 3
0
 public static ListItemModel FromParent(ResearchInfo.BundleListItem parentItem)
 {
     return(new ListItemModel
     {
         Parent = parentItem,
         Text = String.Format("{0}{1}{2}",
                              String.Format("<p style=\"color: #000000;\">{0}</p>", parentItem.Value1),
                              String.Format("<p style=\"color: #000000;\">{0}</p>", parentItem.Value2),
                              String.Format("<p style=\"color: #000000;\">{0}</p>", parentItem.Value3))
     });
 }
        private void SelectItemFromList()
        {
            using (var form = new FormResearchBundleList())
            {
                form.LoadData(TabInfo.BundleInfo.Items, _currentListItem ?? _defaultItem);
                if (form.ShowDialog() == DialogResult.OK)
                {
                    _currentListItem = form.SelectedItem;

                    _allowHandleEvents            = false;
                    memoEditBundleLine1.EditValue = (_currentListItem ?? _defaultItem)?.Value1;
                    memoEditBundleLine2.EditValue = (_currentListItem ?? _defaultItem)?.Value2;
                    memoEditBundleLine3.EditValue = (_currentListItem ?? _defaultItem)?.Value3;
                    RaiseEditValueChanged();
                    _allowHandleEvents = true;
                }
            }
        }
        private void SelectPreviouseItem()
        {
            var listItem = TabInfo.BundleInfo.Items
                           .FirstOrDefault(item => _currentListItem == null || ResearchInfo.BundleListItem.Equals(_currentListItem, item));
            var currentItemIndex = TabInfo.BundleInfo.Items.IndexOf(listItem);
            var nextItem         = TabInfo.BundleInfo.Items.ElementAtOrDefault(currentItemIndex - 1 >= 0 ? currentItemIndex - 1 : TabInfo.BundleInfo.Items.Count - 1);

            _currentListItem = ResearchInfo.BundleListItem.Equals(_defaultItem, nextItem) ?
                               null :
                               nextItem;

            _allowHandleEvents            = false;
            memoEditBundleLine1.EditValue = (_currentListItem ?? _defaultItem)?.Value1;
            memoEditBundleLine2.EditValue = (_currentListItem ?? _defaultItem)?.Value2;
            memoEditBundleLine3.EditValue = (_currentListItem ?? _defaultItem)?.Value3;
            RaiseEditValueChanged();
            _allowHandleEvents = true;
        }