public static ImageViewerWindow Instance(UIElement imageElement) {
     ImageViewerWindow NewForm = new ImageViewerWindow();
     NewForm.ImgGrid.Children.Insert(0, imageElement);
     NewForm.AdjustImage();
     NewForm.Show();
     return NewForm;
 }
        public static ImageViewerWindow Instance(UIElement imageElement)
        {
            ImageViewerWindow NewForm = new ImageViewerWindow();

            NewForm.ImgGrid.Children.Insert(0, imageElement);
            NewForm.AdjustImage();
            NewForm.Show();
            return(NewForm);
        }
        public void OpenMedia(Media item) {
            this.Item = item;

            BitmapImage NewImage = new BitmapImage();
            NewImage.BeginInit();
            NewImage.UriSource = new Uri(Settings.NaturalGroundingFolder + item.FileName);
            NewImage.EndInit();
            Image NewImageControl = new Image();
            NewImageControl.Source = NewImage;

            TitleText.Text = Item.Title;
            TitleText.ToolTip = Item.Title;

            viewer = ImageViewerWindow.Instance(NewImageControl);
            viewer.Closed += viewer_Closed;
        }
Пример #4
0
        public void OpenMedia(Media item)
        {
            this.Item = item;

            BitmapImage NewImage = new BitmapImage();

            NewImage.BeginInit();
            NewImage.UriSource = new Uri(Settings.NaturalGroundingFolder + item.FileName);
            NewImage.EndInit();
            Image NewImageControl = new Image();

            NewImageControl.Source = NewImage;

            TitleText.Text    = Item.Title;
            TitleText.ToolTip = Item.Title;

            viewer         = ImageViewerWindow.Instance(NewImageControl);
            viewer.Closed += viewer_Closed;
        }
        public void OpenMedia(Media item) {
            this.Item = item;

            TitleText.Text = Item.Title;
            TitleText.ToolTip = Item.Title;

            player = new MediaElement();
            player.LoadedBehavior = MediaState.Manual;
            player.UnloadedBehavior = MediaState.Manual;
            player.MediaEnded += player_MediaEnded;
            player.IsMuted = true;
            player.Source = new Uri(Settings.NaturalGroundingFolder + Item.FileName);
            player.Position = TimeSpan.FromSeconds(Item.StartPos.HasValue ? Item.StartPos.Value : 0);
            player.Play();

            viewer = ImageViewerWindow.Instance(player);
            viewer.Closed += viewer_Closed;

            positionTimer = new DispatcherTimer();
            positionTimer.Interval = TimeSpan.FromSeconds(1);
            positionTimer.Tick += positionTimer_Tick;
            positionTimer.Start();
        }
        public void OpenMedia(Media item)
        {
            this.Item = item;

            TitleText.Text    = Item.Title;
            TitleText.ToolTip = Item.Title;

            player = new MediaElement();
            player.LoadedBehavior   = MediaState.Manual;
            player.UnloadedBehavior = MediaState.Manual;
            player.MediaEnded      += player_MediaEnded;
            player.IsMuted          = true;
            player.Source           = new Uri(Settings.NaturalGroundingFolder + Item.FileName);
            player.Position         = TimeSpan.FromSeconds(Item.StartPos.HasValue ? Item.StartPos.Value : 0);
            player.Play();

            viewer         = ImageViewerWindow.Instance(player);
            viewer.Closed += viewer_Closed;

            positionTimer          = new DispatcherTimer();
            positionTimer.Interval = TimeSpan.FromSeconds(1);
            positionTimer.Tick    += positionTimer_Tick;
            positionTimer.Start();
        }