Exemple #1
0
        public mainForm()
        {
            InitializeComponent();
            //Maximize Window and adjust sizes
            this.WindowState = FormWindowState.Maximized;
            ratioX           = (1700 / Screen.FromControl(this).WorkingArea.Width);
            ratioY           = (820 / Screen.FromControl(this).WorkingArea.Height);

            //panel enums, used to control what panel is active or was active
            currentPanel = panelAct.mainForm;
            lastPanel    = panelAct.editSettings;
            //Data manager
            DataManager = new dataManager();

            #region Create Forms
            NewMovie     = new newMovie(DataManager);
            SearchMovie  = new searchMovie(DataManager);
            ViewMovie    = new viewMovie(DataManager);
            EditMovie    = new editMovie(DataManager);
            EditSettings = new editSettings(DataManager);
            #endregion

            #region Setup Forms
            NewMovie.VerticalScroll.Enabled     = false;
            ViewMovie.VerticalScroll.Enabled    = false;
            EditMovie.VerticalScroll.Enabled    = false;
            EditSettings.VerticalScroll.Enabled = false;
            SearchMovie.VerticalScroll.Enabled  = false;
            mainPanel.VerticalScroll.Enabled    = false;
            this.VerticalScroll.Enabled         = false;
            NewMovie.Dock     = DockStyle.Bottom;
            EditSettings.Dock = DockStyle.Bottom;
            ViewMovie.Dock    = DockStyle.Bottom;
            EditMovie.Dock    = DockStyle.Bottom;
            #endregion

            mainPanel.Controls.Add(SearchMovie);



            #region Delegates
            EditMovie.deleteEntry += delegate(object sender, EventArgs e) //EditMovie>Delete Button
            {
                toggleControls(panelAct.mainForm);
                newMovieButton.Text = "New Movie";
                EditMovie.clearAll();
                SearchMovie.searchButton_Click(null, null);
            };

            ViewMovie.actorEvent += delegate(object sender, EventArgs e) //ViewMovie>Double Click Actor
            {
                SearchMovie.actorSearch((string)sender);
                toggleControls(panelAct.mainForm);
                newMovieButton.Text = "New Movie";
                ViewMovie.clearAll();
            };

            ViewMovie.viewEdit += delegate(object sender, EventArgs e) //ViewMovie>Edit Button
            {
                EditMovie.editItem((info)sender);
                toggleControls(panelAct.editMovie);
            };

            EditSettings.sendEdit += delegate(object sender, EventArgs e) //EditSettings>Commit Button
            {
                toggleControls(lastPanel);
            };

            EditMovie.sendEdit += delegate(object sender, EventArgs e) //EditMovie>Send Edit Button
            {
                ViewMovie.viewItem((info)sender);
                toggleControls(panelAct.viewMovie);
                newMovieButton.Text = "Back";
            };

            SearchMovie.viewItem += delegate(object sender, MouseEventArgs e) //SearchMovie>Double Click Title
            {
                ViewMovie.viewItem((info)sender);
                toggleControls(panelAct.viewMovie);
                newMovieButton.Text = "Back";
            };

            NewMovie.movieAdded += delegate //NewMovie>Movie Was Added Statement (Called from Add Movie Button)
            {
                newMovieButton_Click(null, null);
            };

            #endregion

            //Stage is set, this adjusts sizes of all panels that require resizing
            resizeEndEvent_CorrectSizes(null, null);
        }
