Пример #1
0
        public void MouseDown(CommandProperty cp)
        {
            if (null != cp.Invoke)
            {
                cp.Invoke();
            }

            var form = Activator.CreateInstance(FormType);

            FormType.GetProperty(FormProperty).SetValue(form, cp.Data, null);

            var dlg = new PropertyDialog
            {
                DataContext = form,
                Title       = cp.LinkText,
                MinHeight   = 500
            };

            if (dlg.ShowDialog().Value)
            {
                if (null != cp.InvokeData)
                {
                    cp.InvokeData(form);
                }
            }
        }
Пример #2
0
        public void MouseDown(CommandProperty cp)
        {
            if (null != cp.Invoke)
            {
                cp.Invoke();
            }

            var list = cp.Data as IList;

            if (null == list)
            {
                return;
            }

            var form = Activator.CreateInstance(FormType);


            var dlg = new PropertyDialog
            {
                DataContext = form,
                Title       = cp.LinkText,
                MinHeight   = 500
            };

            if (dlg.ShowDialog().Value)
            {
                if (null != cp.InvokeData)
                {
                    cp.InvokeData(form);
                }

                var newItem = FormType.GetProperty(DataProperty).GetValue(form, null);

                list.Add(newItem);
            }
        }