Пример #1
0
        private void cmdOpenForm(string arg)
        {
            EditFormAttribute efa = DMT.Provider.UIMetaData.EditForms.Find(e => e.FormType != null && e.FormType.FullName == arg);
            if (efa != null)
            {
                ICinarForm form = null;
                if (efa.FormType.GetInterface("IEntityEditControl") != null)
                    form = new ListEntity((IEntityEditControl)Activator.CreateInstance(efa.FormType));
                else
                    form = (ICinarForm)Activator.CreateInstance(efa.FormType);
                (form as Form).Text = ((EditFormAttribute)cmdMan.LastSender.GetMemberValue("Tag")).DisplayName;

                CommandManager cmdManChild = new CommandManager();
                cmdManChild.Commands.AddRange(form.GetCommands());
                childCommandMans[form] = cmdManChild;
                (form as Form).WindowState = FormWindowState.Maximized;
                (form as Form).FormClosing += new FormClosingEventHandler(form_FormClosing);
                form.Initialize(cmdManChild);
                cmdManChild.SetCommandTriggers();
                (form as Form).MdiParent = this;
                (form as Form).Show();

                // add usage report
                try
                {
                    DMT.Provider.Db.Save(new UsageReport { UsageType1 = "OpenForm", UsageType2 = efa.FormType.Name, InsertUserId=DMT.Provider.ClientUser.Id });
                }
                catch
                {
                }
            }
        }
Пример #2
0
        protected override void OnLoad(EventArgs e)
        {
            CommandManager cmdMan = new CommandManager();
            cmdMan.Commands = new CommandCollection {
                 new Command(){
                                  Execute = cmdNextPage,
                                  Trigger = new CommandTrigger(){Control=btnNext},
                                  IsEnabled = () => gridView1.RowCount == PageSize
                              },
                 new Command(){
                                  Execute = cmdPrevPage,
                                  Trigger = new CommandTrigger(){Control=btnPrev},
                                  IsEnabled = () => pageNo>0
                              },
                 new Command(){
                                  Execute = cmdChangePageSize,
                                  Trigger = new CommandTrigger(){Control=cbPageSize, Event="SelectedIndexChanged"},
                              },
                 new Command(){
                                  Execute = cmdCloseOK,
                                  Trigger = new CommandTrigger(){Control=gridView1, Event="DoubleClick"},
                              },
                 new Command(){
                                  Execute = (arg)=>{pageNo=0; bindGrid();},
                                  Trigger = new CommandTrigger(){Control=editSearch, Event="EditValueChanged"},
                              },
            };
            cmdMan.SetCommandTriggers();

            if (string.IsNullOrEmpty(Text))
                Text = EntityType.Name + " seçiniz";

            bindGrid();
        }