Exemplo n.º 1
0
        public override IEnumerable <Media> HandleMultiple(IEnumerable <Uri> uris)
        {
            Controller.FocusMainWindow(false);

            var res = MessageBox.Show(Resource.imgMsgMultipleCreateSlideshow, Resource.imgMsgMultipleCreateSlideshowTitle, MessageBoxButton.YesNoCancel);

            if (res == MessageBoxResult.Yes)
            {
                var dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.DefaultExt       = ".show";
                dlg.Filter           = "Diashow|*.show";       // TODO: localize
                dlg.InitialDirectory = Properties.Settings.Default.LastMediaDirectory;

                if (dlg.ShowDialog() == true)
                {
                    Properties.Settings.Default.LastMediaDirectory = Path.GetDirectoryName(dlg.FileName);
                    var media = new ImagesMedia(new Uri(dlg.FileName));
                    media.CreateSlideshow(uris);
                    return(new Media[] { media });
                }
                else
                {
                    return(new Media[] { });
                }
            }
            else if (res == MessageBoxResult.No)
            {
                return(uris.Select(u => Handle(u, null))); // add them one by one
            }
            else                                           // cancelled -> add nothing
            {
                return(new Media[] { });
            }
        }
Exemplo n.º 2
0
        public override IEnumerable<Media> HandleMultiple(IEnumerable<Uri> uris)
        {
            Controller.FocusMainWindow(false);

            var res = MessageBox.Show(Resource.imgMsgMultipleCreateSlideshow, Resource.imgMsgMultipleCreateSlideshowTitle, MessageBoxButton.YesNoCancel);
            if (res == MessageBoxResult.Yes)
            {
                var dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.DefaultExt = ".show";
                dlg.Filter = "Diashow|*.show"; // TODO: localize
                dlg.InitialDirectory = Properties.Settings.Default.LastMediaDirectory;

                if (dlg.ShowDialog() == true)
                {
                    Properties.Settings.Default.LastMediaDirectory = Path.GetDirectoryName(dlg.FileName);
                    var media = new ImagesMedia(new Uri(dlg.FileName));
                    media.CreateSlideshow(uris);
                    return new Media[] { media };
                }
                else
                {
                    return new Media[] { };
                }
            }
            else if (res == MessageBoxResult.No)
            {
                return uris.Select(u => Handle(u, null)); // add them one by one
            }
            else // cancelled -> add nothing
            {
                return new Media[] { };
            }
        }
Exemplo n.º 3
0
 public void Init(Core.Media media)
 {
     if (media is ImagesMedia)
     {
         this.media            = (ImagesMedia)media;
         pres                  = Controller.PresentationManager.CreatePresentation <ImagesPresentation>();
         pres.LoadingFinished += pres_LoadingFinished;
         Controller.PresentationManager.CurrentPresentation = pres;
         this.DataContext = this;
         if (this.media.Images.Count > 0)
         {
             this.slideListView.SelectedIndex = 0;
         }
     }
     else
     {
         throw new ArgumentException("media is not a valid images media.");
     }
 }
 public void Init(Core.Media media)
 {
     if (media is ImagesMedia)
     {
         this.media = (ImagesMedia)media;
         pres = Controller.PresentationManager.CreatePresentation<ImagesPresentation>();
         pres.LoadingFinished += pres_LoadingFinished;
         Controller.PresentationManager.CurrentPresentation = pres;
         this.DataContext = this;
         if (this.media.Images.Count > 0)
             this.slideListView.SelectedIndex = 0;
     }
     else
     {
         throw new ArgumentException("media is not a valid images media.");
     }
 }
Exemplo n.º 5
0
 public override int TestMultiple(IEnumerable <Uri> uris)
 {
     return(uris.All(u => ImagesMedia.IsValidImageUri(u)) ? 100 : -1);
 }
Exemplo n.º 6
0
        private void slideListView_DragEnterOrOver(object sender, System.Windows.DragEventArgs e)
        {
            int i = GetIndexAtPosition(e.GetPosition(slideListView));

            this.RemoveInsertionAdorner();

            if (i >= 0)
            {
                if (slideListView.HasItems)
                {
                    var container = slideListView.ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement;
                    this.CreateInsertionAdorner(container, e.GetPosition(container).IsInFirstHalf(container, false));
                }

                if (e.Data.GetData(typeof(ImageInfo)) != null)
                {
                    e.Effects = DragDropEffects.Move;
                }
                else if (e.Data.GetData(DataFormats.FileDrop) != null &&
                         ((string[])e.Data.GetData(DataFormats.FileDrop)).Where((f) => ImagesMedia.IsValidImageUri(new Uri(f))).Any())
                {
                    e.Effects = DragDropEffects.Copy;
                }
                else
                {
                    e.Effects = DragDropEffects.None;
                }
            }
            else
            {
                e.Effects = DragDropEffects.None;
            }

            e.Handled = true;
        }