aboutsummaryrefslogtreecommitdiff
path: root/Histacom2/OS/Win98/Win98Apps/AddressBook/FRMWinClassicAddressBookNewContact.cs
blob: 45384fa1875e0d941a70d243ad71046252fc5593 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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
{
    public partial class FRMWinClassicAddressBookNewContact : UserControl
    {
        WindowManager wm = new WindowManager();
        public AddressBookContact toSet = new AddressBookContact();
        public FRMWinClassicAddressBookNewContact()
        {
            InitializeComponent();
            Program.AddressBookSelectedContact = null;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            pnlAdd.Show();
            pnlAdd.BringToFront();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (txtFirst.Text != "" && txtMiddle.Text != "" && txtLast.Text != "")
            {
                toSet.FirstName = txtFirst.Text;
                toSet.MiddleName = txtMiddle.Text;
                toSet.LastName = txtLast.Text;

                Program.AddressBookSelectedContact = toSet;
                ((Form)this.TopLevelControl).Close();
            } else {
                wm.StartInfobox95("Address Book", "Please fill out the First, Middle and Last name.", Engine.Template.InfoboxType.Info, Engine.Template.InfoboxButtons.OK);
            }           
        }

        private void button4_Click(object sender, EventArgs e)
        {
            emails.Items.Add(textBox1.Text);
            toSet.Emails.Add(textBox1.Text);
            emails.BringToFront();
        }

        private void FRMWinClassicAddressBookNewContact_Load(object sender, EventArgs e)
        {
            if (toSet != null)
            {
                txtFirst.Text = toSet.FirstName;
                txtMiddle.Text = toSet.MiddleName;
                txtLast.Text = toSet.LastName;
                if (toSet.Emails != null)
                {
                    foreach (string email in toSet.Emails)
                    {
                        emails.Items.Add(email);
                    }
                }
            }
        }
    }
}