public AllProjectSettingsViewModel(ProjectSettingServiceClass ProjectSettingService, ProjectServiceClass projectService) { _ProjectSettingService = ProjectSettingService; _projectService = projectService; this.CreateAllProjectSettings(_ProjectSettingService.Items); _ProjectSettingService.Items.CollectionChanged += Items_CollectionChanged; }
public AllTableMakerProductsViewModel(TableMakerProductServiceClass tableMakerProductService, TableMakerProductTypeServiceClass tableMakerProductTypeServie, ProjectServiceClass projectService) { _tableMakerProductTypeServie = tableMakerProductTypeServie; _tableMakerProductService = tableMakerProductService; _projectService = projectService; this.CreateAllTableMakerProducts(_tableMakerProductService.Items); _tableMakerProductService.Items.CollectionChanged += Items_CollectionChanged; }
public AllProjectsViewModel(TesterServiceClass testerService, ProjectServiceClass projectService, BatteryTypeServiceClass batteryTypeServie, ProgramServiceClass programService, ProjectSettingServiceClass projectSettingService, TableMakerProductServiceClass tableMakerProductService) { _testerService = testerService; _projectService = projectService; _batteryTypeService = batteryTypeServie; _programService = programService; _projectSettingService = projectSettingService; _tableMakerProductService = tableMakerProductService; this.CreateAllProjects(_projectService.Items); _projectService.Items.CollectionChanged += Items_CollectionChanged; }
public AllEventsViewModel(/*EventService eventService*/ ProgramServiceClass programService, ProjectServiceClass projectService, ProgramTypeServiceClass programTypeService, BatteryServiceClass batteryService, TesterServiceClass testerService, ChannelServiceClass channelService, ChamberServiceClass chamberService, BatteryTypeServiceClass batteryTypeService) { _programService = programService; _projectService = projectService; _programTypeService = programTypeService; _batteryService = batteryService; _testerService = testerService; _channelService = channelService; _chamberService = chamberService; _batteryTypeService = batteryTypeService; //_eventService = eventService; //this.CreateAllEvents(_eventService.Items); //_eventService.Items.CollectionChanged += Items_CollectionChanged; this.CreateAllEvents(EventService.Items); EventService.Items.CollectionChanged += Items_CollectionChanged; }
private static Project GetProjectFromNode(string value, ProjectServiceClass projectService) { return(projectService.Items.SingleOrDefault(o => o.Name == value)); }
private static Program BuildProgramFromPseudocode(XElement xmlProgram, ProgramServiceClass programService, ProjectServiceClass projectService, ProgramTypeServiceClass programTypeService, RecipeTemplateServiceClass recipeTemplateService) { var program = new Program(); try { program.Name = xmlProgram.Attribute("Name").Value; program.Type = GetProgramTypeFromNode(xmlProgram.Attribute("Type").Value, programTypeService); program.Project = GetProjectFromNode(xmlProgram.Attribute("Project").Value, projectService); program.Requester = xmlProgram.Attribute("Requester").Value; program.RequestTime = DateTime.Parse(xmlProgram.Attribute("RequestDate").Value); var xmlTemperatures = xmlProgram.Descendants("Temperatures").Elements(); if (xmlTemperatures != null) { foreach (var xmlT in xmlTemperatures) { program.Temperatures.Add(Convert.ToInt32(xmlT.Value)); } } var xmlRecipes = xmlProgram.Descendants("Recipes").Elements(); if (xmlRecipes != null) { var dic = new Dictionary <int, int>(); //recipe template id, count foreach (var xmlRec in xmlRecipes) { if (xmlRec.Attribute("Template") == null) { continue; } var recTid = xmlRec.Attribute("Template").Value; if (recTid == string.Empty) { continue; } var Tid = Convert.ToInt32(recTid); var recT = recipeTemplateService.Items.SingleOrDefault(o => o.Id == Tid); if (recT == null) { MessageBox.Show($@"No such recipe template:{recTid}"); continue; } program.RecipeTemplates.Add(recT.Name); var count = GetIntergerFromNode(xmlRec, "Count"); if (count == 0) { count = 1; } dic.Add(recT.Id, count); } program.BuildRecipes(recipeTemplateService.Items.ToList(), dic); } } catch (Exception e) { MessageBox.Show(e.Message); } return(program); }
private static List <Program> BuildProgramsFromPseudocode(string fileName, ProgramServiceClass programService, ProjectServiceClass projectService, ProgramTypeServiceClass programTypeService, RecipeTemplateServiceClass recipeTemplateService) { List <Program> output = new List <Program>(); if (File.Exists(fileName)) { XDocument xd = new XDocument(); xd = XDocument.Load(fileName); var xmlPrograms = xd.Descendants("Programs").Elements(); foreach (var xmlProgram in xmlPrograms) { output.Add(BuildProgramFromPseudocode(xmlProgram, programService, projectService, programTypeService, recipeTemplateService)); } } if (output.Count != 0) { return(output); } else { return(null); } }
internal static void Load(string fileName, RecipeTemplateServiceClass recipeTemplateService, ProgramServiceClass programService, ProjectServiceClass projectService, ProgramTypeServiceClass programTypeService) { List <RecipeTemplate> recipeTemplates = BuildRecipeTemplatesFromPseudocode(fileName, recipeTemplateService); if (recipeTemplates != null) { foreach (var rt in recipeTemplates) { recipeTemplateService.SuperAdd(rt); } } List <Program> programs = BuildProgramsFromPseudocode(fileName, programService, projectService, programTypeService, recipeTemplateService); if (programs != null) { foreach (var prog in programs) { programService.SuperAdd(prog); //programService.FixTemplates(prog); //不管用 } } }