private void CheckSocketPlan() { var socketPlans = new List <Drawing>(); foreach (var drawing in Drawing.GetAll(false)) { if (drawing.Name.Contains("Individeual") || drawing.Name.Contains("Pattern")) { continue; } var fileName = UnitWiring.GetSocketPlanFileName(drawing.Name, this.type) + ".dwg"; var directory = Path.Combine(Settings.Default.DrawingDirectory, Static.ConstructionCode); var path = Path.Combine(directory, fileName); if (!File.Exists(path)) { throw new ApplicationException("Socket plan is not generated yet." + Environment.NewLine + Path.GetFileName(fileName)); } var sp = Drawing.Create(path, "Local"); socketPlans.Add(sp); } var opener = new OpenDrawingForm(); opener.OpenFilesForSocketPlan(socketPlans); // これやると、図面操作できるようになる this.drawings = Drawing.GetAllForSocketPlan(this.type); }
private void CheckSocketPlan() { var socketPlans = new List <Drawing>(); foreach (var drawing in Drawing.GetAll(false)) { if (drawing.Name.Contains("Individeual") || drawing.Name.Contains("Pattern")) { continue; } var directory = Path.Combine(Settings.Default.DrawingDirectory, Static.ConstructionCode); var individualName = UnitWiring.GetSocketPlanFileName(drawing.Name, SocketPlanType.Individual) + ".dwg"; var individualPath = Path.Combine(directory, individualName); var patternName = UnitWiring.GetSocketPlanFileName(drawing.Name, SocketPlanType.Pattern) + ".dwg"; var patternPath = Path.Combine(directory, patternName); if (File.Exists(individualPath)) { socketPlans.Add(Drawing.Create(individualPath, "Local")); continue; } if (File.Exists(patternPath)) { socketPlans.Add(Drawing.Create(patternPath, "Local")); continue; } throw new ApplicationException("Socket plan is not generated yet. Please generate automatically." + Environment.NewLine + Path.GetFileName(individualName) + Environment.NewLine + Path.GetFileName(patternPath)); } var opener = new OpenDrawingForm(); opener.OpenFilesForSocketPlan(socketPlans); // これやると、図面操作できるようになる this.drawings = Drawing.GetAllForSocketPlan(SocketPlanType.Individual); this.drawings.AddRange(Drawing.GetAllForSocketPlan(SocketPlanType.Pattern)); }