aboutsummaryrefslogtreecommitdiff
path: root/Histacom2/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.cs
blob: f8a375c1b7b6a105f09b49b34a45c6f472bf342f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Histacom2.Engine;

namespace Histacom2.OS.Win95.Win95Apps.MineSweeper
{
    public partial class CustomMinefield : UserControl
    {
        private WinClassicMinesweeper _wcm;
        private WindowManager wm;

        public CustomMinefield(WinClassicMinesweeper wcm)
        {
            InitializeComponent();
            _wcm = wcm;
            wm = new WindowManager();
            for (int i = 8; i < 31; i++) comboBox1.Items.Add(i);
            for (int i = 8; i < 25; i++) comboBox2.Items.Add(i);
            for (int i = 10; i < 668; i++) comboBox3.Items.Add(i);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if ((int)comboBox1.SelectedItem * (int)comboBox2.SelectedItem <= (int)comboBox3.SelectedItem) wm.StartInfobox95("Oops!", "Too many mines!", Engine.Template.InfoboxType.Warning, Engine.Template.InfoboxButtons.OK);
            else
            {
                _wcm.customwidth = (int)comboBox1.SelectedItem;
                _wcm.customheight = (int)comboBox2.SelectedItem;
                _wcm.custommines = (int)comboBox3.SelectedItem;
                _wcm.calculateFormSize((int)comboBox1.SelectedItem, (int)comboBox2.SelectedItem);
                this.ParentForm.Close();
            }
        }
    }
}