Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 public SingleConfigViewModel()
 {
     ShearGridCollection = new AllShearViewModel();
 }