예제 #1
0
        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)
            {
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        //MessageCallbackHandler messageCallback = new MessageCallbackHandler();
        //private ServiceHost messageCallbackServiceHost;
        public Window1()
        {
            InitializeComponent();
            // this.listBox1.ItemsSource = RawFileViewModel.RawFiles;
            DataContext = this;

            //need to redesign in the future
            BatchSetupView.DataContext = MyDesigner.SelectionService.RawFileViewModel;
            BatchSetupView.SetViewModel(MyDesigner.SelectionService.RawFileViewModel);
            MyDesigner.SelectionService.RawFileViewModel.BatchSetupView = BatchSetupView;
            try
            {
                //MessagesFromServer = new ObservableCollection<string>();

                //ProgressCallbackService callbackService = new ProgressCallbackService(Dispatcher, false);

                //using (ChannelFactory<IProgressTrackingSubscrption> channelFactory =
                //        new ChannelFactory<IProgressTrackingSubscrption>("progressTrackingSubscription"))
                //{
                //    IProgressTrackingSubscrption progressTrackingSubscrption = channelFactory.CreateChannel();
                //    progressTrackingSubscrption.SubscribeToProgressEvents();

                //    ProgressMonitor = progressTrackingSubscrption.GetActiveWorkItemsStatus();
                //    callbackService.ProgressMonitor = ProgressMonitor;

                //    ProgressMonitor.Subscribe(this);
                //}

                //callbackServiceHost = new ServiceHost(callbackService);
                //callbackServiceHost.Open();

                //SetupProgressObserver();

                ////messageCallbackServiceHost = new ServiceHost(messageCallback);
                ////messageCallbackServiceHost.Open();
                ////messageCallback.MessageChanged += this.ProcessMessageChanged;

                App.Current.MainWindow = this;
            }
            catch (Exception)
            {
            }
        }
예제 #4
0
 public void AddConnectionToBatchSetupView(IEnumerable <XElement> connectionsXML)
 {
     BatchSetupView.AddConnectionsToCanvas(connectionsXML);
 }
예제 #5
0
 public void ClearBatchSetupCanvas()
 {
     BatchSetupView.ClearCanvaschildren();
 }
예제 #6
0
 public string GetDbMachineName()
 {
     return(BatchSetupView.GetDbMachineName());
 }
예제 #7
0
 public string GetAdoConnectionString()
 {
     return(BatchSetupView.GetAdoConnectionString());
 }