/// <summary> /// Carga un mapa de disco. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OpenMap_Click(object sender, EventArgs e) { if (openMapDialog.ShowDialog() == DialogResult.OK) { IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream(openMapDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read); map = (Map)formatter.Deserialize(stream); stream.Close(); Size = new Size(map[0, 0].Image.Width * map.GetLength(1) + 9, map[0, 0].Image.Height * map.GetLength(0) + menuToolbar.Height + statusStrip.Height + mainToolStrip.Height + 32); map.Movement += MapSomethingMoved; map.Interaction += UpdateStatusText; map.Interaction += MapSomethingMoved; map.Robot.Motor.UnableToLoad += Robot_UnableToLoad; map.Robot.Motor.UnableToUnload += Robot_UnableToUnload; map.Robot.Motor.UnableToMove += Robot_UnableToMove; this.statusLabel.Text = "Event messages will appear here."; pboxCanvas.Image = null; pboxCanvas.Invalidate(); statusStrip.Visible = true; } }