Esempio n. 1
0
        private void bEdit_Click(object sender, EventArgs e)
        {
            Functions.getInstance().CancelEdit = true;

            if (Functions.getInstance().FilmCount() == 0)
            {
                MessageBox.Show("No films to edit!");
                return;
            }
            Functions.getInstance().EditChange = true;
            fAddEdit edit = new fAddEdit();

            edit.Text = "Edit";

            edit.ShowDialog();
            edit.Dispose();
            Functions.getInstance().EditChange = false;

            if (Functions.getInstance().CancelEdit)
            {
                dGTable.Rows.Clear();

                for (int i = 0; i < Functions.getInstance().FilmCount(); i++)
                {
                    dGTable.Rows.Add(Functions.getInstance().GetFilm(i).Title, Functions.getInstance().GetFilm(i).Runtime, Functions.getInstance().GetFilm(i).Viewed);
                }
            }
        }
Esempio n. 2
0
        private void bAdd_Click(object sender, EventArgs e)
        {
            Functions.getInstance().CancelAdd = true;

            fAddEdit add = new fAddEdit();

            add.ShowDialog();

            add.Dispose();

            if (Functions.getInstance().CancelAdd)
            {
                dGTable.Invalidate();
                int lastIndex = Functions.getInstance().FilmCount() - 1;

                dGTable.Rows.Add(Functions.getInstance().GetFilm(lastIndex).Title, Functions.getInstance().GetFilm(lastIndex).Runtime, Functions.getInstance().GetFilm(lastIndex).Viewed);

                dGTable.Refresh();
            }
        }