private Operation GenerateOperationTree(OperationNode rootOpeartionNode) { if (rootOpeartionNode == null) { return(null); } if (rootOpeartionNode.Operation == null) { return(null); } if (rootOpeartionNode.Operation.ChildOperations == null) { return(null); } rootOpeartionNode.Operation.ChildOperations.Clear(); foreach (OperationNode operationNode in rootOpeartionNode.Children) { if (operationNode.Operation != null) { rootOpeartionNode.Operation.ChildOperations.Add(operationNode.Operation); } GenerateOperationTree(operationNode); } return(rootOpeartionNode.Operation); }
private static void GetSampleEntryNames(OperationNode operationNode, List <string> sampleEntries) { if (operationNode == null) { return; } if (sampleEntries == null) { return; } foreach (OperationNode childNode in operationNode.Children) { if (childNode == null) { continue; } if (childNode is SampleOperationNode) { string sampleName = (childNode as SampleOperationNode).Content; if (sampleEntries.Contains(sampleName) == false) { sampleEntries.Add(sampleName); } } GetSampleEntryNames(childNode, sampleEntries); } }
private void ExpandOperationNode(OperationNode opeartionNode) { if (opeartionNode == null) { return; } opeartionNode.IsExpanded = true; foreach (OperationNode node in opeartionNode.Children) { ExpandOperationNode(node); } }
private OperationNode GetCurrentNode(IList <OperationNode> operationNodeList) { foreach (OperationNode node in operationNodeList) { if (node.IsSelected) { return(node); } OperationNode selectedNode = GetCurrentNode(node.Children); if (selectedNode != null) { return(selectedNode); } } return(null); }
public void DeleteCurrentNode() { OperationNode currentNode = GetCurrentNode(operationNodes); if (currentNode == null) { return; } if (currentNode.ParentNode == null) { return; } if (currentNode.ParentNode.Children.Contains(currentNode)) { currentNode.ParentNode.Children.Remove(currentNode); } }
public void OpenOperationTreeFile(string fileName) { ExperimentOperation experimentOperation = ExperimentFlow.GetInstance().LoadOperationTreeFromFile(fileName); if (experimentOperation == null) { return; } OperationNode opeartionNode = GenerateOperationNodeTree(experimentOperation); ExpandOperationNode(opeartionNode); if (opeartionNode as ExperimentOperationNode != null) { operationNodes.Clear(); operationNodes.Add(opeartionNode); opeartionNode.IsSelected = true; } }
private void CreateOperation(object param) { if (param == null) { return; } OperationNode currentNode = GetCurrentNode(operationNodes); if (currentNode == null && operationNodes.Count != 0) { currentNode = operationNodes[0]; } OperationNode newOpeartionNode = null; switch (param.ToString()) { case "experiment": CreateExperimentNode(); break; case "general_Param": newOpeartionNode = new FastScanParamOperationNode("FastScan Param"); break; case "data": newOpeartionNode = new DataOperationNode("Data"); break; case "background_data": newOpeartionNode = new BackgroundDataOperationNode("Background Data"); break; case "sample": newOpeartionNode = new SampleOperationNode("Administrator 01"); break; case "scan": newOpeartionNode = new FinchScanOperationNode("Scan"); break; case "trigger": newOpeartionNode = new TriggerOperationNode("Trigger"); break; case "temperature": newOpeartionNode = new TemperatureOperationNode("Peltier"); break; case "temperatureScan": newOpeartionNode = new PeltierScanOperationNode("PeltierScan"); break; case "time": newOpeartionNode = new TimeOperationNode("Time"); break; case "microplatereader": newOpeartionNode = new MPROperationNode("Microplate Reader"); break; case "wavelength": newOpeartionNode = new WaveLengthOperationNode("Wave Length"); break; } if (newOpeartionNode != null) { currentNode.Children.Add(newOpeartionNode); newOpeartionNode.ParentNode = currentNode; currentNode.IsExpanded = true; newOpeartionNode.IsSelected = true; } }
public OperationNode GenerateOperationNodeTree(Operation operation) { if (operation == null) { return(null); } OperationNode operationNode = null; if (operation.GetType() == typeof(BackgroundDataOperation)) { operationNode = new BackgroundDataOperationNode(operation as BackgroundDataOperation); } else if (operation.GetType() == typeof(DataOperation)) { operationNode = new DataOperationNode(operation as DataOperation); } else if (operation.GetType() == typeof(ExperimentOperation)) { operationNode = new ExperimentOperationNode(operation as ExperimentOperation); } else if (operation.GetType() == typeof(FastScanParamOperation)) { operationNode = new FastScanParamOperationNode(operation as FastScanParamOperation); } else if (operation.GetType() == typeof(MPROperation)) { operationNode = new MPROperationNode(operation as MPROperation); } else if (operation.GetType() == typeof(SampleOperation)) { operationNode = new SampleOperationNode(operation as SampleOperation); } else if (operation.GetType() == typeof(TemperatureOperation)) { operationNode = new TemperatureOperationNode(operation as TemperatureOperation); } else if (operation.GetType() == typeof(TimeOperation)) { operationNode = new TimeOperationNode(operation as TimeOperation); } else if (operation.GetType() == typeof(TriggerOperation)) { operationNode = new TriggerOperationNode(operation as TriggerOperation); } else if (operation.GetType() == typeof(WaveLengthOperation)) { operationNode = new WaveLengthOperationNode(operation as WaveLengthOperation); } else if (operation.GetType() == typeof(FinchScanOperation)) { operationNode = new FinchScanOperationNode(operation as FinchScanOperation); } else if (operation.GetType() == typeof(PeltierScanOperation)) { operationNode = new PeltierScanOperationNode(operation as PeltierScanOperation); } foreach (Operation childOperation in operation.ChildOperations) { OperationNode childOperationNode = GenerateOperationNodeTree(childOperation); if (childOperationNode != null && operationNode != null) { operationNode.Children.Add(childOperationNode); } } return(operationNode); }
private void OperationTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e) { TreeView treeview = sender as TreeView; if (treeview == null) { return; } OperationNode selectedItem = treeview.SelectedItem as OperationNode; if (selectedItem == null) { return; } if (selectedItem.Operation == null) { return; } UserControl paramSettingUserControl = null; if (paramSettingPanelDict.ContainsKey(selectedItem.Operation.OperationType)) { paramSettingUserControl = paramSettingPanelDict[selectedItem.Operation.OperationType]; } else { switch (selectedItem.Operation.OperationType) { case OperationType.Experiment: paramSettingUserControl = new ExperimentSettingPanel(); break; case OperationType.GeneralParam: paramSettingUserControl = new GeneralParamSettingPanel(); break; case OperationType.Data: paramSettingUserControl = new DataSettingPanel(); break; case OperationType.BackgroundData: paramSettingUserControl = new BackgroundDataSettingPanel(); break; case OperationType.Sample: paramSettingUserControl = new SampleSettingPanel(); break; case OperationType.Scan: paramSettingUserControl = new ScanSettingPanel(); break; case OperationType.Trigger: paramSettingUserControl = new TriggerSettingPanel(); break; case OperationType.Time: paramSettingUserControl = new TimeSettingPanel(); break; case OperationType.Temperature: paramSettingUserControl = new TemperatureSettingPanel(); break; case OperationType.MicroplateReader_Position: paramSettingUserControl = new MPRSettingPanel(); break; case OperationType.WaveLength: paramSettingUserControl = new WavelengthSettingPanel(); break; } paramSettingPanelDict.Add(selectedItem.Operation.OperationType, paramSettingUserControl); } if (paramSettingUserControl != null) { tabItemParamSetting.Content = paramSettingUserControl; paramSettingUserControl.DataContext = selectedItem; } }