public ItemControl(NeedsSolutionsTabFControl container) { _container = container; InitializeComponent(); memoEditSubheader.EnableSelectAll().RaiseNullValueIfEditorEmpty(); ItemState = NeedsSolutionsState.SolutionsItemState.Empty(); ItemState.Index = DefaultItemIndex; pictureEditClipart.MouseWheel += OnClipartMouseWheel; pictureEditUp.Image = _container.CustomTabInfo.ListUpImage; pictureEditDown.Image = _container.CustomTabInfo.ListDownImage; pictureEditList.Image = _container.CustomTabInfo.ListPopupImage; pictureEditWipe.Image = _container.CustomTabInfo.ListWipeImage; 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); }
private void OnWipeButtonClick(object sender, EventArgs e) { ItemState = NeedsSolutionsState.SolutionsItemState.Empty(); _currentItemInfo = _sourceList.FirstOrDefault(); UpdateDataControl(); RaiseEditValueChanged(); }
public void LoadData(NeedsSolutionsState.SolutionsItemState selectedItem) { ItemState = selectedItem; _currentItemInfo = _sourceList.FirstOrDefault(itemInfo => String.Equals(itemInfo.Title, ItemState.Title, StringComparison.OrdinalIgnoreCase)) ?? _sourceList.FirstOrDefault(); UpdateDataControl(); }
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 NeedsSolutionsState.SolutionsItemState GetSavedState() { var itemState = new NeedsSolutionsState.SolutionsItemState(); 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); }
public override void ApplyChanges() { var savedState = SlideContainer.EditedContent.NeedsSolutionsState.TabC.Items.FirstOrDefault(item => String.Equals(item.Id, ItemInfo.Id, StringComparison.OrdinalIgnoreCase)); if (savedState == null) { savedState = new NeedsSolutionsState.SolutionsItemState(); savedState.Id = ItemInfo.Id; SlideContainer.EditedContent.NeedsSolutionsState.TabC.Items.Add(savedState); } savedState.Index = TabControl.TabPages.IndexOf(this); savedState.Subheader = memoEditSubheader.EditValue as String != ItemInfo.SubHeaderDefaultValue ? memoEditSubheader.EditValue as String ?? String.Empty : null; }
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(); } } }
public void LoadData(NeedsSolutionsState.SolutionsItemState 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; }