public void ExecuteFileName(object sender, EventArgs eventArgs)
            {
                var document = _document;
                var fileName = _fileName;

                try
                {
                    if (_isScript)
                    {
                        // Set the script location/execution path
                        BooUtil.ExecuteBooScript(_actionsGraph, fileName);
                    }
                    else
                    {
                        BooUtil.ExecuteBooProgram(_actionsGraph, fileName);
                    }
                }
                catch (Exception ex)
                {
                    Ensure.IsTrue(false, "Error executing file: " + fileName + " Exception: " + ex.Message);
                }
                _remote.IncrementProgress(fileName);
                try
                {
                    document.Undo();
                }
                catch (Exception ex)
                {
                    Ensure.IsTrue(false, "Error on undo file: " + fileName + " Exception: " + ex.Message);
                }
            }
Exemplo n.º 2
0
        private void ExecuteBooScript(string script)
        {
            var isScript = _isScriptCheckBox.IsChecked ?? false;
            var context  = BooUtil.GetCompilerContext(script, isScript);

            foreach (var error in context.Errors)
            {
                NaroMessage.Show(error.ToString());
            }
            if (context.Errors.Count != 0)
            {
                return;
            }
            var assembly = context.GeneratedAssembly;

            Ensure.IsNotNull(assembly);
            var currentGraph = GetCurrentActionGraph(_actionsGraph);

            if (!isScript)
            {
                BooUtil.ExecuteBooProgram("Script", context, currentGraph);
            }
            else
            {
                BooUtil.ExecuteBooScript("Script", context, currentGraph);
                currentGraph[InputNames.View].Send(NotificationNames.RefreshView);
                currentGraph[InputNames.UiElementsItem].Send(NotificationNames.RebuildTreeView);
            }
        }
Exemplo n.º 3
0
        public static void ExecuteDirectory(string directoryName, ActionsGraph actionsGraph)
        {
            var sortedFileNames = GetBooFileList(directoryName);
            var document        =
                actionsGraph.InputContainer[InputNames.Document].GetData(NotificationNames.GetValue).Get <Document>();

            foreach (var fileName in sortedFileNames)
            {
                try
                {
                    // Set the script location/execution path
                    BooUtil.ExecuteBooScript(actionsGraph, fileName);
                }
                catch (Exception ex)
                {
                    Assert.IsTrue(false, "Error executing file: " + fileName + " Exception: " + ex.Message);
                }
                try
                {
                    document.Undo();
                }
                catch (Exception ex)
                {
                    Assert.IsTrue(false, "Error on undo file: " + fileName + " Exception: " + ex.Message);
                }
            }
        }