예제 #1
0
        public static bool LoadImagesToStack(BeeStack stack)
        {
            var dlg = new OpenFileDialog
            {
                InitialDirectory = BeeBurnVM.Get().ConfigSettings.ImageLoadPath,
                Multiselect      = true,
                Filter           = "Image Files(*.png;*.jpg;*.jpeg)|*.png;*.jpg;*.jpeg|All files (*.*)|*.*"
            };

            if (dlg.ShowDialog() == true)
            {
                foreach (string filepath in dlg.FileNames)
                {
                    try
                    {
                        BeeImage bi = new BeeImage(filepath);
                        stack.Images.Add(bi);
                    }
                    catch (Exception)
                    {
                        // TODO: Handle better.
                        continue;
                    }
                }
                return(true);
            }

            return(false);
        }
예제 #2
0
        public static void SetShowingImage(BeeImage biShowing)
        {
            if (s_showingImage != null)
            {
                s_showingImage.IsShowing = false;
            }

            s_showingImage = biShowing;

            if (s_showingImage != null)
            {
                biShowing.IsShowing = true;
            }
        }
예제 #3
0
        public static void SetNextImage(BeeImage biNext)
        {
            if (s_nextImage != null)
            {
                s_nextImage.IsNext = false;
            }

            s_nextImage = biNext;

            if (s_nextImage != null)
            {
                biNext.IsNext = true;
            }
        }
예제 #4
0
        public BeeImage GetNextImage(bool loop)
        {
            // Empty List? Set everything to null.
            if (m_images.Count == 0)
            {
                m_nextImage = null;
                BeeImage.SetNextImage(null);
                return(null);
            }

            // If we're at the end, reset the list but return null
            // if we're not in a loop.
            if (m_atEnd)
            {
                ResetNextImage();
                if (!loop)
                {
                    return(null);
                }
            }

            // If we don't have an empty list, but also no next image
            // let's reset the next image.
            if (m_nextImage == null)
            {
                ResetNextImage();
            }

            int iNext = m_images.IndexOf(m_nextImage);

            // Weird case where m_nextImage isn't in the list anymore.
            if (iNext == -1)
            {
                ResetNextImage();
                iNext = 0;
            }

            BeeImage biRet    = m_nextImage;
            int      iNewNext = iNext + 1;

            if (iNewNext >= m_images.Count)
            {
                // If we're at the end of the list,
                // we set the next image to null,
                // unless we're looping, in which case
                // we Reset it (to 0, presumably).
                if (loop)
                {
                    ResetNextImage();
                }
                else
                {
                    m_nextImage = null;
                    m_atEnd     = true;
                    BeeImage.SetNextImage(null);
                }
            }
            else
            {
                // Set up our next image.
                m_nextImage = m_images[iNewNext];
                BeeImage.SetNextImage(m_nextImage);
            }

            return(biRet);
        }
예제 #5
0
 public void ResetNextImage()
 {
     m_atEnd     = false;
     m_nextImage = m_images.Count > 0 ? m_images[0] : null;
     BeeImage.SetNextImage(m_nextImage);
 }