// ルートデバイスを返す internal Device GetRootDevice(DeployDiagramObject DeployDiagramObject) { // 親がExecutionEnvitomnentObjectなら現在のデバイスがルートデバイスなのでreturn if (ExecutionEnvironmentList.Any(ExecutionEnvironment => ExecutionEnvironment.ID == DeployDiagramObject.ParentID)) { return(DeployDiagramObject as Device); } return(GetRootDevice(DeviceList.Single(Device => Device.ID == DeployDiagramObject.ParentID))); }
// 親のデバイスを返す // コンポーネントもしくはデバイスを引数にする internal Device GetParentDevice(DeployDiagramObject DeployDiagramObject) { // MessageBox.Show(DeployDiagramObject.ParentID.ToString()); // DeviceList.ForEach(Device => MessageBox.Show(Device.ID.ToString())); return(DeviceList.Single(Device => Device.ID == DeployDiagramObject.ParentID)); }
// 配置図の要素が属している実行環境の取得 internal ExecutionEnvironment GetExecutionEnvironment(EA.Repository Repository, DeployDiagramObject DeployDiagramObject) { var diagram = Repository.GetCurrentDiagram(); var diagramObject = diagram.GetDiagramObjectByID(DeployDiagramObject.ParentID, ""); if (DeviceList.Where(Device => Device.ID == DeployDiagramObject.ParentID).Any()) { return(GetExecutionEnvironment(Repository, DeviceList.Single(Device => Device.ID == DeployDiagramObject.ParentID))); } return(ExecutionEnvironmentList.Single(ExecutionEnvironment => ExecutionEnvironment.ID == DeployDiagramObject.ParentID)); }