private void SetDefaultParams(SystemDefinition systemDefinition, ConfigSystemDefinitionParamDefault[] paramsDefaults) { foreach (var paramDef in paramsDefaults) { systemDefinition.SystemParams.Get(paramDef.Param).ValueString = paramDef.Value; } }
public string GetTargetIP() { ThrowExceptionIfVeriStandIsNotLaunched(); ThrowExceptionIfProjectIsNotOpened(); //SystemState state; string sysdef; //string[] targetsArray; //WorkSpace.GetSystemState(out state, out sysdef, out targetsArray); SystemDefinition projDef = new SystemDefinition(this.projectPath); BaseNode[] projBaseNode = projDef.Root.FindChildrenByGUID("3a41ca74-36ec-4aff-9219-9d05c8f91208"); string projDirectoryName = Path.GetDirectoryName(this.projectPath); sysdef = projDirectoryName + "\\" + projBaseNode[0].Name; string value = ""; SystemDefinition sysDef = new SystemDefinition(sysdef); Targets targets = sysDef.Root.GetTargets(); Target target = targets.GetTargetList()[0]; value = target.IPAddress; //ErrChk(this.WorkSpace.GetSingleChannelValue(channelIdentidier, out value)); return(value); }
public SystemDefinition Get(ConfigSystemDefinition config) { SystemDefinition res = CreateObject(ClassesLoader.FindType(config.ClassLibrary, config.ClassName)); SetDefaultParams(res, config.ParamsDefaults); return(res); }
private void btnSimLoadDefinition_Click(object sender, EventArgs e) { ConfigSystemDefinition config = (ConfigSystemDefinition)cbSystemChoice.SelectedItem; _currentSimSystemDef = _systemDefinitionFactory.Get(config); lblSimSystemName.Text = config.Description; paramsSim.LoadParams(_currentSimSystemDef.SystemParams); }
private void InitializeListBox(string _sysDefPath) { currentSysDef = new SystemDefinition(StringUtilities.unparseFilePathString(_sysDefPath)); switch (channelType) { case ChannelType.faultChannel: loggingChannelSelection.DisplayFilter = ISystemDefinitionBrowserFilterType.K_CHAN_FAULT; loggingChannelSelection.StartNode = currentSysDef.Root.BaseNodeType; break; case ChannelType.readableChannel: loggingChannelSelection.DisplayFilter = ISystemDefinitionBrowserFilterType.K_CHAN_R; loggingChannelSelection.StartNode = currentSysDef.Root.BaseNodeType; break; case ChannelType.writableChannel: loggingChannelSelection.DisplayFilter = ISystemDefinitionBrowserFilterType.K_CHAN_W; loggingChannelSelection.StartNode = currentSysDef.Root.BaseNodeType; break; case ChannelType.paramChannel: loggingChannelSelection.DisplayFilter = ISystemDefinitionBrowserFilterType.K_ALL; loggingChannelSelection.StartNode = currentSysDef.Root.BaseNodeType; break; } //Check to see if Step.Veristand.ChannelPath[] not empty. //We should not attempt to initialize the TreeALiasBrowserWF with an empty set of ChannelPaths. if (channelNamesListOld.Count > 0) { Root currentSysDefRoot = currentSysDef.Root; currentSysDefRoot.FindNodeByPath(channelNamesListOld.ElementAt(0), out baseNodeElement); if (baseNodeElement != null) { if (baseNodeArray.Length == channelNamesListOld.Count) { for (int i = 0; i < channelNamesListOld.Count; i++) { currentSysDefRoot.FindNodeByPath(channelNamesListOld.ElementAt(i), out baseNodeElement); baseNodeArray[i] = baseNodeElement.BaseNodeType; } } else { Array.Resize(ref baseNodeArray, channelNamesListOld.Count); for (int i = 0; i < channelNamesListOld.Count; i++) { currentSysDefRoot.FindNodeByPath(channelNamesListOld.ElementAt(i), out baseNodeElement); baseNodeArray[i] = baseNodeElement.BaseNodeType; } } this._aliasBrowser.SetCheckBoxSelections(baseNodeArray); this._treeView.SetCheckBoxSelections(baseNodeArray); } } }
private void InitializeListBox(string _sysDefPath) { currentSysDef = new SystemDefinition(StringUtilities.unparseFilePathString(_sysDefPath)); channel_browser.StartNode = currentSysDef.Root.BaseNodeType; BaseNode highlightedNode; if (currentSysDef.Root.FindNodeByPath(StringUtilities.removeDoubleQuotesAroundString(AlarmListFullPath), out highlightedNode)) { BaseNodeType[] bnArray = { highlightedNode.BaseNodeType }; channel_browser.SetCurrentSelections(bnArray); } }
public VSChannelBrowserTest() { InitializeComponent(); SystemDefinition sysDef = new SystemDefinition("C:\\Users\\kfort\\Desktop\\2011 chan test.nivssdf"); // TreeBrowserWF treeBrowser = new TreeBrowserWF(); // treeBrowser.Size = new Size(70, 70); // treeBrowser.Anchor = AnchorStyles.Top; treeBrowserWF1.StartNode = sysDef.Root.BaseNodeType; // treeBrowser.Visible = true; // treeBrowser.Show(); }
private void InitializeListBox(string _sysDefPath, string _selectedTarget) { SystemDefinition _currentSysDef = new SystemDefinition(StringUtilities.unparseFilePathString(_sysDefPath)); TravNdMatchNodeTypeFilter targetFilter = new TravNdMatchNodeTypeFilter(NodeType.K_TARGET); targetBrowser.SetSystemDefinitionDisplayFilter(ISystemDefinitionBrowserFilterType.K_CUSTOM, targetFilter); targetBrowser.StartNode = _currentSysDef.Root.BaseNodeType; //Check to see if selected target is empty. //We should not attempt to initialize the TreeALiasBrowserWF with an empty target path. if (_selectedTarget != "") { BaseNode startNode; _currentSysDef.Root.GetTargets().FindFirstChildWithName(_selectedTarget, out startNode, true); targetBrowser.SetCurrentSelections(new BaseNodeType[] { startNode.BaseNodeType }); } }
public void Run(SystemDefinition systemDefinition, SystemState systemState, DateTime tsFrom, DateTime tsTo) { systemDefinition.Prepare(); SystemProcessor processor = new SystemProcessor( _dataProvider, _dataLoader, systemDefinition.DataDefinitionProvider, systemDefinition.SignalGeneratorOnOpen, systemDefinition.SignalGeneratorOnClose, systemDefinition.Commission, systemDefinition.Slippage, systemDefinition.MMPositionCloseCalculator); processor.Process(systemState, tsFrom, tsTo); }
public void Broadcasts_RegistersABroadcasterWithTheGivenInterface() { ISystemDefinition subsystem = new SystemDefinition(); subsystem.Broadcasts<IListener>(); Reciever reciever = new Reciever(); subsystem.HasInstance(reciever).ListensTo<IListener>(); subsystem.HasSingleton<Sender>().Provides<ISender>(); ISender sender = subsystem.Get<ISender>(); sender.SendMessage(2); sender.SendMessage(4); Assert.AreEqual(2, reciever.recieved[0]); Assert.AreEqual(4, reciever.recieved[1]); }
private void InitializeListBox(string _sysDefPath) { currentSysDef = new SystemDefinition(StringUtilities.unparseFilePathString(_sysDefPath)); BaseNode highlightedNode; switch (channelType) { case ChannelType.faultChannel: channel_browser.DisplayFilter = ISystemDefinitionBrowserFilterType.K_CHAN_FAULT; channel_browser.StartNode = currentSysDef.Root.BaseNodeType; break; case ChannelType.readableChannel: channel_browser.DisplayFilter = ISystemDefinitionBrowserFilterType.K_CHAN_R; channel_browser.StartNode = currentSysDef.Root.BaseNodeType; break; case ChannelType.writableChannel: channel_browser.DisplayFilter = ISystemDefinitionBrowserFilterType.K_CHAN_W; channel_browser.StartNode = currentSysDef.Root.BaseNodeType; break; case ChannelType.paramChannel: channel_browser.DisplayFilter = ISystemDefinitionBrowserFilterType.K_ALL; channel_browser.StartNode = currentSysDef.Root.BaseNodeType; break; } if (channelType == ChannelType.paramChannel) { if (currentSysDef.Root.FindNodeByPath(StringUtilities.removeDoubleQuotesAroundString(ModelListFullPath), out highlightedNode)) { BaseNodeType[] bnArray = { highlightedNode.BaseNodeType }; channel_browser.SetCurrentSelections(bnArray); } } else { if (currentSysDef.Root.FindNodeByPath(StringUtilities.removeDoubleQuotesAroundString(selectedChannelName), out highlightedNode)) { BaseNodeType[] bnArray = { highlightedNode.BaseNodeType }; channel_browser.SetCurrentSelections(bnArray); } } }
public void Broadcasts_RegistersABroadcasterWithTheGivenInterface_AndCanBeListenedToWithinSubsystems() { ISystemDefinition subsystem = new SystemDefinition(); subsystem.Broadcasts<IListener>(); Reciever reciever = new Reciever(); subsystem.HasSubsystem( new DelegateExecutingBuilder( delegate(ISystemDefinition scope) { scope.HasInstance(reciever).ListensTo<IListener>(); })); subsystem.HasSingleton<Sender>().Provides<ISender>(); ISender sender = subsystem.Get<ISender>(); sender.SendMessage(2); sender.SendMessage(4); Assert.AreEqual(2, reciever.recieved[0]); Assert.AreEqual(4, reciever.recieved[1]); }
public SelectSingleChannelPanelNumLimit(ConfigureRTSequenceNumericLimit CallingForm) { InitializeComponent(); CallingFormGlobal = CallingForm; currentSysDef = CallingFormGlobal.currentSysDef; treeAliasBrowserWF1.DisplayFilter = ISystemDefinitionBrowserFilterType.K_ALL; //ChannelType.paramChannel try { treeAliasBrowserWF1.StartNode = currentSysDef.Root.BaseNodeType; } catch (System.ArgumentException ex) { //Do Nothing } catch (System.NullReferenceException ex) { //Do Nothing } }
TreeNodeCollection InitializeListBox(string systemDefinitionPath) //Fill the list box with all the possible channel selections { SystemDefinition sysDef = new SystemDefinition(systemDefinitionPath); ArrayList channelNames = new ArrayList(); string nodeName = ""; TreeNode nodeToAdd; BaseNode[] rootChildren = sysDef.Root.GetChildren(); channelNames = GetChannels(rootChildren, channelNames); foreach (string channelName in channelNames) { nodeToAdd = new TreeNode(channelName); nodeToAdd.Name = channelName; if (this.ChannelSelection.Nodes.Find(channelName, true).Length == 0) { this.ChannelSelection.Nodes.Add(nodeToAdd); } } return(this.ChannelSelection.Nodes); }
public void ApplicationScopeObjects_MembersAreNotSerialized() { ISystemDefinition writeTimeSystem = new SystemDefinition(); var writeTimeAdapter = new NDependencyInjectAdapter(writeTimeSystem); writeTimeSystem.HasInstance(new ClassB(1234)) .Provides<IClassB>(); var writeObject = new ClassA(writeTimeSystem.Get<IClassB>()); var xmlText = SerializeAsXml(writeObject, writeTimeAdapter); Assert.IsFalse(xmlText.Contains("1234")); ISystemDefinition readTimeSystem = new SystemDefinition(); var readTimeAdapter = new NDependencyInjectAdapter(readTimeSystem); var readTimeAppObject = new ClassB(3); readTimeSystem.HasInstance(readTimeAppObject) .Provides<IClassB>(); var readObject = ReadXmlText<ClassA>(xmlText, readTimeAdapter, null, null); Assert.AreSame(readTimeAppObject, readObject.Value); Assert.AreEqual(3, readObject.Value.ValueA); }
public void ApplicationScopeObjects_MembersAreNotSerialized() { ISystemDefinition writeTimeSystem = new SystemDefinition(); var writeTimeAdapter = new NDependencyInjectAdapter(writeTimeSystem); writeTimeSystem.HasInstance(new ClassB(1234)) .Provides <IClassB>(); var writeObject = new ClassA(writeTimeSystem.Get <IClassB>()); var xmlText = SerializeAsXml(writeObject, writeTimeAdapter); Assert.IsFalse(xmlText.Contains("1234")); ISystemDefinition readTimeSystem = new SystemDefinition(); var readTimeAdapter = new NDependencyInjectAdapter(readTimeSystem); var readTimeAppObject = new ClassB(3); readTimeSystem.HasInstance(readTimeAppObject) .Provides <IClassB>(); var readObject = ReadXmlText <ClassA>(xmlText, readTimeAdapter, null, null); Assert.AreSame(readTimeAppObject, readObject.Value); Assert.AreEqual(3, readObject.Value.ValueA); }
public double GetTargetRate() { ThrowExceptionIfVeriStandIsNotLaunched(); ThrowExceptionIfProjectIsNotOpened(); SystemState state; string sysdef; string[] targetsArray; WorkSpace.GetSystemState(out state, out sysdef, out targetsArray); double value = double.NaN; SystemDefinition sysDef = new SystemDefinition(sysdef); Targets targets = sysDef.Root.GetTargets(); Target target = targets.GetTargetList()[0]; value = target.TargetRate; //ErrChk(this.WorkSpace.GetSingleChannelValue(channelIdentidier, out value)); return(value); }
public void Run() { ISystemDefinition system = new SystemDefinition(); system.Broadcasts<IIncidentsListener>(); system.Broadcasts<IIncidentChangeListener>(); system.HasInstance(new NoeticTools.DotNetWrappers.Timer(new Timer())).Provides<ITimer>(); system.HasSingleton<Scheduler>() .Provides<IScheduler>(); system.HasSingleton<ScheduledEventFactory>() .Provides<IScheduledEventFactory>(); system.HasSingleton<ImageResources>() .Provides<IImageResources>(); system.HasInstance(new List<IPluginBuilder>()) .Provides<List<IPluginBuilder>>(); system.HasSubsystem(new IncidentsBuilder()) .Provides<IIncidents>(); string title; if (!applicationOptions.Simulate) { system.HasSingleton<Clock>() .Provides<IClock>(); system.HasSingleton<HttpWebRequestFactory>() .Provides<IHttpWebRequestFactory>(); title = "VicFireReader"; } else { system.HasSubsystem(new SimulatorBuilder()) .Provides<ISimulatedClock>() .Provides<IClock>() .Provides<IHttpWebRequestFactory>(); title = "VicFireReader == SIMULATED =="; } system.HasSingleton<VicFireReaderSettings>() .Provides<VicFireReaderSettings>(); system.HasSingleton<CFADataSet>() .Provides<ICFADataSet>(); system.HasInstance(GetType().Assembly) .Provides<Assembly>(); system.HasSingleton<PersistenceService>() .Provides<IPersistenceService>(); system.HasSubsystem(new MainFormBuilder(title)) .Provides<Form>() .Provides<IPluginHost>() .Provides<OptionsViewPlugin>() .Provides<IMenuStrip>() .Provides<IToolStrip>() .Provides<IStatusStrip>(); system.Get<IPluginHost>().Register(new ToolStripMenuServicePlugIn(system.Get<IMenuStrip>())); system.Get<IPluginHost>().Register(new ToolBarServicePlugin(system.Get<IToolStrip>(), toolBarOdering)); system.Get<IPluginHost>().Register(new StatusStripPlugin(system.Get<IStatusStrip>())); system.Get<IPluginHost>().Register(system.Get<OptionsViewPlugin>()); system.HasSubsystem(new PluginsBuilder()) .Provides<IPlugin[]>(); system.Get<IPluginHost>().Register(system.Get<IPlugin[]>()); system.Get<IScheduler>().Start(); Application.Run(system.Get<Form>()); }
void InitializeDataGridView(string _sysDefPath, List <string> _channelNamesList, double[] _channelValuesArray, bool reset) { currentSysDef = new SystemDefinition(StringUtilities.unparseFilePathString(_sysDefPath)); Root currentSysDefRoot = currentSysDef.Root; //Check to see if Step.VeriStand.ChannelNames[] not empty. //We should not attempt to initialize the dataGridView1 with an empty set of ChannelNames. if (channelNamesList.Count == 0) { this.dataGridView1.Rows.Clear();//Empty the table this.noChannelsLabel.BringToFront(); this.noChannelsLabel.Visible = true; } if (channelNamesList.Count > 0 && reset) { this.dataGridView1.Rows.Clear();//Empty the table this.noChannelsLabel.Visible = false; currentSysDefRoot.FindNodeByPath(channelNamesList.ElementAt(0), out baseNodeElement); if (baseNodeElement != null) { if (baseNodeArray.Length == channelNamesList.Count) { for (int i = 0; i < channelNamesList.Count; i++) { currentSysDefRoot.FindNodeByPath(channelNamesList.ElementAt(i), out baseNodeElement); baseNodeArray[i] = baseNodeElement.BaseNodeType; if (baseNodeElement != null) { dataGridView1.Rows.Add(); dataGridView1[0, i].Value = channelNamesList.ElementAt(i); dataGridView1[1, i].Value = channelValuesArray[i]; } } } else { Array.Resize(ref baseNodeArray, channelNamesList.Count); for (int i = 0; i < channelNamesList.Count; i++) { currentSysDefRoot.FindNodeByPath(channelNamesList.ElementAt(i), out baseNodeElement); baseNodeArray[i] = baseNodeElement.BaseNodeType; if (baseNodeElement != null) { dataGridView1.Rows.Add(); dataGridView1[0, i].Value = channelNamesList.ElementAt(i); dataGridView1[1, i].Value = channelValuesArray[i]; } } } } } if (channelNamesList.Count > 0 && !reset) { this.dataGridView1.Rows.Clear(); this.noChannelsLabel.Visible = false; for (int i = 0; i < channelNamesList.Count; i++) { int foundIndex = channelNamesListOld.IndexOf(channelNamesList.ElementAt(i)); if (foundIndex >= 0) { channelValuesArray[i] = channelValuesArrayOld[foundIndex]; dataGridView1.Rows.Add(); dataGridView1[0, i].Value = channelNamesList.ElementAt(i); dataGridView1[1, i].Value = channelValuesArray[i]; } else { dataGridView1.Rows.Add(); dataGridView1[0, i].Value = channelNamesList.ElementAt(i); dataGridView1[1, i].Value = 0; } } } }
void InitializeTableView(string _sysDefPath, List <string> _channelNamesList, double[] _channelValuesArray) { this.tableLayoutPanel1.Controls.Clear();//Empty the table //Add in the column headers this.tableLayoutPanel1.Controls.Add(this.ChannelNamesTitle_label, 0, 0); this.tableLayoutPanel1.Controls.Add(this.ChannelValuesTitle_label, 1, 0); currentSysDef = new SystemDefinition(StringUtilities.unparseFilePathString(_sysDefPath)); //Check to see if Step.VeriStand.ChannelNames[] not empty. //We should not attempt to initialize the dataGridView1 with an empty set of ChannelNames. if (channelNamesList.Count == 0) { this.tableLayoutPanel1.RowCount = 1; this.noChannelsLabel.BringToFront(); this.noChannelsLabel.Visible = true; this.tableLayoutPanel1.AutoSize = true; System.Drawing.Size tableLayoutPanel1MinSize = new System.Drawing.Size(); tableLayoutPanel1MinSize.Height = 0; tableLayoutPanel1MinSize.Width = 0; this.tableLayoutPanel1.MinimumSize = tableLayoutPanel1MinSize; } if (channelNamesList.Count > 0) { //if (channelNamesList.Count <= 8) //{ this.noChannelsLabel.Visible = false; TableLayoutRowStyleCollection rowStyles = this.tableLayoutPanel1.RowStyles; foreach (RowStyle style in rowStyles) { if (style.SizeType == SizeType.Percent) { style.SizeType = SizeType.AutoSize; } } this.tableLayoutPanel1.AutoSize = true; System.Drawing.Size tableLayoutPanel1MinSize = new System.Drawing.Size(); tableLayoutPanel1MinSize.Height = 0; tableLayoutPanel1MinSize.Width = 0; this.tableLayoutPanel1.MinimumSize = tableLayoutPanel1MinSize; this.tableLayoutPanel1.RowCount = channelNamesList.Count + 1; //Need rows for the header and one row for each channel. for (int i = 0; i < channelNamesList.Count; i++) { Label currentChannelNameLabel = new System.Windows.Forms.Label(); currentChannelNameLabel.Text = channelNamesList.ElementAt(i); this.tableLayoutPanel1.Controls.Add(currentChannelNameLabel, 0, i + 1); currentChannelNameLabel.AutoSize = true; TextBox currentValueTextBox = new System.Windows.Forms.TextBox(); currentValueTextBox.Text = channelValuesArray.ElementAt(i).ToString(); this.tableLayoutPanel1.Controls.Add(currentValueTextBox, 1, i + 1); currentValueTextBox.Dock = DockStyle.Fill; //NumericUpDown currentValueNumUpDown = new System.Windows.Forms.NumericUpDown(); //currentValueNumUpDown.Value = (int)channelValuesArray.ElementAt(i); //this.tableLayoutPanel1.Controls.Add(currentValueNumUpDown, 1, i + 1); //currentValueNumUpDown.AutoSize = true; } Root currentSysDefRoot = currentSysDef.Root; currentSysDefRoot.FindNodeByPath(channelNamesList[0], out baseNodeElement); //} //else if (channelNamesList.Count > 8) //{ // this.noChannelsLabel.Visible = false; // this.tableLayoutPanel1.AutoSize = true; // TableLayoutRowStyleCollection rowStyles = this.tableLayoutPanel1.RowStyles; // foreach (RowStyle style in rowStyles) // { // if (style.SizeType == SizeType.Percent) // { // style.SizeType = SizeType.AutoSize; // } // } // this.tableLayoutPanel1.RowCount = channelNamesList.Count + 1; //Need rows for the header and one row for each channel. // for (int i = 0; i < channelNamesList.Count; i++) // { // Label currentChannelNameLabel = new System.Windows.Forms.Label(); // currentChannelNameLabel.Text = channelNamesList.ElementAt(i); // this.tableLayoutPanel1.Controls.Add(currentChannelNameLabel, 0, i + 1); // currentChannelNameLabel.AutoSize = true; // NumericUpDown currentValueNumUpDown = new System.Windows.Forms.NumericUpDown(); // currentValueNumUpDown.Value = (int)channelValuesArray.ElementAt(i); // this.tableLayoutPanel1.Controls.Add(currentValueNumUpDown, 1, i + 1); // currentValueNumUpDown.AutoSize = true; // } // Root currentSysDefRoot = currentSysDef.Root; // currentSysDefRoot.FindNodeByPath(channelNamesList[0], out baseNodeElement); //} } }
public ConfigureRTSequenceNumericLimit(SequenceContext _seqContext) { InitializeComponent(); returnParamDataType = ""; seqContext = _seqContext; seqContextPO = seqContext.AsPropertyObject(); selectedTSSequence = seqContext.SelectedSequences[0]; selectedTSStep = seqContext.SelectedSteps[0]; stepID = selectedTSStep.UniqueStepId; seqFile = selectedTSSequence.SequenceFile; permSeqContext = selectedTSSequence.Locals; propObjectFile = seqFile.AsPropertyObjectFile(); EvaluationTypes eval = seqContext.Engine.NewEvaluationTypes(); eval.PropertyValueTypeFlags = 0x4; //set string as the valid evaluation type FilePath.SetValidEvaluationTypes(eval); FilePath.Context = seqContextPO; EvaluationTypes evalNumeric = seqContext.Engine.NewEvaluationTypes(); VSDialogs vsdiag = new VSDialogs(); int timeoutValue = 0; stepPropertyObject = selectedTSSequence.GetStepByUniqueId(stepID).AsPropertyObject(); //Get old values if they exist try { timeoutValue = (int)stepPropertyObject.GetValNumber("Veristand.Timeout", 0); target = stepPropertyObject.GetValString("Veristand.Target", 0); sequenceFileExp = stepPropertyObject.GetValString("Veristand.SequenceFilePath", 0); parameterValuesArray = StringUtilities.expressionArrayToStringArray(stepPropertyObject.GetValVariant("Veristand.ParamValuesArray", 0)); parameterTypesArray = StringUtilities.expressionArrayToStringArray(stepPropertyObject.GetValVariant("Veristand.ParamTypesArray", 0)); parameterNamesArray = StringUtilities.expressionArrayToStringArray(stepPropertyObject.GetValVariant("Veristand.ParamNamesArray", 0)); sysDefPath = seqContext.SequenceFile.FileGlobalsDefaultValues.GetValString("Veristand.SystemDefinitionPath", 1); seqContext.SequenceFile.FileGlobalsDefaultValues.SetFlags("Veristand.SystemDefinitionPath", 0, 0x4400000); if (sysDefPath != null && sysDefPath != "") { try { currentSysDef = new SystemDefinition(StringUtilities.unparseFilePathString(sysDefPath)); } catch (System.ArgumentException ex) { //Do Nothing } } try { this.Timeout.Value = timeoutValue; this.targetString.Text = target; EventHandler handler = new EventHandler(this.FilePath_TextChanged); /* Disable FilePath_TextChanged event. We need to disable the FilePath_TextChanged event * because when the dialog is launching, the System Definition Path variable from TestStand will * be populated to the FilePath control. Once it is populated, the FilePath control's event will fire, * thus it will try to reload the table. We don't want the table to load twice every time the dialog is launched. */ this.FilePath.Change -= handler; // Change the File Path this.FilePath.Text = sequenceFileExp; // Re-enable FilePath_TextChanged event this.FilePath.Change += handler; //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the TreeAliasBrowserWF. if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sequenceFileExp)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sequenceFileExp)) == ".nivsseq") { //File exists with correct extension so try and populate the tree InitializeTableView(_seqContext, sequenceFileExp, parameterValuesArray, parameterTypesArray, false); //Initialize the data grid with the previously selected data } ////If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath. else //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath))) { //Clear the grid InitializeTableView(_seqContext, "", parameterValuesArray, parameterTypesArray, true); } } catch (System.ArgumentException ex) { //Intentially do nothing } catch (IndexOutOfRangeException ex) { //no sequences, don't need to initialize the data grid } } catch (System.Runtime.InteropServices.COMException ex) { //Variables are not already created in TestStand. They will be created later vsdiag.ShowWarningDialog(ex.Message + "------" + ex.StackTrace); sequenceFileExp = ""; this.FilePath.Text = sequenceFileExp; } }
public void Run() { ISystemDefinition system = new SystemDefinition(); system.Broadcasts <IIncidentsListener>(); system.Broadcasts <IIncidentChangeListener>(); system.HasInstance(new NoeticTools.DotNetWrappers.Timer(new Timer())).Provides <ITimer>(); system.HasSingleton <Scheduler>() .Provides <IScheduler>(); system.HasSingleton <ScheduledEventFactory>() .Provides <IScheduledEventFactory>(); system.HasSingleton <ImageResources>() .Provides <IImageResources>(); system.HasInstance(new List <IPluginBuilder>()) .Provides <List <IPluginBuilder> >(); system.HasSubsystem(new IncidentsBuilder()) .Provides <IIncidents>(); string title; if (!applicationOptions.Simulate) { system.HasSingleton <Clock>() .Provides <IClock>(); system.HasSingleton <HttpWebRequestFactory>() .Provides <IHttpWebRequestFactory>(); title = "VicFireReader"; } else { system.HasSubsystem(new SimulatorBuilder()) .Provides <ISimulatedClock>() .Provides <IClock>() .Provides <IHttpWebRequestFactory>(); title = "VicFireReader == SIMULATED =="; } system.HasSingleton <VicFireReaderSettings>() .Provides <VicFireReaderSettings>(); system.HasSingleton <CFADataSet>() .Provides <ICFADataSet>(); system.HasInstance(GetType().Assembly) .Provides <Assembly>(); system.HasSingleton <PersistenceService>() .Provides <IPersistenceService>(); system.HasSubsystem(new MainFormBuilder(title)) .Provides <Form>() .Provides <IPluginHost>() .Provides <OptionsViewPlugin>() .Provides <IMenuStrip>() .Provides <IToolStrip>() .Provides <IStatusStrip>(); system.Get <IPluginHost>().Register(new ToolStripMenuServicePlugIn(system.Get <IMenuStrip>())); system.Get <IPluginHost>().Register(new ToolBarServicePlugin(system.Get <IToolStrip>(), toolBarOdering)); system.Get <IPluginHost>().Register(new StatusStripPlugin(system.Get <IStatusStrip>())); system.Get <IPluginHost>().Register(system.Get <OptionsViewPlugin>()); system.HasSubsystem(new PluginsBuilder()) .Provides <IPlugin[]>(); system.Get <IPluginHost>().Register(system.Get <IPlugin[]>()); system.Get <IScheduler>().Start(); Application.Run(system.Get <Form>()); }
public void Get_ReturnsACollectionConstructedFromTheProvidersOfThatType_WhenThereIsMoreThanOneProvider() { ISystemDefinition book = new SystemDefinition(); book.HasCollection(new DelegateExecutingBuilder(Page1), new DelegateExecutingBuilder(Page2)).Provides <Page[]>(); Assert.AreEqual(2, book.Get<Page[]>().Length); }