public CalculationDynamicForm(CalculationSettings sender, int type, DynamicConstant editItem) { _sender = sender; _type = type; if (_type == 2) { _editModel = editItem; } InitializeComponent(); LoadLists(); tb_name.DataBindings.Add("Text", _editModel, "Name"); tb_express.DataBindings.Add("Text", _editModel, "Expression"); }
public CalculationItemForm(CalculationSettings sender, int type, CalculationItem editItem) { InitializeComponent(); _sender = sender; _type = type; if (_type == 2) { _editModel = editItem; checkBox1.Checked = _editModel.WithSum == 1; checkBox2.Checked = _editModel.NeedRound == 1; } LoadLists(); tb_name.DataBindings.Add("Text", _editModel, "ItemName"); tb_value.DataBindings.Add("Text", _editModel, "Expression"); }
public CalculationConstantForm(CalculationSettings sender, int type, CalculationConstant item) { InitializeComponent(); _type = type; if (type == 2) { _editModel = item; } _sender = sender; Dictionary <int, string> constTypes = new Dictionary <int, string>(); constTypes.Add(1, "Постоянная"); constTypes.Add(2, "Ручная"); cb_type.DisplayMember = "Value"; cb_type.ValueMember = "Key"; cb_type.DataSource = new BindingSource(constTypes, null); tb_name.DataBindings.Add("Text", _editModel, "Name"); tb_value.DataBindings.Add("Text", _editModel, "Value"); cb_type.DataBindings.Add("SelectedValue", _editModel, "ConstantType"); }