Beispiel #1
0
        public static ExternalCommand CreateByCfg(string cfgText)
        {
            ExternalCommand rz = new ExternalCommand();

            rz.ApplyCfg(cfgText);
            return(rz);
        }
        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);
                }
            }
        }
Beispiel #3
0
        ExternalCommand CreateXCmd(string code, string config)
        {
            ExternalCommand xcmd;

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