private void Bt_Cancel_Click(object sender, EventArgs e) { if (position > -1) { //position--; commands.RemoveAt(commands.Count - 1); if (position == inits_comm_indx[inits_comm_indx.Count - 1]) { inits_comm_indx.RemoveAt(inits_comm_indx.Count - 1); } position--; //inits_comm_indx.RemoveAt(inits_comm_indx.Count - 1); } for (int i = 0; i < inits_comm_indx.Count; i++) { if (position >= inits_comm_indx[inits_comm_indx.Count - i - 1]) { for (int j = inits_comm_indx[inits_comm_indx.Count - i - 1]; j <= position; j++) { graphics.Clear(BackColor); commands[j].Execute(ref matrix, ref drawer, ref Dec, ref graphics); renumDecorator = Dec as RenumDecorator; if (matrix is HGMatrix.HGMatrix) { gMatrix = matrix as HGMatrix.HGMatrix; } } break; } } }
private void bt_SpareMatr_Click(object sender, EventArgs e) { graphics.Clear(BackColor); graphics = pictureBox1.CreateGraphics(); WinFormDrawer drawer1 = new WinFormDrawer(graphics, new Pen(Color.Red)); drawer1.Frame = checkBox1.Checked; drawer = drawer1; if ((last_f == "") || !(matrix.GetType() == typeof(SparseMatrix))) { matrix = new SparseMatrix(Convert.ToInt32(tb_Col.Text), Convert.ToInt32(tb_Row.Text)); InitiatorMatrix.RandomMatr(matrix, Convert.ToInt32(tb_NoNull.Text), Convert.ToInt32(tb_MaxVal.Text)); renumDecorator = new RenumDecorator(matrix); Dec = renumDecorator; ICommand command = new InitMatrixCommand(matrix, drawer, Dec, graphics); command.Execute(ref matrix, ref drawer, ref Dec, ref graphics); position++; commands.Add(command); inits_comm_indx.Add(position); } else if (matrix.GetType() == typeof(SparseMatrix)) { renumDecorator.Draw(drawer); } last_f = "bt_SpareMatr"; }
public RenumCommand(RenumDecorator renum) { decorator1 = renum; }