public void Undo_ModifyObjectData(int l_unexcute_scfl, ICommand command) { ///<summary> /// This code is to undo the modification action which the user has performed /// </summary> #region Undo the Modification try { SuspensionCoordinatesFront _scfl_forUndo = (SuspensionCoordinatesFront)command; ICommand cmd = Assy_List_SCFL[l_unexcute_scfl]; Assy_List_SCFL[l_unexcute_scfl]._RedocommandsSCFL.Push(cmd); Assy_List_SCFL[l_unexcute_scfl] = _scfl_forUndo; PopulateDataTable(l_unexcute_scfl); SuspensionCoordinatesFrontGUI.DisplaySCFLItem(Assy_List_SCFL[l_unexcute_scfl]); #region Calling Undo method for Opposite Suspension if symmetric if (Assy_List_SCFL[l_unexcute_scfl].FrontSymmetry == true && IsUndoRedoCalledByRight == false) { SuspensionCoordinatesFrontRight.IsUndoRedoCalledByLeft_IdentifierMethod(true);// This method sets the IsUndoRedoCalledByLeft variable to true and prevents an infinte loop UndoRedo undoRedo = new UndoRedo(); undoRedo.Identifier(SuspensionCoordinatesFrontRight.Assy_List_SCFR[l_unexcute_scfl]._UndocommandsSCFR, SuspensionCoordinatesFrontRight.Assy_List_SCFR[l_unexcute_scfl]._RedocommandsSCFR, l_unexcute_scfl + 1, SuspensionCoordinatesFrontRight.Assy_List_SCFR[l_unexcute_scfl].SCFRIsModified); undoRedo.Undo(1); SuspensionCoordinatesFrontRight.IsUndoRedoCalledByLeft_IdentifierMethod(false);//This method sets the value of IsUndoRedoCalledByLeft to false so that the Right Suspension coordinate can also be Undone } #endregion Kinematics_Software_New.EditFrontCAD(l_unexcute_scfl); Kinematics_Software_New.SCFL_ModifyInVehicle(l_unexcute_scfl, Assy_List_SCFL[l_unexcute_scfl]); } catch (Exception) { } #endregion }
public void ModifyObjectData(int l_modify_SCFL, object modify_scfl_list, bool redo_Identifier) { ///<summary> ///In this section of the code, the Suspension is bring modified and it is placed under the method called ModifyObjectData because it is an Undoable operation ///</summary> #region Redo the Modification SuspensionCoordinatesFront _scfl_forRedo = (SuspensionCoordinatesFront)modify_scfl_list; ICommand cmd = Assy_List_SCFL[l_modify_SCFL]; Assy_List_SCFL[l_modify_SCFL]._UndocommandsSCFL.Push(cmd); Assy_List_SCFL[l_modify_SCFL] = _scfl_forRedo; PopulateDataTable(l_modify_SCFL); Assy_List_SCFL[l_modify_SCFL].SCFLIsModified = true; SuspensionCoordinatesFrontGUI.DisplaySCFLItem(Assy_List_SCFL[l_modify_SCFL]); #region Calling Redo method for Opposite Suspension if symmetric if (Assy_List_SCFL[l_modify_SCFL].FrontSymmetry == true && IsUndoRedoCalledByRight == false) { SuspensionCoordinatesFrontRight.IsUndoRedoCalledByLeft_IdentifierMethod(true);// This method sets the IsUndoRedoCalledByLeft variable to true and prevents an infinte loop UndoRedo undoRedo = new UndoRedo(); undoRedo.Identifier(SuspensionCoordinatesFrontRight.Assy_List_SCFR[l_modify_SCFL]._UndocommandsSCFR, SuspensionCoordinatesFrontRight.Assy_List_SCFR[l_modify_SCFL]._RedocommandsSCFR, l_modify_SCFL + 1, SuspensionCoordinatesFrontRight.Assy_List_SCFR[l_modify_SCFL].SCFRIsModified); undoRedo.Redo(1); SuspensionCoordinatesFrontRight.IsUndoRedoCalledByLeft_IdentifierMethod(false);//This method sets the value of IsUndoRedoCalledByLeft to false so that the Right Suspension coordinate can also be Undone } #endregion Kinematics_Software_New.EditFrontCAD(l_modify_SCFL); Kinematics_Software_New.SCFL_ModifyInVehicle(l_modify_SCFL, Assy_List_SCFL[l_modify_SCFL]); #endregion }