コード例 #1
0
ファイル: BeeBurnIO.cs プロジェクト: TinyBeeman/BeeBurn
        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
ファイル: BeeImage.cs プロジェクト: TinyBeeman/BeeBurn
        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
ファイル: BeeImage.cs プロジェクト: TinyBeeman/BeeBurn
        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);
 }