Exemple #1
0
        private void LoadItems()
        {
            using (Data.SQLiteDatabase db = new Data.SQLiteDatabase(System.AppDomain.CurrentDomain.BaseDirectory, "Focasa.db"))
            {
                frmParent.FocasaItems = db.GetDataTable("SELECT * FROM focasaItems");
            }

            DataView view = new DataView(frmParent.FocasaItems);

            view.Sort = "path asc";
            DataTable distinctValues = view.ToTable(true, "path");
            string    currentFolder  = null;

            foreach (DataRow drow in distinctValues.Rows)
            {
                if (drow.RowState != DataRowState.Deleted)
                {
                    ucFolderRepresentation ucFolder = null;
                    if (currentFolder == null || currentFolder != drow["path"].ToString())
                    {
                        ucFolder = new ucFolderRepresentation(main, drow["path"].ToString());
                        flpPictures.Controls.Add(ucFolder);
                        currentFolder = drow["path"].ToString();
                    }

                    DataRow[] items = frmParent.FocasaItems.Select("path='" + drow["path"].ToString() + "'");
                    foreach (DataRow item in items)
                    {
                        ucPictureRepresentation ucPicture = new ucPictureRepresentation(main, item["path"].ToString(), item["name"].ToString(), Base64ToImage(item["thumbnail"].ToString()), item["exif"].ToString());
                        ucFolder.Images.Controls.Add(ucPicture);
                    }
                }
            }

            foreach (TreeNode n in tvFolders.Nodes)
            {
                n.Expand();
            }
        }
Exemple #2
0
        private void LoadItems()
        {
            using (Data.SQLiteDatabase db = new Data.SQLiteDatabase(System.AppDomain.CurrentDomain.BaseDirectory, "Focasa.db"))
            {
                frmParent.FocasaItems = db.GetDataTable("SELECT * FROM focasaItems");
            }

            DataView view = new DataView(frmParent.FocasaItems);
            view.Sort = "path asc";
            DataTable distinctValues = view.ToTable(true, "path");
            string currentFolder = null;

            foreach (DataRow drow in distinctValues.Rows)
            {
                if (drow.RowState != DataRowState.Deleted)
                {
                    ucFolderRepresentation ucFolder = null;
                    if (currentFolder == null || currentFolder != drow["path"].ToString())
                    {
                        ucFolder = new ucFolderRepresentation(main, drow["path"].ToString());
                        flpPictures.Controls.Add(ucFolder);
                        currentFolder = drow["path"].ToString();
                    }

                    DataRow[] items = frmParent.FocasaItems.Select("path='" + drow["path"].ToString() + "'");
                    foreach (DataRow item in items)
                    {
                        ucPictureRepresentation ucPicture = new ucPictureRepresentation(main, item["path"].ToString(), item["name"].ToString(), Base64ToImage(item["thumbnail"].ToString()), item["exif"].ToString());
                        ucFolder.Images.Controls.Add(ucPicture);
                    }

                }
            }

            foreach (TreeNode n in tvFolders.Nodes)
            {
                n.Expand();
            }
        }