예제 #1
0
        void AddExternalCommands(ObservableCollection <CommandVModel> cmdVms)
        {
            ExternalCommand xcmd;
            XCmdHelper      xh;
            RelayCommand    rcmd;

            foreach (var xci in (from ci in AppContext.Current.EnumerateAppCfgItems((k) => k.StartsWith("xcmd:")) orderby ci.Code select ci))
            {
                try {
                    xcmd = ExternalCommand.CreateByCfg(xci.Value);
                    xh   = new XCmdHelper()
                    {
                        Parent = this, XCmd = xcmd
                    };
                    rcmd = new RelayCommand(UIOperations.Undefined, xh.Execute);
                    cmdVms.Add(new CommandVModel(rcmd)
                    {
                        Name = xcmd.Title, Description = xcmd.Description
                    });
                }
                catch (Exception x) {
                    AppContext.Current.LogTechError(x.ToShortMsg("Initialize External command"), x);
                    this.Status.SetError(x.Message);
                }
            }
        }
예제 #2
0
        ExternalCommand CreateXCmd(string code, string config)
        {
            ExternalCommand xcmd;

            xcmd      = ExternalCommand.CreateByCfg(config);
            xcmd.Code = code;
            return(xcmd);
        }