Пример #1
0
        public ItemControl(ApproachTabCControl container)
        {
            _container = container;
            InitializeComponent();

            memoEditSubheader.EnableSelectAll().RaiseNullValueIfEditorEmpty();

            ItemState       = ApproachState.ApproachItemState.Empty();
            ItemState.Index = DefaultItemIndex;

            pictureEditClipart.MouseWheel += OnClipartMouseWheel;

            var scaleFactor = Utilities.GetScaleFactor(CreateGraphics().DpiX);

            layoutControlItemUp.MaxSize   = RectangleHelper.ScaleSize(layoutControlItemUp.MaxSize, scaleFactor);
            layoutControlItemUp.MinSize   = RectangleHelper.ScaleSize(layoutControlItemUp.MinSize, scaleFactor);
            layoutControlItemList.MaxSize = RectangleHelper.ScaleSize(layoutControlItemList.MaxSize, scaleFactor);
            layoutControlItemList.MinSize = RectangleHelper.ScaleSize(layoutControlItemList.MinSize, scaleFactor);
            layoutControlItemDown.MaxSize = RectangleHelper.ScaleSize(layoutControlItemDown.MaxSize, scaleFactor);
            layoutControlItemDown.MinSize = RectangleHelper.ScaleSize(layoutControlItemDown.MinSize, scaleFactor);
            layoutControlItemWipe.MaxSize = RectangleHelper.ScaleSize(layoutControlItemWipe.MaxSize, scaleFactor);
            layoutControlItemWipe.MinSize = RectangleHelper.ScaleSize(layoutControlItemWipe.MinSize, scaleFactor);
            emptySpaceItemWipe.MaxSize    = RectangleHelper.ScaleSize(emptySpaceItemWipe.MaxSize, scaleFactor);
            emptySpaceItemWipe.MinSize    = RectangleHelper.ScaleSize(emptySpaceItemWipe.MinSize, scaleFactor);
        }
Пример #2
0
        private void OnWipeButtonClick(object sender, EventArgs e)
        {
            ItemState        = ApproachState.ApproachItemState.Empty();
            _currentItemInfo = _sourceList.FirstOrDefault();

            UpdateDataControl();
            RaiseEditValueChanged();
        }
Пример #3
0
        public void LoadData(ApproachState.ApproachItemState selectedItem)
        {
            ItemState = selectedItem;

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

            UpdateDataControl();
        }
Пример #4
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        = ApproachState.ApproachItemState.FromItemInfo(_currentItemInfo);

            UpdateDataControl();
            RaiseEditValueChanged();
        }
Пример #5
0
        public ApproachState.ApproachItemState GetSavedState()
        {
            var itemState = new ApproachState.ApproachItemState();

            var comboValue = comboBoxEditCombo.EditValue?.ToString();

            itemState.Title = !String.Equals(comboValue, _defaultItem?.Title, StringComparison.OrdinalIgnoreCase) ? comboValue : null;

            var subheaderValue = memoEditSubheader.EditValue as String;

            itemState.Subheader = !String.Equals(subheaderValue, _defaultItem?.SubHeaderDefaultValue, StringComparison.OrdinalIgnoreCase) ? subheaderValue : null;

            if (!(String.IsNullOrWhiteSpace(itemState.Title) && String.IsNullOrWhiteSpace(itemState.Subheader)))
            {
                return(itemState);
            }
            return(null);
        }
Пример #6
0
        public override void ApplyChanges()
        {
            var savedState = SlideContainer.EditedContent.ApproachState.TabA.Items.FirstOrDefault(item =>
                                                                                                  String.Equals(item.Id, ItemInfo.Id, StringComparison.OrdinalIgnoreCase));

            if (savedState == null)
            {
                savedState    = new ApproachState.ApproachItemState();
                savedState.Id = ItemInfo.Id;
                SlideContainer.EditedContent.ApproachState.TabA.Items.Add(savedState);
            }

            savedState.Index     = TabControl.TabPages.IndexOf(this);
            savedState.Subheader =
                memoEditSubheader.EditValue as String != ItemInfo.SubHeaderDefaultValue
                                        ? memoEditSubheader.EditValue as String ?? String.Empty
                                        : null;
        }
Пример #7
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        = ApproachState.ApproachItemState.FromItemInfo(_currentItemInfo);

                    UpdateDataControl();
                    RaiseEditValueChanged();
                }
            }
        }
Пример #8
0
        public void LoadData(ApproachState.ApproachItemState itemState)
        {
            _allowHandleEvents = false;

            var itemInfo = _itemInfoList.FirstOrDefault(item =>
                                                        String.Equals(item.Title, itemState?.Title, StringComparison.OrdinalIgnoreCase));

            if (itemInfo != null)
            {
                comboBoxEditCombo.EditValue = itemInfo;
            }
            else
            {
                comboBoxEditCombo.EditValue = itemState?.Title;
            }

            memoEditSubheader.EditValue = itemState?.Subheader ?? itemInfo?.SubHeaderDefaultValue;

            UpdateWipeButtons();

            _allowHandleEvents = true;
        }