Exemple #2
0
        public mainForm()
        {
            InitializeComponent();

            try
            {
                if (!Directory.Exists("Errors"))
                {
                    Directory.CreateDirectory("Errors");
                }

                if (!Directory.Exists("Images"))
                {
                    Directory.CreateDirectory("Images");
                }

                if (!Directory.Exists("Images/Movies"))
                {
                    Directory.CreateDirectory("Images/Movies");
                }
            }
            catch (Exception err)
            {
                MessageBox.Show("Error", err.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            ap = panelAct.mainForm;

            //Data manager
            dm = new dataManager();

            #region Create Forms
            NewMovie = new newMovie(dm);
            SearchMovie = new searchMovie(dm);
            ViewMovie = new viewMovie(dm);
            EditMovie = new editMovie(dm);
            EditSettings = new editSettings(dm);
            #endregion

            #region Setup Forms
            NewMovie.VerticalScroll.Enabled = false;
            ViewMovie.VerticalScroll.Enabled = false;
            EditMovie.VerticalScroll.Enabled = false;
            EditSettings.VerticalScroll.Enabled = false;
            SearchMovie.VerticalScroll.Enabled = false;
            mainPanel.VerticalScroll.Enabled = false;
            this.VerticalScroll.Enabled = false;
            NewMovie.Dock = DockStyle.Bottom;
            EditSettings.Dock = DockStyle.Bottom;
            ViewMovie.Dock = DockStyle.Bottom;
            EditMovie.Dock = DockStyle.Bottom;
            #endregion

            mainPanel.Controls.Add(SearchMovie);

            resizeEndEvent_CorrectSizes(null, null);

            #region Delegates
            EditMovie.deleteEntry += delegate(object sender, EventArgs e)
            {
                ap = panelAct.mainForm;
                toggleControls();
                newMovieButton.Text = "New Movie";
                EditMovie.clearAll();
                SearchMovie.searchButton_Click(null, null);
            };

            ViewMovie.actorEvent += delegate(object sender, EventArgs e)
            {
                ap = panelAct.mainForm;
                toggleControls();
                newMovieButton.Text = "New Movie";
                ViewMovie.clearAll();
                SearchMovie.actorSearch((string)sender);
            };

            ViewMovie.viewEdit += delegate(object sender, EventArgs e)
            {
                ap = panelAct.editMovie;
                toggleControls();
                newMovieButton.Text = "Back";
                ViewMovie.clearAll();
                EditMovie.editItem((simpleMovie)sender);
            };

            EditSettings.sendEdit += delegate(object sender, EventArgs e)
            {
                ap = panelAct.mainForm;
                toggleControls();

            };

            EditMovie.sendEdit += delegate(object sender, EventArgs e)
            {
                ap = panelAct.viewMovie;
                toggleControls();
                newMovieButton.Text = "Back";
                ViewMovie.viewItem((simpleMovie)sender);
            };

            SearchMovie.viewItem += delegate(object sender, MouseEventArgs e)
            {
                ap = panelAct.viewMovie;
                toggleControls();
                newMovieButton.Text = "Back";
                ViewMovie.viewItem((simpleMovie)sender);
            };

            NewMovie.movieAdded += delegate
            {
                newMovieButton_Click(null, null);
            };

            #endregion

            this.WindowState = FormWindowState.Maximized;
        }
Exemple #3
0
        public mainForm()
        {
            InitializeComponent();
            //Maximize Window and adjust sizes
            this.WindowState = FormWindowState.Maximized;
            ratioX = (1700 / Screen.FromControl(this).WorkingArea.Width);
            ratioY = (820 / Screen.FromControl(this).WorkingArea.Height);

            //panel enums, used to control what panel is active or was active
            currentPanel = panelAct.mainForm;
            lastPanel = panelAct.editSettings;
            //Data manager
            DataManager = new dataManager();

            #region Create Forms
            NewMovie = new newMovie(DataManager);
            SearchMovie = new searchMovie(DataManager);
            ViewMovie = new viewMovie(DataManager);
            EditMovie = new editMovie(DataManager);
            EditSettings = new editSettings(DataManager);
            #endregion

            #region Setup Forms
            NewMovie.VerticalScroll.Enabled = false;
            ViewMovie.VerticalScroll.Enabled = false;
            EditMovie.VerticalScroll.Enabled = false;
            EditSettings.VerticalScroll.Enabled = false;
            SearchMovie.VerticalScroll.Enabled = false;
            mainPanel.VerticalScroll.Enabled = false;
            this.VerticalScroll.Enabled = false;
            NewMovie.Dock = DockStyle.Bottom;
            EditSettings.Dock = DockStyle.Bottom;
            ViewMovie.Dock = DockStyle.Bottom;
            EditMovie.Dock = DockStyle.Bottom;
            #endregion

            mainPanel.Controls.Add(SearchMovie);

            #region Delegates
            EditMovie.deleteEntry += delegate(object sender, EventArgs e) //EditMovie>Delete Button
            {
                toggleControls(panelAct.mainForm);
                newMovieButton.Text = "New Movie";
                EditMovie.clearAll();
                SearchMovie.searchButton_Click(null, null);
            };

            ViewMovie.actorEvent += delegate(object sender, EventArgs e) //ViewMovie>Double Click Actor
            {
                SearchMovie.actorSearch((string)sender);
                toggleControls(panelAct.mainForm);
                newMovieButton.Text = "New Movie";
                ViewMovie.clearAll();

            };

            ViewMovie.viewEdit += delegate(object sender, EventArgs e) //ViewMovie>Edit Button
            {
                EditMovie.editItem((info)sender);
                toggleControls(panelAct.editMovie);
            };

            EditSettings.sendEdit += delegate(object sender, EventArgs e) //EditSettings>Commit Button
            {

                toggleControls(lastPanel);

            };

            EditMovie.sendEdit += delegate(object sender, EventArgs e) //EditMovie>Send Edit Button
            {
                ViewMovie.viewItem((info)sender);
                toggleControls(panelAct.viewMovie);
                newMovieButton.Text = "Back";

            };

            SearchMovie.viewItem += delegate(object sender, MouseEventArgs e) //SearchMovie>Double Click Title
            {
                ViewMovie.viewItem((info)sender);
                toggleControls(panelAct.viewMovie);
                newMovieButton.Text = "Back";

            };

            NewMovie.movieAdded += delegate //NewMovie>Movie Was Added Statement (Called from Add Movie Button)
            {
                newMovieButton_Click(null, null);
            };

            #endregion

            //Stage is set, this adjusts sizes of all panels that require resizing
            resizeEndEvent_CorrectSizes(null, null);
        }