Пример #1
0
        private void OnFileOpenMenuItemClick(object sender, EventArgs e)
        {
            var openDialog = new OpenFileDialog
            {
                Filter           = "Quixo files (*.quixo)|*.quixo",
                FilterIndex      = 1,
                RestoreDirectory = true
            };

            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    using (var quixoStream = openDialog.OpenFile())
                    {
                        IFormatter formatter = new QF.BoardFormatter();
                        var        board     = (QF.Board)formatter.Deserialize(quixoStream);
                        this.board.Reset(board, null, null);
                        this.debugTextBox.Text = string.Empty;
                        this.UpdateGameStatus();
                    }
                }
                catch (ArgumentNullException) { }
                catch (SerializationException) { }
            }
        }
Пример #2
0
        private void OnFileSaveMenuItemClick(object sender, EventArgs e)
        {
            var saveDialog = new SaveFileDialog
            {
                Filter           = "Quixo files (*.quixo)|*.quixo",
                FilterIndex      = 1,
                RestoreDirectory = true
            };

            if (saveDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    using (var quixoStream = saveDialog.OpenFile())
                    {
                        IFormatter formatter = new QF.BoardFormatter();
                        formatter.Serialize(quixoStream, this.board.InternalBoard);
                    }
                }
                catch (ArgumentNullException) { }
                catch (SerializationException) { }
            }
        }
Пример #3
0
		private void OnFileSaveMenuItemClick(object sender, System.EventArgs e)
		{
			SaveFileDialog saveDialog = new SaveFileDialog();

			saveDialog.Filter = "Quixo files (*.quixo)|*.quixo";
			saveDialog.FilterIndex = 1;
			saveDialog.RestoreDirectory = true;

			if (saveDialog.ShowDialog() == DialogResult.OK)
			{
				try
				{
					using (Stream quixoStream = saveDialog.OpenFile())
					{
						IFormatter formatter = new QF.BoardFormatter();
						formatter.Serialize(quixoStream, this.board.InternalBoard);
					}
				}
				catch (ArgumentNullException) { }
				catch (SerializationException) { }
			}
		}
Пример #4
0
		private void OnFileOpenMenuItemClick(object sender, System.EventArgs e)
		{
			OpenFileDialog openDialog = new OpenFileDialog();

			openDialog.Filter = "Quixo files (*.quixo)|*.quixo";
			openDialog.FilterIndex = 1;
			openDialog.RestoreDirectory = true;

			if (openDialog.ShowDialog() == DialogResult.OK)
			{
				try
				{
					using (Stream quixoStream = openDialog.OpenFile())
					{
						IFormatter formatter = new QF.BoardFormatter();
						QF.Board board = (QF.Board)formatter.Deserialize(quixoStream);
						this.board.Reset(board, null, null);
						this.debugTextBox.Text = string.Empty;
						this.UpdateGameStatus();
					}
				}
				catch (ArgumentNullException) { }
				catch (SerializationException) { }
			}
		}