Beispiel #1
0
        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;
        }
Beispiel #2
0
 public FormStyleManager(StorageFile contentFile)
 {
     _contentFile = contentFile;
     Style        = new MainFormStyleConfiguration();
     LoadConfig();
 }
        public void Init(
            CheckboxInfo comboToggleInfo,
            IList <ListDataItem> comboList,
            CheckboxInfo memoPopupToggleInfo,
            IList <ListDataItem> memoPopupList,
            IntegratedSolutionState.StatementItemState itemState,
            TextEditorConfiguration comboConfiguration,
            TextEditorConfiguration memoPopupConfiguration,
            MainFormStyleConfiguration styleConfiguration,
            ISolutionsResourceManager resourceManager)
        {
            _allowHandleEvents = false;

            _comboToggleInfo = comboToggleInfo;

            _comboList.Clear();
            _comboList.AddRange(comboList);

            _memoPopupList.Clear();
            _memoPopupList.AddRange(memoPopupList);

            _itemState = itemState;

            _styleConfiguration = styleConfiguration;

            comboBoxEditCombo.EnableSelectAll().RaiseNullValueIfEditorEmpty().AssignConfiguration(comboConfiguration);

            checkEditCombo.Text = String.Format("<color=gray>{0}</color>", comboToggleInfo.Title ?? "header");
            layoutControlItemToggleCombo.MinSize = new Size(checkEditCombo.Width, checkEditCombo.Height);
            layoutControlItemToggleCombo.MaxSize = new Size(checkEditCombo.Width, checkEditCombo.Height);

            comboBoxEditCombo.Properties.Items.Clear();
            comboBoxEditCombo.Properties.Items.AddRange(_comboList);
            comboBoxEditCombo.Properties.NullText =
                _comboList.FirstOrDefault(item => item.IsPlaceholder)?.Value ??
                comboBoxEditCombo.Properties.NullText;

            memoPopupEdit.Init(_memoPopupList,
                               _memoPopupList.FirstOrDefault(item => item.IsDefault || item.IsPlaceholder),
                               memoPopupConfiguration,
                               _styleConfiguration,
                               resourceManager);
            memoPopupEdit.EditValueChanged += OnEditValueChanged;

            if (_itemState.Combo != null)
            {
                checkEditCombo.Checked      = !String.IsNullOrEmpty(_itemState.Combo?.Value);
                comboBoxEditCombo.EditValue = _itemState.Combo;
            }
            else
            {
                checkEditCombo.Checked      = comboToggleInfo.Value;
                comboBoxEditCombo.EditValue = _comboList.FirstOrDefault(item => item.IsDefault && !item.IsPlaceholder);
            }

            if (_itemState.MemoPopup != null)
            {
                checkEditMemoPopup.Checked = !String.IsNullOrEmpty(_itemState.MemoPopup?.Value);
                memoPopupEdit.LoadData(_itemState.MemoPopup);
            }
            else
            {
                checkEditMemoPopup.Checked = memoPopupToggleInfo.Value;
            }

            _allowHandleEvents = true;
        }
        public void Init(IList <ListDataItem> sourceList,
                         ListDataItem defaultItem,
                         TextEditorConfiguration editorConfiguration,
                         MainFormStyleConfiguration styleConfiguration,
                         ISolutionsResourceManager resourceManager)
        {
            _sourceList.Clear();
            _sourceList.AddRange(sourceList);

            _defaultItem = defaultItem;

            _styleConfiguration = styleConfiguration;

            _allowHandleEvents = false;

            memoEdit.Properties.NullText = _defaultItem != null && _defaultItem.IsPlaceholder ? _defaultItem.Value : memoEdit.Properties.NullText;

            var listItem = _sourceList
                           .Where(item => !item.IsPlaceholder)
                           .FirstOrDefault(item => _defaultItem == null || !_defaultItem.IsPlaceholder && String.Equals(_defaultItem.Value, item.Value, StringComparison.OrdinalIgnoreCase));

            _currentListItem   = listItem;
            memoEdit.EditValue = listItem ?? _defaultItem;

            _allowHandleEvents = true;

            if (editorConfiguration != null)
            {
                if (editorConfiguration.FontSize.HasValue)
                {
                    var fontSizeDelte = editorConfiguration.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 (!editorConfiguration.BackColor.IsEmpty)
                {
                    layoutControl.Appearance.Control.BackColor         = editorConfiguration.BackColor;
                    layoutControl.Appearance.ControlFocused.BackColor  = editorConfiguration.BackColor;
                    layoutControl.Appearance.ControlDisabled.BackColor = CommonSkins.GetSkin(UserLookAndFeel.Default).Colors.GetColor(CommonColors.DisabledControl);;
                }
                if (!editorConfiguration.ForeColor.IsEmpty)
                {
                    layoutControl.Appearance.Control.ForeColor         = editorConfiguration.ForeColor;
                    layoutControl.Appearance.ControlFocused.ForeColor  = editorConfiguration.ForeColor;
                    layoutControl.Appearance.ControlDisabled.ForeColor = CommonSkins.GetSkin(UserLookAndFeel.Default).Colors.GetColor(CommonColors.DisabledText);
                }
                if (!editorConfiguration.DropdownForeColor.IsEmpty)
                {
                    layoutControl.Appearance.ControlDropDown.ForeColor       = editorConfiguration.DropdownForeColor;
                    layoutControl.Appearance.ControlDropDownHeader.ForeColor = editorConfiguration.DropdownForeColor;
                }
            }

            pictureEditUp.Image   = resourceManager?.SolutionMemoPopupUp ?? pictureEditUp.Image;
            pictureEditDown.Image = resourceManager?.SolutionMemoPopupDown ?? pictureEditDown.Image;
            pictureEditList.Image = resourceManager?.SolutionMemoPopupList ?? pictureEditList.Image;
        }