public static void buttonDelSurface(EventArgs e, MainForm form) { int selectedIndex = StorageOfSelectedOperation.getIndexSelectedSurface(); try { if (selectedIndex != 0) { form.SurfacesTreeView.Nodes.RemoveAt(selectedIndex); for (int i = 1; i < form.SurfacesTreeView.Nodes.Count; i++) { if (form.SurfacesTreeView.Nodes[i].Text == $"Поверхность {i + 1}") { string nameSurface = "Поверхность " + Convert.ToString(i); form.SurfacesTreeView.Nodes[i].Text = nameSurface; Part.getSurfaceOnIndex(i).setNameSurface(nameSurface); } } Part.deleteSurface(selectedIndex); StorageOfSelectedOperation.setIndexSelectedSurface(selectedIndex - 1); } } catch { } }
private void NameSurface_TextChanged(object sender, EventArgs e) { try { int indexSelectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); string nameSurface = NameSurface.Text; SurfacesTreeView.Nodes[indexSelectedSurface].Text = nameSurface; SurfacesTreeView.Nodes[indexSelectedSurface].Name = "change"; Part.setNameSurfaceOnIndex(indexSelectedSurface, nameSurface); } catch { } }
public static void buttonOfSaveChanges(EventArgs e, MainForm form) { try { int selectedOperation = StorageOfSelectedOperation.getIndexSelectedOperation(); int selectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); if (selectedOperation != 0) { Operation operation = Part.getSurfaceOnIndex(selectedSurface).getOperationOnIndex(selectedOperation - 1); extractionOfParametersOfOperationFromTextBoxes(operation, form); insertNameOperationInTreeView(form, selectedOperation); } } catch { } }
public static void buttonDeleteOperation(MainForm form) { try { TreeView treeView = form.TreeOfSelectedOperations; int indexSelectedOperation = StorageOfSelectedOperation.getIndexSelectedOperation(); int indexSelectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); if (indexSelectedOperation != 0) { treeView.Nodes.RemoveAt(indexSelectedOperation); Part.deleteOperation(indexSelectedSurface, indexSelectedOperation - 1); StorageOfSelectedOperation.decrementOfIndex(); form.TreeOfSelectedOperations.SelectedNode = form.TreeOfSelectedOperations.Nodes[indexSelectedOperation - 1]; } } catch { } }
public static void clickOnNode(TreeNodeMouseClickEventArgs e, MainForm form) { int selectedIndex = e.Node.Index; //storageParametersOfSurface(form, selectedIndex); StorageOfSelectedOperation.setIndexSelectedSurface(selectedIndex); form.NameSurface.Text = Part.getSurfaceOnIndex(selectedIndex).getNameSurface(); if (selectedIndex == 0) { StorageOfSelectedOperation.setIndexSelectedSurface(0); form.SurfacesTreeView.SelectedNode = form.SurfacesTreeView.Nodes[0]; Part.insertListOfOperationsInTreeView(form); form.TreeOfOperations.Nodes.Clear(); Tables.getParametersOfSurfacesAfterVariousOperations().insertListOfOperationsInTreeView(form); form.Surfaces.Visible = false; form.NameSurface.Visible = false; form.SurfacesTreeView.Visible = false; form.addSurfaceButton.Visible = false; form.delSurfaceButton.Visible = false; form.TreeOfOperations.Size = new Size(400, 287); form.TreeOfOperations.Location = new Point(16, 270); form.labelOperationsOrTechProcess.Size = new Size(91, 13); form.labelOperationsOrTechProcess.Location = new Point(169, 250); form.labelOperationsOrTechProcess.Text = "Выбор операций"; form.SelectTechnologicalProcess.Visible = true; form.CalculationOfSchema.Visible = false; } else { int indexSelectSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); Part.insertListOfOperationsInTreeView(form, indexSelectSurface); int countOperations = form.TreeOfSelectedOperations.Nodes.Count; form.TreeOfSelectedOperations.SelectedNode = form.TreeOfSelectedOperations.Nodes[countOperations - 1]; } }
public static void clickOnTreeOperations(TreeNodeMouseClickEventArgs e, MainForm form) { int idOperation = e.Node.Index; int indexSelectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); Operation operation; if (indexSelectedSurface == 0) { operation = extractionOfParametersOfOperationsFromTables(idOperation); } else { operation = extractionOfParametersOfOperationsFromTechnologicalProcess(idOperation); } StorageOfSelectedOperation.setOperation(operation); StorageOfSelectedOperation.insertParametersOfOperationsInTextboxes(form); }
public static void buttonOfCalculation(MainForm form) { try { int indexSelectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); ParametersOfSurface parameters = extractionOfParametersOfPartFromTextBoxes(form); Part.getSurfaceOnIndex(indexSelectedSurface).setParametersOfSurface(parameters); Part.calculationOfSurfaces(); if (Part.getSurfaceOnIndex(1).getParametersOperation()[0] != null && !ErrorMessage.getGlobalError()) { FormResult formResult = new FormResult(); formResult.ShowDialog(); } } catch { } }
public static void clickOnNode(TreeNodeMouseClickEventArgs e, MainForm form) { int selectedIndex = e.Node.Index; StorageOfSelectedOperation.setIndexSelectedOperation(selectedIndex); if (selectedIndex == 0) { EventClickOnButtonOfSelectWorkpriece.buttonSelectWorkpriece(form); } else { int index = selectedIndex - 1; int idSelectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); Operation operation = Part.getSurfaceOnIndex(idSelectedSurface).getOperationOnIndex(index); StorageOfSelectedOperation.setOperation(operation); StorageOfSelectedOperation.insertParametersOfOperationsInTextboxes(form); } }
public static void buttonOfSelectOperations(MainForm form) { Operation operation = StorageOfSelectedOperation.getOperation(); if (operation != null) { extractionOfParametersOfOperationFromTextBoxes(operation, form); int indexSelectedOperation = StorageOfSelectedOperation.getIndexSelectedOperation(); int indexSelectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); Part.addOperationInSurface(operation, indexSelectedSurface, indexSelectedOperation); insertNameOperationInTextboxes(form, operation.getTypeOfMachining(), indexSelectedOperation); operation = new Operation(operation); StorageOfSelectedOperation.setOperation(operation); } /*ParametersOperation operation = StorageOfSelectedOperation.getOperation(); * * if (operation != null) * { * extractionOfParametersOfOperationFromTextBoxes(operation, form); * * int indexSelectedOperation = StorageOfSelectedOperation.getIndexSelectedOperation(); * int indexSelectedSurface = StorageOfSelectedOperation.getIndexSelectedSurface(); * * Part.addOperationInSurface(operation, indexSelectedSurface, indexSelectedOperation); * * insertNameOperationInTextboxes(form, operation.getNameOperation(), indexSelectedOperation); * * operation = new ParametersOperation(operation); * StorageOfSelectedOperation.setParameters(operation); * }*/ }