public ModifyListNameForm(string user)
 {
     InitializeComponent();
     editWindowTitle("Create List");
     list = null;
     this.user = user;
     fillPopup();
 }
 public ModifyListNameForm(MovieList list)
 {
     InitializeComponent();
     editWindowTitle("Edit List Name");
     this.list = list;
     this.user = null;
     nameBox.Text = list.name;
     fillPopup();
 }
 public ModifyListNameForm(long ID)
 {
     MovieList list = MovieListManager.getMovieList(ID);
     InitializeComponent();
     editWindowTitle("Edit List Name");
     this.list = list;
     this.user = null;
     nameBox.Text = list.name;
     fillPopup();
 }
 public RemoveFromListsForm(MovieList list)
 {
     InitializeComponent();
     editWindowTitle("Edit List");
     editTitle("Manage " + list.name);
     editSubTitle("");
     EditToolTip("Uncheck boxes to remove movies. Press Ok to save changes.");
     showActionButton(true);
     editActionButton("Search for a Movie");
     showTextBox(false);
     ml = list;
     fillOutForm(list);
 }
        public static List<FormError> createMovieList(string lname, string username)
        {
            List<FormError> errors = new List<FormError>();

            MovieList ml = new MovieList() { ID = DataAccess.generateID(), name = lname, user = username };

            if (ml.valid(errors))
            {
                List<MovieList> mls = DataAccess.readMovieLists();
                mls.Add(ml);
                DataAccess.writeMovieLists(mls);
            }

            return errors;
        }
        private void fillInForm(MovieList movieList)
        {
            listDataGrid.ColumnHeadersVisible = true;
            listTitleLabel.Text = movieList.name;
            listIDLabel.Hide();
            listIDLabel.Text = "" + movieList.ID;

            if(ApplicationManager.loggedIn != null && ApplicationManager.loggedIn.username.Equals(movieList.user))
            {
                editNameButton.Show();
                editContentsButton.Show();
                editOrderButton.Show();
            }
            else
            {
                editNameButton.Hide();
                editContentsButton.Hide();
                editOrderButton.Hide();
            }

            listDataGrid.DataSource = MovieManager.getMovies(movieList.movies);

            newListButton.Hide();
        }
        private void fillOutForm(MovieList list)
        {
            int i;

            foreach (string movie in list.movies)
            {
                box().Items.Add(movie);
            }

            for (i = 0; i < box().Items.Count; i++)
            {
                box().SetItemChecked(i, true);
            }
        }
        public static bool saveMovieList(MovieList list)
        {
            List<MovieList> lists = DataAccess.readMovieLists();
            int i = 0;

            while(i < lists.Count && lists[i].ID != list.ID)
            {
                i++;
            }

            if(i < lists.Count)
            {
                lists[i].movies = list.movies;
                DataAccess.writeMovieLists(lists);
            }

            return false;
        }