Exemplo n.º 1
0
        private void ActiveGrid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 2)
            {
                if (AllowStackEdit)
                {
                    var dlgEditStack = new BeeStackEditor(Stack);
                    dlgEditStack.ShowDialog();
                    e.Handled = true;
                    return;
                }
            }

            m_dragIndex = GetCurrentRowIndex(e.GetPosition);
            if (m_dragIndex < 0)
            {
                return;
            }

            ActiveGrid.SelectedIndex = m_dragIndex;
            BeeImage biSel = ActiveGrid.Items[m_dragIndex] as BeeImage;

            if (biSel == null)
            {
                return;
            }
            var dragEffects = DragDropEffects.Move;

            if (DragDrop.DoDragDrop(ActiveGrid, biSel, dragEffects) != DragDropEffects.None)
            {
                ActiveGrid.SelectedItem = biSel;
            }
        }
Exemplo n.º 2
0
        private void QueueNextImage()
        {
            EnsureProjectionWindow();
            BeeStack activeStack = BeeBurnVM.Get().EnsureActiveStack();
            BeeImage biNext      = GetNextImage(true);

            if (biNext == null)
            {
                PauseProjection(true);
                m_proj.FadeToBlack();
                return;
            }

            CurrentImage.Source = biNext.BitmapFrame;
            RefreshNextImageControl();

            double panSeconds = m_proj.QueueImage(biNext) + BeeBurnVM.Get().ConfigSettings.ImageFadeTime;

            //  DispatcherTimer setup
            if (m_dispatcherTimer == null)
            {
                m_dispatcherTimer       = new System.Windows.Threading.DispatcherTimer();
                m_dispatcherTimer.Tick += new EventHandler(ProjectionTimerTick);
            }

            m_dispatcherTimer.Tag = panSeconds;

            m_proj.UpdateProgress(0);
            m_timerStart = DateTime.Now;
            m_dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 50);
            m_dispatcherTimer.Start();
        }
Exemplo n.º 3
0
        public void FadeToBlack()
        {
            BeeImage.SetShowingImage(null);

            if (m_imgOld != null)
            {
                GridImage.Children.Remove(m_imgOld);
            }

            m_imgOld = m_imgNew;
            m_imgNew = null;

            if (m_imgOld != null)
            {
                m_currentStoryboard = new Storyboard
                {
                    Duration = TimeSpan.FromSeconds(m_fadeSeconds)
                };

                DoubleAnimation animFadeOut = new DoubleAnimation(0, TimeSpan.FromSeconds(m_fadeSeconds));
                Storyboard.SetTarget(animFadeOut, m_imgOld);
                Storyboard.SetTargetProperty(animFadeOut, new PropertyPath("Opacity"));
                m_currentStoryboard.Children.Add(animFadeOut);
                m_currentStoryboard.Begin();
            }
        }
Exemplo n.º 4
0
        private void RefreshNextImageControl()
        {
            BeeImage biNext = GetNextImage(false);

            NextImage.Source = biNext?.BitmapFrame;
        }
Exemplo n.º 5
0
        public double QueueImage(BeeImage bi)
        {
            BeeImage.SetShowingImage(bi);

            if (m_imgOld != null)
            {
                GridImage.Children.Remove(m_imgOld);
            }

            m_imgOld = m_imgNew;
            m_imgNew = new Image
            {
                Source = bi.BitmapFrame,

                // Start with 0 opacity
                Opacity = 0,
                Stretch = Stretch.None
            };

            GridImage.Children.Add(m_imgNew);

            DoubleAnimation animFadeIn = new DoubleAnimation(1, TimeSpan.FromSeconds(m_fadeSeconds));

            ScaleTransform scaleTransform = new ScaleTransform(1, 1);

            m_imgNew.RenderTransformOrigin = new Point(0, 0);
            m_imgNew.RenderTransform       = scaleTransform;

            OffsetScale os1 = bi.GetStartOffsetScale(new BeeRect(0, 0, GridImage.ActualWidth, GridImage.ActualHeight));
            OffsetScale os2 = bi.GetEndOffsetScale(new BeeRect(0, 0, GridImage.ActualWidth, GridImage.ActualHeight));

            // Let's animate a random amount of time between 0.25 and 1.0 of the configuration value.
            double mult       = (m_rng.NextDouble() * 0.75) + 0.25;
            double panSeconds = mult * m_panSeconds;


            TimeSpan tsAnim = TimeSpan.FromSeconds(panSeconds + m_fadeSeconds);

            m_currentStoryboard = new Storyboard
            {
                Duration = tsAnim
            };

            DoubleAnimation animScaleX  = new DoubleAnimation(os1.Scale, os2.Scale, tsAnim);
            DoubleAnimation animScaleY  = new DoubleAnimation(os1.Scale, os2.Scale, tsAnim);
            DoubleAnimation animOffsetX = new DoubleAnimation(-os1.OffsetX, -os2.OffsetX, tsAnim);
            DoubleAnimation animOffsetY = new DoubleAnimation(-os1.OffsetY, -os2.OffsetY, tsAnim);

            Storyboard.SetTarget(animScaleX, m_imgNew);
            Storyboard.SetTargetProperty(animScaleX, new PropertyPath("RenderTransform.ScaleX"));
            m_currentStoryboard.Children.Add(animScaleX);

            Storyboard.SetTarget(animScaleY, m_imgNew);
            Storyboard.SetTargetProperty(animScaleY, new PropertyPath("RenderTransform.ScaleY"));
            m_currentStoryboard.Children.Add(animScaleY);

            Storyboard.SetTarget(animOffsetX, m_imgNew);
            Storyboard.SetTargetProperty(animOffsetX, new PropertyPath("RenderTransform.CenterX"));
            m_currentStoryboard.Children.Add(animOffsetX);

            Storyboard.SetTarget(animOffsetY, m_imgNew);
            Storyboard.SetTargetProperty(animOffsetY, new PropertyPath("RenderTransform.CenterY"));
            m_currentStoryboard.Children.Add(animOffsetY);

            if (m_imgOld != null)
            {
                DoubleAnimation animFadeOut = new DoubleAnimation(0, TimeSpan.FromSeconds(m_fadeSeconds));
                Storyboard.SetTarget(animFadeOut, m_imgOld);
                Storyboard.SetTargetProperty(animFadeOut, new PropertyPath("Opacity"));
                m_currentStoryboard.Children.Add(animFadeOut);
            }


            Storyboard.SetTarget(animFadeIn, m_imgNew);
            Storyboard.SetTargetProperty(animFadeIn, new PropertyPath("Opacity"));
            m_currentStoryboard.Children.Add(animFadeIn);
            m_currentStoryboard.Duration = new Duration(tsAnim);

            m_currentStoryboard.Begin();

            return(panSeconds);
        }