Пример #1
0
        public DuplicatesWindow(Bitmap origFileThumbnail, string origFileName, List <Element> duplicatesList) : this()
        {
            OrigImage.Source  = ImgConverter.BitmapToImageSource(origFileThumbnail);
            OrigFileName.Text = origFileName;

            listView.ItemsSource = new BindingList <Element>(duplicatesList.OrderByDescending(x => x.Type).ToList());
        }
Пример #2
0
        public PropertiesWindow(List <Element> elements) : this()
        {
            Title = "Свойства: ";
            for (int i = 0; i < Math.Min(elements.Count, 3); i++)
            {
                Title += (i < (Math.Min(elements.Count, 3) - 1)) ? elements[i].Name + ", " : elements.Count > 3 ? elements[i].Name + "..." : elements[i].Name;
            }

            ulong data_size;
            ulong fullSize;
            ulong fullEncryptSize;

            GetSize(elements, out data_size, out fullSize, out fullEncryptSize);
            ParentLabel.Text          = GetPath(elements);
            FilesCountLabel.Text      = GetFilesCount(elements).ToString("#,0");
            DirsCountLabel.Text       = GetDirsCount(elements).ToString("#,0");
            SizeLabel.Text            = SizeToStr(data_size) + " (" + data_size.ToString("#,0") + " байт)";
            FullSizeLabel.Text        = SizeToStr(fullSize) + " (" + fullSize.ToString("#,0") + " байт)";
            FullEncryptSizeLabel.Text = SizeToStr(fullEncryptSize) + " (" + fullEncryptSize.ToString("#,0") + " байт)";

            if (elements.Count == 1)
            {
                element          = elements[0];
                Thumbnail.Source = ImgConverter.BitmapToImageSource(element.Icon);
            }
            else
            {
                IconRow.Height = new GridLength(0, GridUnitType.Pixel);
            }
        }
Пример #3
0
 private void SetThumbnail(Bitmap thumbnail)
 {
     image.Source = ImgConverter.BitmapToImageSource(thumbnail);
     _bitmap?.Dispose();
     _bitmap = thumbnail;
     slider.Focus();
 }
Пример #4
0
        private void ChangeIcon_Button_Click(object sender, RoutedEventArgs e)
        {
            if (element == null)
            {
                return;
            }

            OpenFileDialog op = new OpenFileDialog();

            if (op.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Bitmap bmp = ImgConverter.GetIcon(op.FileName, MainWindow.thumbnailSize);
                element.Icon     = bmp;
                Thumbnail.Source = ImgConverter.BitmapToImageSource(bmp);
                bmp?.Dispose();
            }
            op.Dispose();
        }