public void GetSummaryButton_Click(object sender, RoutedEventArgs e) { BatchSetupView.ShowLoadingBar(Visibility.Hidden); try { Measurements.Clear(); string machineName = this.GetDbMachineName(); string connectionString = this.GetEfConnectionString(); if (string.IsNullOrEmpty(connectionString)) { MessageBox.Show("no connection string"); return; } this.Measurements = new ObservableCollection <IdNamePairProcessItem>(); _machineName = machineName; _connectionString = connectionString; using (BusyCursor busyCursor = new BusyCursor()) { this.PopulateTree(); } //_backgroundWorker = new BackgroundWorker(); //_backgroundWorker.DoWork += new DoWorkEventHandler(backgroundWork_DoWork); //_backgroundWorker.WorkerReportsProgress = true; ////_backgroundWorker.WorkerSupportsCancellation = true; //_backgroundWorker.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker_ProgressChanged); //_backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker_RunWorkerCompleted); //_backgroundWorker.RunWorkerAsync(); } catch (Exception ex) { } }
private void PopulateTree() { try { _tempMeasurement.Clear(); IRawDataSummary service = ChannelFactoryUtility.CreateRawDataSummaryService(_machineName); List <IdNamePair> projects = service.GetProjectNames(_connectionString); //List<IdNamePair> projects = ChannelFactoryUtility.CallRawDataSummaryServer(proxy => proxy.GetProjectNames(connectionString)); foreach (var idNamePair in projects) { IdNamePairProcessItem pItem = new IdNamePairProcessItem() { Name = idNamePair.Id + " - " + idNamePair.Name, MeasurementId = idNamePair.Id, CrtDepthLevel = 1 //project level is 1 }; //_tempMeasurement.Add(pItem); this.Measurements.Add(pItem); List <IdNamePair> experiments = service.GetExperimentsNamesByProjectId((int)idNamePair.Id, _connectionString); //List<IdNamePair> experiments = ChannelFactoryUtility.CallRawDataSummaryServer(proxy => proxy.GetExperimentsNamesByProjectId((int)idNamePair.Id, connectionString)); foreach (var experiment in experiments) { IdNamePairProcessItem eItem = new IdNamePairProcessItem() { Name = experiment.Id + " - " + experiment.Name, MeasurementId = experiment.Id, CrtDepthLevel = 2 //experiment level is 2 }; pItem.Children.Add(eItem); List <IdNamePair> measurements = service.GetMeasurementNamesByExperimentId( (int)eItem.MeasurementId, _connectionString); //List<IdNamePair> measurements = ChannelFactoryUtility.CallRawDataSummaryServer(proxy => proxy.GetMeasurementNamesByExperimentId((int)eItem.MeasurementId, connectionString)); foreach (var measurement in measurements) { IdNamePairProcessItem mItem = new IdNamePairProcessItem() { Name = measurement.Id + " - " + measurement.Name, MeasurementId = measurement.Id, CrtDepthLevel = 3 //meaurement level is 3 }; eItem.Children.Add(mItem); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } BatchSetupView.ShowLoadingBar(Visibility.Hidden); }