예제 #1
0
 private void OutputTerminal_TextChanged(object sender, EventArgs e)
 {
     if (OutputTerminal.Text.Length > 0)
     {
         OutputTerminal.Select(OutputTerminal.Text.Length - 1, 0);
         OutputTerminal.ScrollToCaret();
     }
 }
예제 #2
0
 private bool TryGetHelpFromOutputTerminal(OutputTerminal outputTerminal, out HelpAttribute help)
 {
     help = Node?.GetType()
            .GetProperty(outputTerminal.Name)
            ?.GetCustomAttributes(typeof(HelpAttribute), true)
            .FirstOrDefault() as HelpAttribute;
     return(help is object);
 }
예제 #3
0
        public void SetUp()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;

            this.scriptingProxy = new Mock <IScriptingProxy>();
            this.openSessions   = new ReactiveList <ISession>();
            var avalonEditor = new TextEditor();

            this.outputTerminal       = new OutputTerminal();
            this.scriptPanelViewModel = new Mock <ScriptPanelViewModel>("header", this.scriptingProxy.Object, "*.lua", this.openSessions, true);
            this.scriptPanelViewModel.SetupProperty(x => x.AvalonEditor, avalonEditor);
            this.scriptPanelViewModel.SetupProperty(x => x.Caption, "header*");
        }
예제 #4
0
 public void terminalUpdate(string analysis_status)
 {
     if (analysis_status == "cancel")
     {
         OutputTerminal.Clear();
         OutputTerminal.AppendText("Analysis cancelled on " + Properties.Settings.Default.run);
     }
     else if (analysis_status == "error")
     {
         OutputTerminal.Clear();
         OutputTerminal.AppendText("Analysis error on " + Properties.Settings.Default.run);
     }
     else
     {
         OutputTerminal.Clear();
         OutputTerminal.AppendText("Analysis completed on " + Properties.Settings.Default.run);
     }
 }
예제 #5
0
        private void terminalThread_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = sender as BackgroundWorker;

            worker.ReportProgress(0);
            string stdout;

            while (!abort)
            {
                stdout = ssh.ReadResponse();
                OutputTerminal.BeginInvoke(new TerminalDelegate(redirectOutput), new string[] { stdout });
            }
            if (worker.CancellationPending)
            {
                e.Cancel = true;
            }
            stopWatch.Stop();
            worker.ReportProgress(100);
            EventComplete.Set();
        }
예제 #6
0
        public async Task SetUp()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;

            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();
            this.panelNavigationService       = new Mock <IPanelNavigationService>();
            this.dialogNavigationService      = new Mock <IDialogNavigationService>();

            this.assembler = new Assembler(this.uri);
            this.session   = new Mock <ISession>();
            this.session.Setup(x => x.Assembler).Returns(this.assembler);

            this.outputTerminal = new OutputTerminal();

            this.scriptViewModel = new Mock <IScriptPanelViewModel>();
            this.scriptViewModel.SetupGet(x => x.OutputTerminal).Returns(() => this.outputTerminal);
            this.scriptViewModel.SetupProperty(x => x.SelectedSession, session.Object);

            this.scriptingProxy = new ScriptingProxy(this.thingDialogNavigationService.Object, this.panelNavigationService.Object, this.dialogNavigationService.Object);
            this.scriptingProxy.ScriptingPanelViewModel = this.scriptViewModel.Object;

            // Creation of the elements that can be searched using a script
            this.engineeringModelSetup = new EngineeringModelSetup(Guid.NewGuid(), this.assembler.Cache, null)
            {
                Name      = "model",
                ShortName = "Train"
            };

            this.engineerModel = new EngineeringModel(Guid.NewGuid(), this.assembler.Cache, null)
            {
                EngineeringModelSetup = engineeringModelSetup
            };
            this.engineerModel.EngineeringModelSetup = this.engineeringModelSetup;

            this.iterationSetup = new IterationSetup(Guid.NewGuid(), this.assembler.Cache, this.uri);
            this.iteration      = new Iteration(Guid.NewGuid(), this.assembler.Cache, null)
            {
                IterationSetup = this.iterationSetup
            };
            this.iteration.IterationSetup = this.iterationSetup;

            this.elementDefinition = new ElementDefinition(Guid.NewGuid(), this.assembler.Cache, this.uri)
            {
                Name      = "element",
                ShortName = "Transformator"
            };

            this.mass = new SimpleQuantityKind(Guid.NewGuid(), null, this.uri)
            {
                Name      = "parameter",
                ShortName = "mass"
            };

            this.parameter = new Parameter(Guid.NewGuid(), this.assembler.Cache, null)
            {
                ParameterType = this.mass
            };

            this.parameterValueSet = new ParameterValueSet(Guid.NewGuid(), this.assembler.Cache, null)
            {
                Reference = new ValueArray <string>(new List <string> {
                    "100"
                }),
                Computed = new ValueArray <string>(new List <string> {
                    "-"
                }),
                Formula = new ValueArray <string>(new List <string> {
                    "-"
                }),
                ValueSwitch = ParameterSwitchKind.REFERENCE
            };

            this.engineerModel.Iteration.Add(this.iteration);
            this.iteration.Element.Add(this.elementDefinition);
            this.elementDefinition.Parameter.Add(this.parameter);
            this.parameter.ValueSet.Add(this.parameterValueSet);

            // Inclusion of the engineering model in the cache
            var testThing = new Lazy <Thing>(() => this.engineerModel);

            testThing.Value.Cache.TryAdd(new CacheKey(testThing.Value.Iid, null), testThing);
        }
예제 #7
0
 public TwoPinOutput()
 {
     this.Pin1 = new OutputTerminal(this.Pin1Query);
     this.Pin2 = new OutputTerminal(this.Pin2Query);
 }