Example #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);
        }
Example #2
0
        public static bool SaveAsStack(BeeStack stack)
        {
            string filespec = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
            var    dlg      = new SaveFileDialog
            {
                DefaultExt       = ".bstack",
                InitialDirectory = BeeBurnVM.Get().ConfigSettings.SavePath,
                Filter           = "BStacks (*.bstack)|*.bstack",
                FileName         = filespec + ".bstack"
            };

            if (dlg.ShowDialog() == true)
            {
                string savePath      = System.IO.Path.GetDirectoryName(dlg.FileName);
                string fileNameNaked = System.IO.Path.GetFileNameWithoutExtension(dlg.FileName);
                string fileExt       = System.IO.Path.GetExtension(dlg.FileName);
                if (fileExt.Length < 1)
                {
                    dlg.FileName += ".bstack";
                }

                return(stack.SaveStack(fileNameNaked, savePath));
            }

            return(false);
        }
Example #3
0
        public static bool LoadSingleStack()
        {
            // TODO: USE OR DELETE
            var dlg = new OpenFileDialog
            {
                InitialDirectory = BeeBurnVM.Get().ConfigSettings.SavePath,
                Filter           = "BStacks (*.bstack)|*.bstack"
            };

            if (dlg.ShowDialog() == true)
            {
                BeeStack bsNew = new BeeStack();
                BeeBurnVM.Get().Stacks.Add(bsNew);
                bsNew.LoadStack(dlg.FileName);
                BeeBurnVM.Get().ActiveStack = bsNew;
                return(true);
            }

            return(false);
        }