コード例 #1
0
        public string runMacro(string responseModel)
        {
            var  response = JsonConvert.DeserializeObject <ResponseModel>(responseModel);
            Guid macroID;

            if (Guid.TryParse(response.UniqueID, out macroID))
            {
                var foundMacro = StaticMacroList.ListOfMacros.FirstOrDefault(_ => _.UniqueID.Equals(macroID));
                if (foundMacro != null)
                {
                    var parameterModel = new List <object>();
                    foundMacro.ParameterList.ForEach(_ =>
                    {
                        var foundParameter = response.ParameterList.FirstOrDefault(p => p.ParamterName.Equals(_.ParameterName));
                        if (foundParameter == null)
                        {
                            parameterModel.Add(_.DefaultValue);
                        }
                        else
                        {
                            parameterModel.Add(foundParameter.ParameterValue.ParseToType(_.Type));
                        }
                    });

                    return(CatiaService.RunMacro(foundMacro.DirectoryName, foundMacro.FileName, parameterModel));
                }
            }
            return($"Macro ID is in incorrect format! MacroID: {response.UniqueID}");
        }
コード例 #2
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     CatiaService.InitializeCatia();
     mainWinVM = new MainWinVM();
     GetTreeData(mainWinVM);
     DataContext = mainWinVM;
 }
コード例 #3
0
 public bool IsCatiaStarted()
 {
     if (!CatiaService.CatiaExists())
     {
         return(CatiaService.InitializeCatia());
     }
     return(CatiaService.CatiaExists());
 }