Ejemplo n.º 1
0
 public SelectColorForm(IColorRepo repo)
 {
     InitializeComponent();
     _repo = repo;
     _item = new ColorBl();
     Bind();
 }
Ejemplo n.º 2
0
        private void simpleButtonAddColor_Click(object sender, EventArgs e)
        {
            var form = new EditColorForm(_repo);

            if (form.ShowDialog() == DialogResult.OK)
            {
                _item = form._item;
                Bind();
                form.Dispose();
            }
        }
Ejemplo n.º 3
0
        public EditColorForm(IColorRepo repo, ColorBl item = null)
        {
            InitializeComponent();
            _repo = repo;
            _item = item;

            if (item != null)
            {
                Text = "Редактирование цвета";
            }
            else
            {
                Text  = "Новый цвет";
                _item = new ColorBl();
            }

            textEditName.DataBindings.Add("EditValue", _item, nameof(_item.Name), true, DataSourceUpdateMode.OnPropertyChanged);
            textEditComment.DataBindings.Add("EditValue", _item, nameof(_item.Comment), true, DataSourceUpdateMode.OnPropertyChanged);
        }
Ejemplo n.º 4
0
        private void simpleButtonSave_Click(object sender, EventArgs e)
        {
            ProcessTabKey(true);

            if (Validation() == false)
            {
                return;
            }

            if (_item.Id == 0)
            {
                _item = _repo.Add(_item);
            }
            else
            {
                _repo.Update(_item);
            }

            DialogResult = DialogResult.OK;
        }
Ejemplo n.º 5
0
 private void CreateColorLabel(ColorBl item)
 {
     layoutControl1.BeginUpdate();
     try
     {
         // Create a layout item that will display a new base
         SimpleLabelItem simpleLabel = new SimpleLabelItem();
         simpleLabel.Parent = layoutControlGroup1;
         simpleLabel.Name   = "simpleLabelColor" + item.Id;
         simpleLabel.Text   = $"{item.Name} ({item.Comment})";
         simpleLabel.Tag    = item;
         //simpleLabel.OptionsToolTip.ToolTip = $"{item.Name} ({item.Comment})";
         //simpleLabel.OptionsToolTip.ImmediateToolTip = true;
         simpleLabel.DoubleClick += new System.EventHandler(this.lable_DoubleClick);
         simpleLabel.Move(layoutControlItemButtonColor, InsertType.Top);
     }
     finally
     {
         // Unlock and update the layout control.
         layoutControl1.EndUpdate();
     }
 }
Ejemplo n.º 6
0
        public ColorBl Update(ColorBl item)
        {
            var dto = _service.Update(item?.ToDto());

            return(dto != null ? new ColorBl(dto) : null);
        }