public bool RemoveInstruction(List <VisualInstructionUserControl> visualInstructions, List <Instruction> instructions, VisualInstructionUserControl visulInstructionToBeRemoved) { int index = visualInstructions.IndexOf(visulInstructionToBeRemoved); visualInstructions.RemoveAt(index); instructions.RemoveAt(index); visulInstructionToBeRemoved.VisualInstructionSelectedEvent -= new VisualInstructionSelectedEventHandler(ladderForm.VisualInstruction_Selected); visulInstructionToBeRemoved.MouseClick -= new MouseEventHandler(VisualInstruction_Click); visulInstructionToBeRemoved.KeyDown -= new KeyEventHandler(ladderForm.VisualInstruction_KeyDown); visulInstructionToBeRemoved.Instruction.Dispose(); visulInstructionToBeRemoved.Dispose(); return(true); }
public void DeleteLine() { visualOutputInstructions.Reverse(); foreach (VisualInstructionUserControl visualInstruction in visualOutputInstructions) { visualInstruction.Dispose(); } visualOutputInstructions.Clear(); visualInstructions.Reverse(); foreach (VisualInstructionUserControl visualInstruction in visualInstructions) { visualInstruction.Dispose(); } visualInstructions.Clear(); LineBegin.Dispose(); LineEnd.Dispose(); BackgroundLine.Dispose(); }