public RawFileViewModel() { ProgressMessage = new ObservableCollection <string>(); UiProcessBatch = new ObservableCollection <ProcessItem>(); Measurements = new ObservableCollection <IdNamePairProcessItem>(); BatchName = "MyfirstBatch"; ObservableCollection <ProcessItem> seq = new ObservableCollection <ProcessItem>(); CurrentGroup = seq; ProcessItem item = new IdNamePairProcessItem(); item.Name = "group1"; item.ProcessStatus = "idle"; item.Children = seq; item.CrtDepthLevel = 1; UiProcessBatch.Add(item); ShowProgressBar = true; //ObservableCollection<ProcessItem> seq2 = CreateTestSequence(rawfiles); //ProcessItem item2 = new ProcessItem(); //item2.Name = "group2"; //item2.Children = seq2; //UiProcessBatch.Add(item2); }
public void AddRawFileJobsToCurrentGroup(string file) { ProcessItem item = new IdNamePairProcessItem() { Name = file }; CurrentGroup.Add(item); }
private bool CheckDropTarget(IdNamePairProcessItem _sourceItem, TreeViewItem _targetItem) { //Check whether the target item is meeting your condition bool _isEqual = false; //if (!_sourceItem.Header.ToString().Equals(_targetItem.Header.ToString())) //{ // _isEqual = true; //} return(_isEqual); }
public void AddGroup() { ObservableCollection <ProcessItem> seq = new ObservableCollection <ProcessItem>(); CurrentGroup = seq; ProcessItem item = new IdNamePairProcessItem(); item.Name = "group" + (UiProcessBatch.Count + 1).ToString(); item.Children = seq; item.CrtDepthLevel = 1; UiProcessBatch.Add(item); }
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); }
// changes the state of the tree item: // selects it if it has not been selected and // deselects it otherwise void ChangeSelectedState(IdNamePairProcessItem treeViewItem) { if (!selectedItems.ContainsKey(treeViewItem)) { // select //treeViewItem.Background = Brushes.Black; // change background and foreground colors //treeViewItem.Foreground = Brushes.White; selectedItems.Add(treeViewItem, null); // add the item to selected items } else { // deselect Deselect(treeViewItem); } }
public void AddRawFileJobsToCurrentGroup(IdNamePairProcessItem item) { if (item.CrtDepthLevel == 3) { ProcessItem addedItem = new IdNamePairProcessItem() { Name = item.Name, MeasurementId = item.MeasurementId }; CurrentGroup.Add(addedItem); } else if (item.CrtDepthLevel == 2) { foreach (IdNamePairProcessItem projectItem in item.Children) { ProcessItem addedItem = new IdNamePairProcessItem() { Name = projectItem.Name, MeasurementId = projectItem.MeasurementId }; CurrentGroup.Add(addedItem); } } else if (item.CrtDepthLevel == 1) { foreach (IdNamePairProcessItem projectItem in item.Children) { foreach (IdNamePairProcessItem chilIten in projectItem.Children) { ProcessItem addedItem = new IdNamePairProcessItem() { Name = chilIten.Name, MeasurementId = chilIten.MeasurementId }; CurrentGroup.Add(addedItem); } } } }
private void treeView_MouseMove(object sender, MouseEventArgs e) { try { if (e.LeftButton == MouseButtonState.Pressed) { Point currentPosition = e.GetPosition(MeasurementTree); if ((Math.Abs(currentPosition.X - _lastMouseDown.X) > 10.0) || (Math.Abs(currentPosition.Y - _lastMouseDown.Y) > 10.0)) { _draggedItem = (IdNamePairProcessItem)MeasurementTree.SelectedItem; if (_draggedItem != null) { DragDropEffects finalDropEffect = DragDrop.DoDragDrop(MeasurementTree, MeasurementTree.SelectedValue, DragDropEffects.Move); //Checking target is not null and item is dragging(moving) if ((finalDropEffect == DragDropEffects.Move))// && (_target != null)) { // A Move drop was accepted //jlin // if (!draggedItem.Header.ToString().Equals(_target.Header.ToString())) //{ // CopyItem(draggedItem, _target); // _target = null; // draggedItem = null; //} } } } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
// deselects the tree item void Deselect(IdNamePairProcessItem treeViewItem) { //treeViewItem.Background = Brushes.White;// change background and foreground colors //treeViewItem.Foreground = Brushes.Black; selectedItems.Remove(treeViewItem); // remove the item from the selected items set }