Example #1
0
        private void OnFileListChanged(object o, string[] files)
        {
            Application.Current.Dispatcher.BeginInvoke(new System.Action(() =>
            {
                TerminaFiles.Clear();
                foreach (var file in files)
                {
                    TerminaFiles.Add(file);
                }

                ImageFiles.Clear();
                var images = TerminaFiles.Where(x => Path.GetExtension(x) == ".png").ToList();
                images.ForEach(x => ImageFiles.Add(x));
                ImageFile = ImageFiles.FirstOrDefault();
            }));
        }
Example #2
0
        public void AddImageFile(ImageFile imageFile)
        {
            if (!CanAddImageFile(imageFile))
            {
                throw new ArgumentException();
            }

            ImageFiles.Add(imageFile);
            SizeInBytes += imageFile.SizeInBytes;

            var drive = imageFile.Path.Substring(0, 2);

            if (!_imageFileCountByDrive.ContainsKey(drive))
            {
                _imageFileCountByDrive[drive] = 0;
            }
            else
            {
                _imageFileCountByDrive[drive] = _imageFileCountByDrive[drive] + 1;
            }
        }
Example #3
0
        private void OnClickButton_AddImage(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName   = "Document";                          // Default file name
            dlg.DefaultExt = ".png";                              // Default file extension
            dlg.Filter     = "Image Files PNG|*.png;*.tif;*tiff"; // Filter files by extension

            // Show save file dialog box
            Nullable <bool> result = dlg.ShowDialog();

            // Process save file dialog box results
            if (result == true)
            {
                string full = dlg.FileName;
                string file = full.Substring(full.LastIndexOf(System.IO.Path.DirectorySeparatorChar));
                file = file.Substring(1, file.Length - 1);

                listboxImages.Items.Add(file);
                ImageFiles.Add(file);
            }
        }