예제 #1
0
        ListViewItem CreateItemFromVM(DynPreambleElementVM vm)
        {
            var ret = new ListViewItem()
            {
                Tag = vm
            };

            ret.SubItems.Add("");

            BindingFactory.CreateBinding(vm, "Name", v => { ret.Text = v.Name; }, () => ret.Text = "<Error>", false);
            BindingFactory.CreateBinding(vm, "Code", v => { ret.SubItems[1].Text = v.CodeOneLine; }, () => ret.SubItems[1].Text = "<Error>", false);
            ret.Checked = vm.IsActive;

            return(ret);
        }
예제 #2
0
        public static bool ShowDynPreambleDialog(IWin32Window owner, DynPreambleElementVM vm)
        {
            var dd = new DynPreambleDialog();

            dd.txtCode.Text = vm.Code;
            dd.txtName.Text = vm.Name;

            var res = dd.ShowDialog(owner);

            if (res == DialogResult.OK)
            {
                vm.Code = dd.txtCode.Text;
                vm.Name = dd.txtName.Text;
            }

            dd.Dispose();
            return(res == DialogResult.OK);
        }