private void LoadButton_Click(object sender, EventArgs e) { string path; /* * if (MessageBox.Show("是否进行快速载入?", "提示", * MessageBoxButtons.YesNo, MessageBoxIcon.Question, * MessageBoxDefaultButton.Button1) == DialogResult.Yes) * path = Environment.CurrentDirectory + "\\quick_save.amz"; * else */ using (OpenFileDialog dialog = new OpenFileDialog { Filter = "亚马逊棋存档文件(*.amz)|*.amz|" + "文本文件(*.txt)|*.txt" + "|所有文件(*.*)|*.*", FileName = "quick_save.amz", InitialDirectory = Environment.CurrentDirectory, DefaultExt = "amz" }) { if (dialog.ShowDialog() == DialogResult.Cancel) { return; } path = dialog.FileName; } if (path == "") { return; } ChessGame game = LoadAMZ.LoadGame(path); if (game == null) { return; } var newTrd = new Thread((ThreadStart) delegate { Application.Run(new SinglePlayerForm(game)); }); newTrd.SetApartmentState(ApartmentState.STA); newTrd.Start(); Close(); }
public SinglePlayerForm(ChessGame game) { Game = game; InitializeComponent(); }