Esempio n. 1
0
        public void AddFile(FileInfo aFileInfo)
        {
            AddImageEntity imageEntity = new AddImageEntity();

            imageEntity.FilePath = aFileInfo.FullName;
            imageEntity.FileName = aFileInfo.Name;

            BitmapImage bi;

            try
            {
                using (FileStream fs = new FileStream(imageEntity.FilePath, FileMode.Open))
                {
                    bi = new BitmapImage();
                    bi.SetSource(fs);
                }
            }
            catch
            {
                NotifyWindow notifyWindow = new NotifyWindow("错误", string.Format("打开图片文件 {0} 失败,请检查文件!", imageEntity.FilePath));
                notifyWindow.Show();
                return;
            }


            imageEntity.ThumbImage = bi;

            imageEntity.UpCommand     = new DelegateCommand(onUp);
            imageEntity.DownCommand   = new DelegateCommand(onDown);
            imageEntity.DeleteCommand = new DelegateCommand(onDelete);


            ImagesList.Add(imageEntity);
            UpdateChanged("ImagesList");
        }
Esempio n. 2
0
        private void onDown()
        {
            int i = SelectedFileIndex;

            if (i < 0 || i > ImagesList.Count - 2)
            {
                return;
            }

            AddImageEntity tempImageEntity = ImagesList[i];

            ImagesList.RemoveAt(i);
            ImagesList.Insert(i + 1, tempImageEntity);
        }