Пример #1
0
        //      int currentpos;


        //Color colBack = Color.FromArgb(54, 57, 63);
        //Color colFont = Color.FromArgb(224, 224, 224);
        protected override void OnCreate(pie.Bundle savedInstanceState)
        {
            fileName    = Path.Combine(pie.Environment.ExternalStorageDirectory.AbsolutePath, pie.Environment.DirectoryDocuments, "filme.csv");
            picturePath = Path.Combine(pie.Environment.ExternalStorageDirectory.AbsolutePath, pie.Environment.DirectoryPictures, "FilmDB");

            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            btnFilter                 = FindViewById <Button>(Resource.Id.btn_Filter);
            btnSuggest                = FindViewById <Button>(Resource.Id.btn_suggest);
            btnSearch                 = FindViewById <Button>(Resource.Id.btnSearch);
            cbxAnime                  = FindViewById <CheckBox>(Resource.Id.cbxAnime);
            cbxMovie                  = FindViewById <CheckBox>(Resource.Id.cbxMovie);
            cbxSeries                 = FindViewById <CheckBox>(Resource.Id.cbxSeries);
            cbxWischlist              = FindViewById <CheckBox>(Resource.Id.cbxWishlist);
            grvContent                = FindViewById <GridView>(Resource.Id.grvContent);
            mainLayout                = FindViewById <CoordinatorLayout>(Resource.Id.mainLayout);
            tbxSearch                 = FindViewById <EditText>(Resource.Id.tbxSearch);
            grvContent.ItemLongClick += itemLongClick;
            grvContent.ItemClick     += itemClick;
            //fab.Click += FabOnClick;
            btnFilter.Click    += btnFilter_Click;
            btnSearch.Click    += btnSearch_Click;
            btnSuggest.Click   += btnSuggest_Click;
            cbxAnime.Click     += cbxClicked;
            cbxMovie.Click     += cbxClicked;
            cbxSeries.Click    += cbxClicked;
            cbxWischlist.Click += cbxClicked;
            fab.Visibility      = ViewStates.Invisible;
            try
            {
                mt = new mediaTools(fileName, picturePath, "");
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, "beim Einlesen der CSV trat ein Fehler auf:" + Environment.NewLine + ex.Message, ToastLength.Short).Show();
            }

            tmrClickDelay.Enabled  = true;
            tmrClickDelay.Elapsed += OnTimedEvent;
            //randomList = mt.getRandomList();
            fillGui(true);

            /*ViewGroup.LayoutParams layoutParams = (ViewGroup.LayoutParams)grvContent.LayoutParameters;
             * layoutParams.Height = this.Resources.DisplayMetrics.HeightPixels - 130;
             * layoutParams.Width = this.Resources.DisplayMetrics.WidthPixels;
             * grvContent.LayoutParameters = layoutParams;*/
        }
Пример #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
        static void Main(string[] args)
        {
            string       csvPath         = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\filme.csv";
            mediaTools   mt              = new mediaTools(csvPath, "", "");
            List <Media> allEntrys       = mt.getAllEntrys();
            List <Media> convertedEntrys = new List <Media>();

            mt.clearFileList();
            foreach (Media m in allEntrys)
            {
                List <string> data = new List <string>();
                data.AddRange(new string[] { m.name, m.link, m.dateAdded.ToShortDateString(), m.rating.ToString(), m.type, m.parts.ToString(), m.pictureName, m.wishList.ToString(), m.genre });;
                if (m.wishList)
                {
                    data.Add("false;false");
                }
                else
                {
                    data.Add("false;true");
                }
                mt.convertEmtry(data.ToArray(), m.id);
            }
        }
Пример #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if ((ModifierKeys & Keys.Shift) != 0)
            {
                File.Delete(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath);
            }
            fileName = Application.StartupPath + "\\filme.csv";

            picturePath = Application.StartupPath + @"\images\";

            if (Environment.UserName.ToLower() == "patrick")
            {
                picturePath = @"Q:\Patrick\Bilder\kamera\Amsterdam August 2012\";
            }
            logging.Debug("Picturepath =" + picturePath);
            frm = new frmSettings(picturePath, fileName, "filme.csv");
            changeHighlighting(btnFilterAll, true);
            changeHighlighting(btnShowAll, false);
            try
            {
                mt = new mediaTools(fileName, picturePath, Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"filme_backup.csv", true);
                logging.Debug("mediatools Objekt erstellt");
                currentList = mt.getAllEntrys();
                movies      = mt.getMovies();
                series      = mt.getSeries();
                anime       = mt.getAnimes();
                logging.Debug("Listen für Film,Serie, Anime erstellt");
                List <string> genreList = mt.getGenreList();
                logging.Debug("genreList erstellt, Einträge:" + genreList.Count);
                foreach (string genre in genreList)
                {
                    lbxGenre.Items.Add(genre);
                    lbxGenreAdd.Items.Add(genre);
                }
                logging.Info("Alle Listen erfolgreich erstellt");
                fillGui(currentList);
            }

            catch (FileNotFoundException)
            {
                MessageBox.Show("Die CSV Datei wurde nicht gefunden");
                logging.Error("Die CSV Datei wurde nicht gefunden");
            }
            catch (InvalidCastException ex)
            {
                MessageBox.Show("Die Datei enthält ungültige Werte. Der Fehler trat an folgender Stelle auf: " + ex.Data[0].ToString());
                logging.Error("Die Datei enthält ungültige Werte. Der Fehler trat an folgender Stelle auf: " + ex.Data[0].ToString());
            }
            catch (FormatException ex)
            {
                string exData = "";
                foreach (DictionaryEntry de in ex.Data)
                {
                    exData = de.Value.ToString();
                }
                MessageBox.Show("Die Datei enthält ungültige Werte. Der Fehler trat an folgender Stelle auf: " + exData);
                logging.Error("Die Datei enthält ungültige Werte. Der Fehler trat an folgender Stelle auf: " + exData);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Beim Laden des Programms trat folgender Fehler auf: " + ex.Message + Environment.NewLine + ex.StackTrace);
                logging.Error("Beim Programmstart trat ein Fehler auf", ex);
            }
        }
Пример #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);
            }

            //}
        }