void RunShear() { BackgroundWorker worker = new BackgroundWorker(); try { worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e) { MessageBox.Show("Done with Alpha"); }; worker.DoWork += delegate(object s, DoWorkEventArgs args) { try { IsProcessing = true; int upperCompidx = ColumnCollection.UpperWSComp(DataSetStartDate); int lowerCompidx = ColumnCollection.LowerWSComp(DataSetStartDate); ISessionColumn upperws = ColumnCollection[upperCompidx]; ISessionColumn lowerws = ColumnCollection[lowerCompidx]; AxisFactory factory = new AxisFactory(); IAxis Yaxis = factory.CreateAxis(AxisType.Hour); Yaxis.SessionColIndex = ColumnCollection.DateIndex; IAxis Xaxis = factory.CreateAxis(AxisType.Month); Xaxis.SessionColIndex = ColumnCollection.DateIndex; AlphaFactory afactory = new AlphaFactory(); ColumnCollection.AlphaCollection.Add(afactory.CreateAlpha(DownloadedData [0], upperws, lowerws, Xaxis, Yaxis)); ColumnCollection.AlphaCollection.ToList().ForEach(c => c.CalculateAlpha()); ObservableCollection <ShearGridViewModel> thisShearCollection = new ObservableCollection <ShearGridViewModel>(); foreach (Alpha a in ColumnCollection.AlphaCollection) { int i = 1; thisShearCollection.Add(new ShearGridViewModel(a, Xaxis.AxisType + " by " + Yaxis.AxisType)); i++; } //add sheargridviewmodels to allsheargridviewmodel ShearGridCollection = new AllShearViewModel(thisShearCollection); IsProcessing = false; } finally { IsProcessing = false; } }; worker.RunWorkerAsync(); } catch (Exception e) { throw; } }
IAxis GetAxis(AxisType type, double binwidth) { AxisFactory factory = new AxisFactory(); switch (type) { case AxisType.Month: { IAxis axis = factory.CreateAxis(AxisType.Month); axis.SessionColIndex = ColumnCollection.DateIndex; return(axis); } case AxisType.Hour: { IAxis axis = factory.CreateAxis(AxisType.Hour); axis.SessionColIndex = ColumnCollection.DateIndex; return(axis); } case AxisType.WD: { IAxis axis = factory.CreateAxis(binwidth); axis.SessionColIndex = ColumnCollection.WDComp(ColumnCollection.DataSetStart); return(axis); } case AxisType.WS: { int i = ColumnCollection.UpperWSComp(ColumnCollection.DataSetStart); IAxis axis = factory.CreateAxis(binwidth, ColumnCollection.Data.AsDataView(), i); axis.SessionColIndex = i; return(axis); } default: return(null); } }
public void InitializeTest() { IAxisFactory axisFactory = new AxisFactory(); IMazeViewDataFactory mazeViewDataFactory = new MazeViewDataFactory(); var settings = new DefaultSettings(); var nodeBuilder = new NodeBuilder(settings, new CoinBuilder(settings)); var randomizer = new Randomizer(); var nodeDataBuilder = new MazeNodeDataBuilder(new FakeMazeNodeDataBuilderSettings(3, 3), randomizer, nodeBuilder); IMazeNodeData nodeData = nodeDataBuilder.GenerateNodeData(12345); IMazeViewData viewData = nodeDataBuilder.GenerateViewData(nodeData, axisFactory, mazeViewDataFactory); var maze = new Maze(new UnitList(), new UnitFactory(randomizer)); maze.Initialize(nodeData, viewData); int numberOfNodesTotal = maze.NodeData.Count; int numberOfNodesView = maze.ViewData.MazeNodes.Count; int numberOfUnits = maze.UnitList.Count; Assert.Equal(1, numberOfUnits); Assert.Equal(9, numberOfNodesView); Assert.Equal(27, numberOfNodesTotal); }