예제 #1
0
        private void fillGui(bool firstRun, bool random = false)
        {
            try
            {
                int count = 0;
                if (random)
                {
                    List <Media> tempList = new List <Media>();
                    grvContent.Adapter = null;
                    grvContent.Adapter = new ImageAdapter(this, tempList, picturePath);
                    grvContent.Adapter = new ImageAdapter(this, current, picturePath);
                    count     = current.Count();
                    isSuggest = true;
                }
                else if (isSearch)
                {
                    grvContent.Adapter = new ImageAdapter(this, current, picturePath);
                    count = current.Count();
                }

                else
                {
                    if (isSuggest)
                    {
                        mt.resetFilter();
                        isSuggest = false;
                    }
                    if (firstRun)
                    {
                        current = mt.createDefaultView();
                    }
                    else
                    {
                        current = mt.getFilteredList();
                    }

                    grvContent.Adapter = new ImageAdapter(this, current, picturePath);
                    count = current.Count();
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, "Lass den Mist!", ToastLength.Short).Show();
                Toast.MakeText(this, "Fehler: " + ex.Message, ToastLength.Short).Show();
            }
        }
예제 #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            fileName       = Application.StartupPath + "\\filme.csv";
            backupFileName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\filme_backup.csv";
            picturePath    = Application.StartupPath + @"\images\";
            if (Environment.UserName.ToLower() == "patrick")
            {
                picturePath = @"D:\Patrick\Bilder\kamera\Amsterdam August 2012\";
            }
            Point location   = Properties.Settings.Default.Location;
            Size  windowSize = Properties.Settings.Default.Size;

            this.Location = location;
            if (windowSize.Width != 0 && windowSize.Height != 0)
            {
                this.Height = windowSize.Height;
                this.Width  = windowSize.Width;
            }



            try
            {
                mt = new mediaTools(fileName, picturePath, backupFileName);
                List <string> genres = mt.getGenreList();
                genres.Sort();
                foreach (string genre in genres)
                {
                    if (genre.Length > 0)
                    {
                        /*cbcGenre.Items.Add(genre);
                         * cbcGenreAdd.Items.Add(genre);*/
                    }
                }
                currentList = mt.getFilteredList();
                fillGui(currentList);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Beim Einlesen der Datei ist folgender Fehler aufgetreten:" + Environment.NewLine + ex.Message);
            }
        }
예제 #3
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            List <string> selectedGenres = new List <string>();
            List <string> args           = new List <string>();

            if (!tbxLink.Text.ToLower().StartsWith("http://") && !tbxLink.Text.ToLower().StartsWith("https://"))
            {
                tbxLink.Text = "http://" + tbxLink.Text;
            }
            //Media m;

            args.AddRange(new string[] { tbxName.Text, tbxLink.Text, dtpWatchdate.Value.ToShortDateString() });
            args.Add(nudRating.Value.ToString());
            if (rbnMovie.Checked)
            {
                args.Add("Film");
                args.Add("0");
            }
            else if (rbnSeries.Checked)
            {
                args.AddRange(new string[] { "Serie", nudParts.Value.ToString() });
            }
            else
            {
                args.AddRange(new string[] { "Anime", nudParts.Value.ToString() });
            }

            args.Add(pictureName);

            if (cbxAddWishList.Checked)
            {
                args.AddRange(new string[] { "True", DateTime.MinValue.ToString() });
            }
            else
            {
                args.Add("False");
            }

            /*if(cbcGenreAdd.Text.Length>0)
             * {
             *  HashSet<string> hSelectecGenres = cbcGenreAdd.Text.Split(',').Select(s => s.Trim()).ToHashSet();
             *  selectedGenres = hSelectecGenres.ToList();
             *
             *  if(selectedGenres.Count>1)
             *  {
             *      foreach (string genre in selectedGenres)
             *      {
             *          selectedGenresText += genre.Trim() + "|";
             *      }
             *  }
             *  else
             *  {
             *      selectedGenresText = selectedGenres[0];
             *  }
             *
             * }*/
            args.Add(selectedGenresText);

            if (lastWatch != DateTime.MinValue)
            {
                args.Add(lastWatch.ToShortDateString());
            }
            else
            {
                args.Add(dtpWatchdate.Value.ToShortDateString());
            }

            try
            {
                if (mt.createNewEntry(args.ToArray(), pictureSourcePath, currentid))
                {
                    tmrHide.Start();
                    pbxOK.Visible = true;
                    fillGui(mt.getFilteredList());
                    changeEditMode();
                    alreadyclicked = false;
                }
                else
                {
                    MessageBox.Show("Datei konnte nicht gespeichert werden!", "Fehler beim Speichern", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Du machst was falsch! Folgender Fehler ist aufgetreten: " + ex.Message);
            }
        }
예제 #4
0
        private void btnFilterMovie_Click(object sender, EventArgs e)
        {
            logging.Debug("btnFilterMovie wurde gedrückt");
            changeHighlighting((Control)sender, true);
            changeHighlighting(btnShowAll, false);
            livMedia.Visible = true;
            currentType      = "movie";
            if (!performaceBoost)
            {
                movies.Clear();
                List <Media> loopList = new List <Media>();
                string[]     types    = new string[3] {
                    "Film", "", ""
                };
                mt.filterList(types, true);
                movies.AddRange(mt.getFilteredList());
                mt.filterList(types, false);
                movies.AddRange(mt.getFilteredList());
                loopList.AddRange(movies);
                foreach (Media m in loopList)
                {
                    if (m.type != types[0])
                    {
                        movies.Remove(m);
                    }
                }
            }

            fillGui(movies);
        }
예제 #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            fileName       = Application.StartupPath + "\\filme.csv";
            backupFileName = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\filme_backup.csv";
            picturePath    = Application.StartupPath + @"\images\";
            if (Environment.UserName.ToLower() == "patrick")
            {
                picturePath = @"D:\Patrick\Bilder\kamera\Amsterdam August 2012\";
            }
            Point location   = Properties.Settings.Default.Location;
            Size  windowSize = Properties.Settings.Default.Size;

            this.Location = location;
            if (windowSize.Width != 0 && windowSize.Height != 0)
            {
                this.Height = windowSize.Height;
                this.Width  = windowSize.Width;
            }


            /*if (File.Exists(fileName))
             * {
             *  try
             *  {
             *      entrys = File.ReadAllLines(fileName).ToList();
             *      foreach (string entry in entrys)
             *      {
             *          string[] parts = entry.Split(';');
             *          Media m = new Media(freeId);
             *          freeId++;
             *          m.setName(parts[1]);
             *          m.setLink(parts[2]);
             *          m.setWatchDate(Convert.ToDateTime(parts[3]));
             *          if (parts[3] != "")
             *          {
             *              m.setRating(Convert.ToInt32(parts[4]));
             *          }
             *          else
             *          {
             *              m.setRating(0);
             *          }
             *          if (parts[5] == "Film")
             *          {
             *              m.setType("Film");
             *          }
             *          else if ((parts[5] == "Serie"))
             *          {
             *              m.setType("Serie");
             *              m.setParts(Convert.ToInt32(parts[6]));
             *          }
             *          else
             *          {
             *              m.setType("Anime");
             *              m.setParts(Convert.ToInt32(parts[6]));
             *          }
             *
             *          if (parts[7] != "")
             *          {
             *              m.setPicture(parts[7]);
             *          }
             *          if (parts.Count() > 8) //kompatibilität zur alten Liste ohne die Wunschliste/zuletzt geschaut
             *          {
             *              if (parts[8] != "")
             *              {
             *                  m.setWishlist(Convert.ToBoolean(parts[8]));
             *              }
             *              if(parts.Count()>9)
             *              {
             *
             *              }
             *
             *          }
             *          content.Add(m);
             *      }
             *
             *  }
             *  catch
             *  { }
             *  filteredList = content.FindAll(x=>x.wishList==false);
             *  randomList.AddRange(filteredList);
             *  randomList.Shuffle();*/

            try
            {
                mt = new mediaTools(fileName, picturePath, backupFileName);
                List <string> genres = mt.getGenreList();
                genres.Sort();
                foreach (string genre in genres)
                {
                    if (genre != "")
                    {
                        cbcGenre.Items.Add(genre);
                    }
                }
                currentList = mt.getFilteredList();
                fillGui(currentList);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Beim Einlesen der Datei ist folgender Fehler aufgetreten:" + Environment.NewLine + ex.Message);
            }

            //}
        }
