Ejemplo n.º 1
0
        private void EditText(int index)
        {
            CustomTextViewModel vm = (CustomTextViewModel)bsTexts[index];

            var frm = new CustomTextEditor(_repository);

            frm.CustomText = vm.Model;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                var sorting = GetSortInfo(dgvTexts);

                _repository.UpdateCustomText(frm.CustomText);
                bsTexts.ResetBindings(false);

                CalculateCustomText(vm);

                TrySetSortInfo(dgvTexts, sorting);
            }
        }
Ejemplo n.º 2
0
        private void cmdNew_Click(object sender, EventArgs e)
        {
            var frm = new CustomTextEditor(_repository);

            frm.CustomText = new CustomText {
                is_header = true
            };
            if (frm.ShowDialog() == DialogResult.OK)
            {
                var sorting = GetSortInfo(dgvTexts);

                _repository.CreateCustomText(frm.CustomText);
                var vm = new CustomTextViewModel(frm.CustomText);

                CalculateCustomText(vm);

                bsTexts.Add(vm);
                bsTexts.ResetBindings(false);

                TrySetSortInfo(dgvTexts, sorting);
            }
        }