public ComponentController(Startup.DeleteByIdResolver deleteAccesor, IComponentReadOnlyRepository readComponent, ICreate <Component> createComponent, IUpdate <Component> updateComponent) { delete = new DeleteComponent(deleteAccesor(WebApi.DeletesID.Component), readComponent); create = new CreateComponent(createComponent, readComponent); update = new UpdateComponent(updateComponent, readComponent); read = new ReadComponent(readComponent); }
static void CreateWindow() { CreateComponent window = EditorWindow.GetWindow(typeof(CreateComponent), true, "Criar Reagente") as CreateComponent; window.minSize = new Vector2(300f, 650f); window.maxSize = new Vector2(300f, 650f); }
public void LoadViews() { searchOrderView = new SearchInfo(DataBase, this); ViewDictionary.Add("SearchOrder", searchOrderView); searchOrderView.Dock = DockStyle.Fill; panel1.Controls.Add(searchOrderView); searchOrderView.Hide(); searchComponentView = new SearchComponent(DataBase, this); ViewDictionary.Add("SearchComponent", searchComponentView); searchComponentView.Dock = DockStyle.Fill; panel1.Controls.Add(searchComponentView); searchComponentView.Hide(); createComponentView = new CreateComponent(DataBase, this); ViewDictionary.Add("CreateComponent", createComponentView); createComponentView.Dock = DockStyle.Fill; panel1.Controls.Add(createComponentView); createComponentView.Hide(); OrderSuppliersView = new OrderSuppliers(DataBase, this); ViewDictionary.Add("OrderSuppliersView", OrderSuppliersView); OrderSuppliersView.Dock = DockStyle.Fill; panel1.Controls.Add(OrderSuppliersView); OrderSuppliersView.Hide(); }
public static CreateComponentDto ToDto(CreateComponent component) => new CreateComponentDto { UnitPrice = component.UnitPrice, QuantityType = component.QuantityType, Description = string.IsNullOrEmpty(component.Description) ? null : component.Description };
public ModSessionComponentDescriptor(Type componentType, Type objectBuilderType, ObjectBuilderTypeTester typeTester, CreateComponent activator, SerializeFromXml serializeFromXml, SerializeFromBinary serializeFromBinary) { TypeKey = componentType.FullName.Hash64(); ComponentType = componentType; ObjectBuilderType = objectBuilderType; Tester = typeTester; Activator = activator; SerializeFromXml = serializeFromXml; SerializeFromBinary = serializeFromBinary; }
public override void OnInspectorGUI() { DrawDefaultInspector(); CreateComponent cc = (CreateComponent)target; if (GUILayout.Button("Create Component")) { cc.CreateComponents(); } }
public async Task <Result <Component> > CreateComponent(CreateComponent component) { var resultFromClient = await componentsClient.CreateComponentAsync(ComponentConverter.ToDto(component)); return(new Result <Component> { IsSuccess = resultFromClient.IsSuccess, Message = resultFromClient.Message, Value = resultFromClient.IsSuccess ? ComponentConverter.FromDto(resultFromClient.Value) : null }); }
public override void draw() { if (data.Count == 4) { // if (ClusterData.rotate == 1) // { // ClusterData.swap(); // } x /= -2; y /= -2; if (ClusterData.dir.X != 0) { setCount(countX * ClusterData.countX); if (ClusterData.rotate == 0) { draw(data, new List <int> { 0, 1, 2, 3 }); } else if (ClusterData.rotate == 1) { data[1].count = 1; draw(data, new List <int> { 0, 1, 2 }); } } else { setCount(countY * ClusterData.countY); if (ClusterData.rotate == 0) { data[1].count = 1; draw(data, new List <int> { 0, 1, 2 }); } else if (ClusterData.rotate == 1) { draw(data, new List <int> { 0, 1, 2, 3 }); } } if (ClusterData.dir.X != 0) { setCount(countX * ClusterData.countX); y = y * -1 - ClusterData.starty; if (ClusterData.rotate == 0) { draw(data, new List <int> { 0, 1, 2, 3 }); } else if (ClusterData.rotate == 1) { //data[1].count = countX * ClusterData.countX; draw(data, new List <int> { 1, 3 }); } } else { setCount(countY * ClusterData.countY); x = x * -1 - ClusterData.startx; if (ClusterData.rotate == 0) { draw(data, new List <int> { 1, 3 }); } else if (ClusterData.rotate == 1) { draw(data, new List <int> { 0, 1, 2, 3 }); } } CreateComponent.hole(compDef, (ClusterData.D * ClusterData.tol).ToString(), psOut); } else if (data.Count == 2) { x /= -2; y /= -2; setCount(countX * ClusterData.countX); if (ClusterData.dir.X != 0) { draw(data, new List <int> { 0, 1 }); } else { setCount(countY * ClusterData.countY); draw(data, new List <int> { 0, 1 }); } if (ClusterData.dir.X != 0) { y = y * -1 - ClusterData.starty; draw(data, new List <int> { 0, 1 }); } else { setCount(countY * ClusterData.countY); x = x * -1 - ClusterData.startx; draw(data, new List <int> { 0, 1 }); } Dictionary <string, double> dic = new Dictionary <string, double>() { { "a", ClusterData.l *ClusterData.tol }, { "ширина", ClusterData.D *ClusterData.tol } }; //I.createPunch("Punches\\Овал.ide", psOut, dic, 0); foreach (SketchPoint item in psOut.SketchPoints) { I.createSlot(item.Geometry, psOut, I.CV2d(0, 1), (ClusterData.l - ClusterData.D) / 2, ClusterData.D); } I.createCut(psOut); } }
/// <summary> /// Add a E-cell class of this ComponentSetting. /// </summary> /// <param name="type">a type of class</param> private void AddCreateMethod(string type) { PPathwayObject obj = null; switch (type) { case EcellObject.SYSTEM: obj = new PPathwaySystem(); break; case EcellObject.PROCESS: obj = new PPathwayProcess(); break; case EcellObject.VARIABLE: obj = new PPathwayVariable(); break; case EcellObject.TEXT: obj = new PPathwayText(); break; case EcellObject.STEPPER: obj = new PPathwayStepper(); break; default: throw new PathwayException(MessageResources.ErrUnknowType); } m_createMethod = obj.CreateNewObject; }
//Create component(s) public void CreateComponentWindow() { WaitForLoanInformationUpdated(); if (SelectedItem != null) { //Copy the selected into the new view, for easy adding of more of the same newComponent_ = new Component(SelectedItem); newComponent_.ComponentNumber = GetNextComponentNumber(SelectedItem.ComponentName); } else { newComponent_ = new Component { ComponentNumber = 1 } }; //Remove "Null" text when creating new component newComponent_.ActualLoanInformation.LoanDate = null; newComponent_.ActualLoanInformation.ReturnDate = null; //Locator locate our CreateComponentViewModel, then set the CreateComponentViewModel equal to a new one with newComponent_ inside: var locator = (ViewModelLocator)Application.Current.FindResource("Locator"); locator.CreateComponentViewModel = new CreateComponentViewModel(newComponent_); locator.CreateComponentViewModel.AddThisManyComponents = 1; Window dlg = new CreateComponent(); dlg.DataContext = locator.CreateComponentViewModel; dlg.WindowStartupLocation = WindowStartupLocation.CenterScreen; bool tryedReconnect = false; // Makes sure the reconnect message only appears once //If user press ok then add all the components if (dlg.ShowDialog() == true) { if (!string.IsNullOrEmpty(locator.CreateComponentViewModel.NewComponent.ComponentName)) { var startNumber = locator.CreateComponentViewModel.NewComponent.ComponentNumber; for (int i = 0; i < locator.CreateComponentViewModel.AddThisManyComponents; i++) { var tempComponent = new Component(newComponent_); //copy the newComponent tempComponent.ComponentNumber = startNumber + i; //change the component number accordingly if (false == cdbUtil_.CreateComponent(tempComponent)) { if (!tryedReconnect) { Reconnect(); tryedReconnect = true; } } AllComponentList.Add(tempComponent); } } else { MessageBox.Show("Du skal indtaste et komponent-navn."); } } SetComponentList(AllComponentList); //Set the content of the componentdatagrid CategoryIndex = 0; //then or else dischard the data the user inputted: newComponent_ = null; //redundant? Don't ref the old one, rather some new uninitted }
static void UserMenu(Project proj, User user, CreateProject createProject) { start: Console.Clear(); Console.WriteLine("1 - Машина\n2 - Компонент\n3 - Останов"); Int32.TryParse(Console.ReadLine(), out int userChoice); switch (userChoice) { case 1: { Console.Clear(); Console.WriteLine("------------------------Контроль технического обслуживания машин-------------------------"); Console.WriteLine("1 - Отображение всего парка машин на проекте\n" + "2 - Поиск машины по его гаражному номеру и модели\n" + "3 - Сделать останов машины\n" + "4 - Прикрепить компонент к машине\n" + "5 - Сделать машину активной/неактивной\n" + "6 - Создать машину"); Console.WriteLine("Вернуться в меню - enter x2"); Int32.TryParse(Console.ReadLine(), out int choice); switch (choice) { case 1: { createProject.ShowAllCarsInProject(ref proj); Console.WriteLine("Вернуться в меню - enter"); if (Console.ReadKey().Key == ConsoleKey.Enter) { goto start; } break; } case 2: { SearchCar(ref proj); Console.WriteLine("Вернуться в меню - enter"); if (Console.ReadKey().Key == ConsoleKey.Enter) { goto start; } break; } case 3: { Car car = SearchCarForStop(ref proj); if (car != null) { if (createProject.IsBroken(ref car)) { Console.WriteLine("Машина уже не в рабочем состоянии"); } else { createProject.CreateBreaks(ref car, ref proj, ref user); } } else { Console.WriteLine("Проверьте корректность ввода"); } Console.WriteLine("Вернуться в меню - enter"); if (Console.ReadKey().Key == ConsoleKey.Enter) { goto start; } break; } case 4: { Car car = SearchCar(ref proj); if (car != null) { if (CarCreate.IsComponentInThatCar(ref car, out int id)) { Console.WriteLine("Компонент уже есть в данной машине"); Console.WriteLine("Создать новый компонент 1 - да Любая клавиша - выход в меню"); Int32.TryParse(Console.ReadLine(), out int ch); if (ch == 1) { Console.WriteLine("Введите id компонента"); Int32.TryParse(Console.ReadLine(), out id); Part component = CreateComponent.CtComponent(id); CarCreate.AttachComponentToCar(ref car, ref component, out string message); Console.WriteLine(message); } else { goto start; } } else { Part component = CreateComponent.CtComponent(id); CarCreate.AttachComponentToCar(ref car, ref component, out string message); Console.WriteLine(message); } } else { Console.WriteLine("Проверьте корректность ввода"); } Console.WriteLine("Вернуться в меню - enter"); if (Console.ReadKey().Key == ConsoleKey.Enter) { goto start; } break; } case 5: { Car car = SearchCar(ref proj); if (car != null) { Console.WriteLine("1 - Активной 2 - Неактивной"); Int32.TryParse(Console.ReadLine(), out int v); switch (v) { case 1: { CarCreate.GetCarActiveOrNot(ref car, true); Console.WriteLine("Машина активна"); break; } case 2: { CarCreate.GetCarActiveOrNot(ref car, false); Console.WriteLine("Машина неактивна"); break; } } } else { Console.WriteLine("Проверьте корректность ввода"); } Console.WriteLine("Вернуться в меню - enter"); if (Console.ReadKey().Key == ConsoleKey.Enter) { goto start; } break; } case 6: { CarCreate.CreateCar(ref proj); Console.WriteLine("Машина добавлена в список машин на проекте"); Console.WriteLine("Вернуться в меню - enter"); if (Console.ReadKey().Key == ConsoleKey.Enter) { goto start; } break; } } if (Console.ReadKey().Key == ConsoleKey.Enter) { goto start; } break; }
public static void addFormCreationMethod(Type type, CreateComponent creationMethod) { FormCreationMethods.Add(type, creationMethod); }