コード例 #1
0
        public ScrollViewer(string shortinfo, string directory)
        {
            InitializeComponent();

            Title = shortinfo;

            Task.Run(() =>
            {
                Thread.Sleep(100);
                int cnt = 0;

                var comp  = new Strings.NaturalComparer();
                var files = Directory.GetFiles(directory).ToList();
                files.Sort((x, y) => comp.Compare(x, y));

                foreach (var file in files)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        var image = new CachedImage();
                        ViewStack.Children.Add(image);
                        image.Margin = new Thickness(4, 4, 4, 4);
                        image.DownsampleToViewSize = true;
                        image.Success += (s, e) =>
                        {
                            var h = e.ImageInformation.OriginalHeight;
                            var w = e.ImageInformation.OriginalWidth;

                            if (Width > w)
                            {
                                image.HeightRequest = h;
                                image.WidthRequest  = w;
                            }
                            else
                            {
                                image.WidthRequest  = Width;
                                image.HeightRequest = Width * h / w;
                            }
                        };
                        image.IsVisible = true;
                        image.Source    = file;
                    });
                    Thread.Sleep(500);

                    if (++cnt >= 20)
                    {
                        break;
                    }
                }
            });
        }
コード例 #2
0
        public SubdirSelector(DownloadDBModel dbm)
        {
            InitializeComponent();

            Titles = new List <string>();

            var comp    = new Strings.NaturalComparer();
            var folders = Directory.GetDirectories(dbm.Directory).ToList();

            Title     = dbm.ShortInfo;
            superpath = dbm.Directory;
            folders.Sort((x, y) => comp.Compare(x, y));
            folders.ForEach(x => Titles.Add(Path.GetFileName(x)));

            BindingContext = this;
        }
コード例 #3
0
        public ScrollViewer(string shortinfo, string directory)
        {
            InitializeComponent();

            Title = shortinfo;

            Images           = new List <imgs>();
            List.ItemsSource = Images;

            var comp  = new Strings.NaturalComparer();
            var files = Directory.GetFiles(directory).ToList();

            files.Sort((x, y) => comp.Compare(x, y));

            foreach (var file in files)
            {
                Images.Add(new imgs {
                    Path = file
                });
            }
        }