Esempio n. 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="main">A reference to the main window of the app</param>
        public LoadPopup(MainWindow main)
        {
            _main = main;

            List <string> files = new List <string>(Directory.GetFiles(App.PhotoFolder));

            ArchivedImage[] images = new ArchivedImage[files.Count > FilesToDisplay ? FilesToDisplay : files.Count];


            files.Sort((x, y) =>
            {
                DateTime xd = File.GetLastWriteTime(x);
                DateTime yd = File.GetLastWriteTime(y);

                if (xd < yd)
                {
                    return(1);
                }
                if (xd > yd)
                {
                    return(-1);
                }
                return(0);
            });

            for (int i = 0; i < files.Count && i < FilesToDisplay; i++)
            {
                images[i] = new ArchivedImage(files[i]);
            }

            AvailableImages = new ReadOnlyCollection <ArchivedImage>(images);

            InitializeComponent();
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="main">A reference to the main window of the app</param>
        public LoadPopup(MainWindow main)
        {
            _main = main;

            List<string> files = new List<string>(Directory.GetFiles(App.PhotoFolder));
            ArchivedImage[] images = new ArchivedImage[files.Count > FilesToDisplay ? FilesToDisplay : files.Count];

            files.Sort((x, y) =>
                {
                    DateTime xd = File.GetLastWriteTime(x);
                    DateTime yd = File.GetLastWriteTime(y);

                    if (xd < yd) return 1;
                    if (xd > yd) return -1;
                    return 0;
                });

            for (int i = 0; i < files.Count && i < FilesToDisplay; i++)
                images[i] = new ArchivedImage(files[i]);

            AvailableImages = new ReadOnlyCollection<ArchivedImage>(images);

            InitializeComponent();
        }