void RunProcessing() { BackgroundWorker worker = new BackgroundWorker(); WindDirectionComposite wdcomposite = new WindDirectionComposite(ColumnCollection, DownloadedData[0]); WindSpeedComposite wscomposite = new WindSpeedComposite(_sessionColumnCollection, DownloadedData[0]); wscomposite.CompletedWindSpeedCompositeValues += new WindSpeedComposite.ProgressEventHandler(UpdateCompCollection); try { worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e) { FileProgressText = ""; }; worker.DoWork += delegate(object s, DoWorkEventArgs args) { try { IsProcessing = true; if (!WDCompositeExists) { wdcomposite.NewCompositeColumnAdded += new WindDirectionComposite.ProgressEventHandler(repository_UpdateProgress); if (wdcomposite.CalculateComposites()) { WDCompositeExists = true; ColumnCollection.Columns = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns.ToList()); } else { WDCompositeExists = false; System.Windows.MessageBox.Show("There was an error calculating WD Composites."); } } wdcomposite.CompletedWindDirectionCompositeValues += new WindDirectionComposite.ProgressEventHandler(repository_UpdateProgress); wscomposite.CompletedWindSpeedCompositeValues += new WindSpeedComposite.ProgressEventHandler(repository_UpdateProgress); if (!WSCompositeExists) { wscomposite.DeterminingWindSpeedCompositeValues += new WindSpeedComposite.ProgressEventHandler(repository_UpdateProgress); if (wscomposite.CalculateComposites()) { WSCompositeExists = true; ColumnCollection.Columns = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns.ToList()); } else { WSCompositeExists = false; System.Windows.MessageBox.Show("There was an error calculating WS Composites"); } } IsProcessing = false; } finally { IsProcessing = false; } }; worker.RunWorkerAsync(); } catch { throw; } }
void RunProcessing() { BackgroundWorker worker = new BackgroundWorker(); WindDirectionComposite wdcomposite = new WindDirectionComposite(_sessionColumnCollection, data); WindSpeedComposite wscomposite = new WindSpeedComposite(_sessionColumnCollection, data); //SoundPlayer sp = new SoundPlayer("Careless_whisper_(Wham).wav"); try { worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e) { MessageBox.Show("Done Processing!"); //sp.Stop(); }; worker.DoWork += delegate(object s, DoWorkEventArgs args) { try { IsProcessing = true; //sp.Play(); if (!DoNotRunComps) { wdcomposite.NewCompositeColumnAdded += new WindDirectionComposite.ProgressEventHandler(repository_UpdateProgress); if (wdcomposite.CalculateComposites()) { LiveCollection = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns); } wdcomposite.CompletedWindDirectionCompositeValues += new WindDirectionComposite.ProgressEventHandler(repository_UpdateProgress); wscomposite.DeterminingWindSpeedCompositeValues += new WindSpeedComposite.ProgressEventHandler(repository_UpdateProgress); if (wscomposite.CalculateComposites()) { LiveCollection = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns); } wscomposite.CompletedWindSpeedCompositeValues += new WindSpeedComposite.ProgressEventHandler(repository_UpdateProgress); } else { //set all the Ws sensors to comps foreach (SessionColumn sc in _sessionColumnCollection.Columns) { if (sc.ColumnType == SessionColumnType.WSAvg) { sc.IsComposite = true; } if (sc.ColumnType == SessionColumnType.WDAvg) { sc.ColName = "WDAvgComposite"; sc.IsComposite = true; } } } MonthbyHourShear Shear = new MonthbyHourShear(_sessionColumnCollection, data.AsDataView()); foreach (double height in _heightToShearToList) { Shear.Xaxis = new MonthAxis(); Shear.Yaxis = new HourAxis(); Shear.AddingShearValues += new MonthbyHourShear.ProgressEventHandler(repository_UpdateProgress); Shear.CalculateWindSpeed(height, out _ogrid); LiveCollection = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns); } Shear.AddedShearValues += new MonthbyHourShear.ProgressEventHandler(repository_UpdateProgress); IsProcessing = false; } finally { IsProcessing = false; } }; worker.RunWorkerAsync(); } catch (Exception e) { throw e; } }
void RunProcessing() { BackgroundWorker worker = new BackgroundWorker(); WindDirectionComposite wdcomposite = new WindDirectionComposite(_sessionColumnCollection, data); WindSpeedComposite wscomposite = new WindSpeedComposite(_sessionColumnCollection, data); MonthbyHourShear Shear = new MonthbyHourShear(_sessionColumnCollection, data.AsDataView()); Shear.Xaxis = new MonthAxis(); Shear.Yaxis = new HourAxis(); try { worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e) { MessageBox.Show("Done Processing!"); }; worker.DoWork += delegate(object s, DoWorkEventArgs args) { try { IsProcessing = true; if (!WDCompositeExists) { wdcomposite.NewCompositeColumnAdded += new WindDirectionComposite.ProgressEventHandler(repository_UpdateProgress); if (wdcomposite.CalculateComposites()) { WDCompositeExists = true; ColumnCollection.Columns = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns.ToList()); } else { WDCompositeExists = false; } } wdcomposite.CompletedWindDirectionCompositeValues += new WindDirectionComposite.ProgressEventHandler(repository_UpdateProgress); if (!WSCompositeExists) { wscomposite.DeterminingWindSpeedCompositeValues += new WindSpeedComposite.ProgressEventHandler(repository_UpdateProgress); if (wscomposite.CalculateComposites()) { WSCompositeExists = true; ColumnCollection.Columns = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns.ToList()); } else { WSCompositeExists = false; } } wscomposite.CompletedWindSpeedCompositeValues += new WindSpeedComposite.ProgressEventHandler(repository_UpdateProgress); if (HeightToShearTo > 0) { Shear.AddingShearValues += new MonthbyHourShear.ProgressEventHandler(repository_UpdateProgress); ShearCalculationGridCollection _ogrid; Shear.CalculateWindSpeed(HeightToShearTo, out _ogrid); ShearGridCollection.Add(new ShearGridViewModel(_ogrid, "generic grid")); ColumnCollection.Columns = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns.ToList()); } Shear.AddedShearValues += new MonthbyHourShear.ProgressEventHandler(repository_UpdateProgress); IsProcessing = false; } finally { IsProcessing = false; } }; worker.RunWorkerAsync(); } catch (Exception e) { throw; } }
void RunProcessing() { BackgroundWorker worker = new BackgroundWorker(); WindDirectionComposite wdcomposite = new WindDirectionComposite(ColumnCollection, DownloadedData[0]); WindSpeedComposite wscomposite = new WindSpeedComposite(_sessionColumnCollection, DownloadedData[0]); MonthbyHourShear Shear = new MonthbyHourShear(_sessionColumnCollection, DownloadedData[0].AsDataView()); Shear.Xaxis = new MonthAxis(); Shear.Yaxis = new HourAxis(); try { worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e) { FileProgressText = ""; }; worker.DoWork += delegate(object s, DoWorkEventArgs args) { try { IsProcessing = true; if (!WDCompositeExists) { wdcomposite.NewCompositeColumnAdded += new WindDirectionComposite.ProgressEventHandler(repository_UpdateProgress); if (wdcomposite.CalculateComposites()) { WDCompositeExists = true; ColumnCollection.Columns = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns.ToList()); } else { WDCompositeExists = false; } } wdcomposite.CompletedWindDirectionCompositeValues += new WindDirectionComposite.ProgressEventHandler(repository_UpdateProgress); if (!WSCompositeExists) { wscomposite.DeterminingWindSpeedCompositeValues += new WindSpeedComposite.ProgressEventHandler(repository_UpdateProgress); if (wscomposite.CalculateComposites()) { WSCompositeExists = true; ColumnCollection.Columns = new MultiThreadObservableCollection <ISessionColumn>(_sessionColumnCollection.Columns.ToList()); } else { WSCompositeExists = false; } } wscomposite.CompletedWindSpeedCompositeValues += new WindSpeedComposite.ProgressEventHandler(repository_UpdateProgress); IsProcessing = false; } finally { IsProcessing = false; } }; worker.RunWorkerAsync(); } catch (Exception e) { throw; } }