/// <summary>
        /// Устанавливает представление комбобокса.
        /// </summary>
        /// <param name="comboBox">Объект представления.</param>
        /// <param name="id">Код выбранного пункта.</param>
        /// <param name="allowNull">Допустимость Null значений. </param>
        /// <param name="showNullValue">Показывать ли стандартное Null значение. </param>
        public void SetView(ComboBoxControl comboBox, T?id, bool allowNull, bool showNullValue)
        {
            _controller = new ComboBoxController();
            _controller.SetView(comboBox);
            SetUpModel(_controller.Model);

            _controller.Model.AllowNull     = allowNull;
            _controller.Model.ShowNullValue = showNullValue;
            ReInitialize(id);
        }
Ejemplo n.º 2
0
        //end GetDataFromSevice


        /// <summary>
        /// Khởi tạo ComboBox cho Create / Update
        /// </summary>
        /// <returns>
        /// out viewModel
        /// </returns>
        private void InitComboBox(ref ProductUpdateViewModel viewModel)
        {
            //Get Data ComboBox
            var comboBox = new ComboBoxController();

            viewModel.Catalogs = comboBox.GetCatalogs(MODE_UPDATE);

            viewModel.Sizes  = comboBox.GetProductType("Size");
            viewModel.Colors = comboBox.GetProductType("Color");

            return;
        }
Ejemplo n.º 3
0
        private void cbxCountrySelection_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var countryName = cbxCountrySelection.SelectedItem.ToString();

            if (!ComboBoxController.FillProvinceSelector(cbxProvinceSelection, countryName))
            {
                cbxCaseTypeSelection.IsEnabled = true;
                if (cbxCaseTypeSelection.SelectedItem != null)
                {
                    btnCreateChart.IsEnabled = true;
                    btnAddChart.IsEnabled    = true;
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initialize a new instance of the ViewDrawRibbonGroupComboBox class.
        /// </summary>
        /// <param name="ribbon">Reference to owning ribbon control.</param>
        /// <param name="ribbonComboBox">Reference to source combobox.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public ViewDrawRibbonGroupComboBox(KryptonRibbon ribbon,
                                           KryptonRibbonGroupComboBox ribbonComboBox,
                                           NeedPaintHandler needPaint)
        {
            Debug.Assert(ribbon != null);
            Debug.Assert(ribbonComboBox != null);
            Debug.Assert(needPaint != null);

            // Remember incoming references
            _ribbon       = ribbon;
            GroupComboBox = ribbonComboBox;
            _needPaint    = needPaint;
            _currentSize  = GroupComboBox.ItemSizeCurrent;

            // Hook into the combobox events
            GroupComboBox.MouseEnterControl += OnMouseEnterControl;
            GroupComboBox.MouseLeaveControl += OnMouseLeaveControl;

            // Associate this view with the source component (required for design time selection)
            Component = GroupComboBox;

            if (_ribbon.InDesignMode)
            {
                // At design time we need to know when the user right clicks the combobox
                ContextClickController controller = new();
                controller.ContextClick += OnContextClick;
                MouseController          = controller;
            }

            // Create controller needed for handling focus and key tip actions
            _controller      = new ComboBoxController(_ribbon, GroupComboBox, this);
            SourceController = _controller;
            KeyController    = _controller;

            // We need to rest visibility of the combobox for each layout cycle
            _ribbon.ViewRibbonManager.LayoutBefore += OnLayoutAction;
            _ribbon.ViewRibbonManager.LayoutAfter  += OnLayoutAction;

            // Define back reference to view for the combo box definition
            GroupComboBox.ComboBoxView = this;

            // Give paint delegate to combobox so its palette changes are redrawn
            GroupComboBox.ViewPaintDelegate = needPaint;

            // Hook into changes in the ribbon custom definition
            GroupComboBox.PropertyChanged += OnComboBoxPropertyChanged;

            NULL_CONTROL_WIDTH = (int)(50 * FactorDpiX);
        }
Ejemplo n.º 5
0
        public IActionResult ProductManager(int catalogSelect, string keySearch, int page = 1, int pageSize = 5)
        {
            var Catalogs = new ComboBoxController().GetCatalogs(MODE_MANAGER);

            //
            if (string.IsNullOrWhiteSpace(keySearch))
            {
                keySearch = " ";
            }

            List <Product> products = new List <Product>();

            products = productService.SearchFullText(keySearch, catalogSelect, 1);

            //
            List <ProductBasicViewModel> listProduct = new List <ProductBasicViewModel>();

            foreach (var p in products)
            {
                string userName = string.Empty;
                User   user     = userService.Get(p.CreateByUser);
                if (user != null)
                {
                    userName = user.HoTen;
                }

                ProductBasicViewModel product = new ProductBasicViewModel()
                {
                    Id       = p.Id,
                    Name     = p.Name,
                    UserName = userName,
                    State    = p.State
                };
                listProduct.Add(product);
            }
            //
            ProductManagerViewModel model =
                new ProductManagerViewModel(listProduct, page, pageSize, Catalogs, keySearch, catalogSelect);

            return(View(model));
        }
Ejemplo n.º 6
0
        public LineChartPage()
        {
            InitializeComponent();

            ComboBoxController = new ComboBoxController();

            ComboBoxController.FillCountrySelector(cbxCountrySelection);
            ComboBoxController.FillCaseTypeSelector(cbxCaseTypeSelection);

            ChartController = new ChartController();

            SeriesCollection = new SeriesCollection()
            {
                ChartController.GetSeries("Poland", (int)Model.CaseType.Confirmed),
                ChartController.GetSeries("Poland", (int)Model.CaseType.Deaths)
            };

            Labels      = ChartController.GetLabels();
            YFormatter  = value => value.ToString();
            DataContext = this;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Биндинг комбобокса.
        /// </summary>
        private IUserControlController BindComboBox(PropertyInfo propertyInfo, IControlDescriptor control)
        {
            ComboBoxController controller = null;

            var attr = GetAttribute <ComboBoxControlAttribute>(propertyInfo);

            if (attr != null)
            {
                var instance = Core.ClientCore.Instance.CreateInstance <IComboBoxItemController>(attr.ControllerType);

                if (instance != null)
                {
                    instance.SetView((ComboBoxControl)control, attr.AllowNull, attr.ShowNullValue);
                    controller = instance.GetController();

                    ProcessCommon(controller.Model, propertyInfo);
                    ProcessFocusable(control, propertyInfo);
                    _comboBoxItems.Add(propertyInfo.Name, instance);
                }
            }

            return(controller);
        }