Пример #1
0
 void UpdateFederationInfo()
 {
     _CurrentFederation = null;
     errorProviderFederationFile.SetError(textBoxFederationPath, "");
     string fn = textBoxFederationPath.Text;
     if (!System.IO.File.Exists(fn))
     {
         errorProviderFederationFile.SetError(textBoxFederationPath, "File not found");
         return;
     }
     BehaviorDebuggerApplication debuggerApplication = new BehaviorDebuggerApplication(fn);
     _CurrentFederation = new Federation(debuggerApplication);
     comboBoxTopic.Items.Clear();
     foreach (NamespaceManager namespaceManager in _CurrentFederation.NamespaceManagers)
     {
         foreach (TopicName tn in namespaceManager.AllTopics(ImportPolicy.DoNotIncludeImports))
         {
             comboBoxTopic.Items.Add(tn.ToString());
         }
     }
     if (comboBoxTopic.Items.Count > 0 && (comboBoxTopic.SelectedValue == null || (string)(comboBoxTopic.SelectedValue) == ""))
         comboBoxTopic.SelectedValue = comboBoxTopic.Items[0];
 }
Пример #2
0
        private void button3_Click(object sender, System.EventArgs e)
        {
            BehaviorDebuggerApplication debuggerApplication =
                new BehaviorDebuggerApplication(textBoxFederationPath.Text);
            Federation fed = new Federation(debuggerApplication);
            BehaviorInterpreter interpreter = new BehaviorInterpreter("Input Form", textBoxInput.Text, CurrentFederation, 1, this);

            ClearCacheView();

            if (Parse(interpreter) == null)
            {
                Fail("Unable to run; parse failed:" + interpreter.ErrorString);
                tabControl.SelectedTab = tabParser;
            }

            // Begin execution
            tabControl.SelectedTab = tabOutput;
            ExecutionContext ctx = new ExecutionContext(CurrentTopicContext);
            string final = null;
            if (!interpreter.EvaluateToPresentation(CurrentTopicContext, new ExternalReferencesMap()))
            {
                Fail(interpreter.ErrorString);
                return;
            }
            WikiOutput output = WikiOutput.ForFormat(OutputFormat.Testing, null);
            interpreter.Value.ToPresentation(this).OutputTo(output);
            final = output.ToString();
            Success(final);
        }