Exemplo n.º 1
0
        private void findImagesInDirectory(string path)
        {
            List <string> pathf     = new List <string>();
            List <string> filenames = new List <string>();

            string[] files = Directory.GetFiles(path);
            foreach (string s in files)
            {
                if (s.EndsWith(".mp4") || s.EndsWith(".avi") || s.EndsWith(".mpg") || s.EndsWith(".mts") || s.EndsWith(".m2ts") || s.EndsWith(".mkv") || s.EndsWith(".3gp") || s.EndsWith(".flv") || s.EndsWith(".wmv"))
                {
                    pathf.Add(s);
                    filenames.Add(s.Remove(0, path.Length + 1));
                }
            }
            List <Table> tables = new List <Table>();

            for (int i = 0; i < filenames.Count; i++)
            {
                tables.Add(new Table()
                {
                    Id = 0, Name = filenames[i], Desciption = ""
                });
                tables[i].Source = @"..\..\Images s Video/" + tables[i].Name;
            }
            for (int i = 0; i < tables.Count; i++)
            {
                if (!File.Exists(@"..\..\Images s Video/" + tables[i].Name))
                {
                    File.Copy(pathf[i], @"..\..\Images s Video/" + tables[i].Name);
                    tables[i].Name = tables[i].Name.Substring(0, tables[i].Name.Length - 4);
                    DataVMs.Add(new DataVM(tables[i]));
                    FileDBExist();
                }
            }
        }
Exemplo n.º 2
0
        void LoadData()
        {
            DataVMs.Clear();
            dynamic taskses = database.Tables.ToList();

            foreach (var el in taskses)
            {
                DataVMs.Add(new DataVM(el));
            }
        }