예제 #6
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            List <string> args = new List <string>();

            if (!tbxLink.Text.ToLower().StartsWith("http://") && !tbxLink.Text.ToLower().StartsWith("https://"))
            {
                tbxLink.Text = "http://" + tbxLink.Text;
            }
            //Media m;

            args.AddRange(new string[] { tbxName.Text, tbxLink.Text, dtpWatchdate.Value.ToShortDateString() });
            args.Add(nudRating.Value.ToString());
            if (rbnMovie.Checked)
            {
                args.Add("Film");
                args.Add("0");
                //m = new Media(freeId, tbxName.Text, dtpWatchdate.Value, "Film");
                //freeId++;
            }
            else if (rbnSeries.Checked)
            {
                /*m = new Media(freeId, tbxName.Text, dtpWatchdate.Value, "Serie");
                 * m.setParts((int)nudParts.Value);
                 * freeId++;*/
                args.AddRange(new string[] { "Serie", nudParts.Value.ToString() });
            }
            else
            {
                /*m = new Media(freeId, tbxName.Text, dtpWatchdate.Value, "Anime");
                 * m.setParts((int)nudParts.Value);
                 * freeId++;*/
                args.AddRange(new string[] { "Anime", nudParts.Value.ToString() });
            }

            //if (tbxLink.Text != "") //m.setLink(tbxLink.Text);
            //if (nudRating.Value > 0)
            //{
            //m.setRating((int)nudRating.Value);
            //}

            //if (pictureName != "")
            //{
            //m.setPicture(pictureName);
            args.Add(pictureName);
            //}
            if (cbxAddWishList.Checked)
            {
                //m.setWishlist(true);
                //m.setWatchDate(DateTime.MinValue);
                args.AddRange(new string[] { "True", DateTime.MinValue.ToString() });
            }
            else
            {
                args.Add("False");

                //m.setWatchDate(dtpWatchdate.Value);
            }
            args.Add(selectedGenres);

            if (lastWatch != DateTime.MinValue)
            {
                args.Add(lastWatch.ToShortDateString());
            }
            else
            {
                args.Add(dtpWatchdate.Value.ToShortDateString());
            }
            //content.Add(m);
            //entrys.Add(createEntry(m));

            try
            {
                if (mt.createNewEntry(args.ToArray(), pictureSourcePath, currentid))
                {
                    tmrHide.Start();
                    pbxOK.Visible = true;
                    fillGui(mt.getFilteredList());
                }
                else
                {
                    MessageBox.Show("Datei konnte nicht gespeichert werden!", "Fehler beim Speichern", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Du machst was falsch! Folgender Fehler ist aufgetreten: " + ex.Message);
            }
        }