private void Add_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog file = new Microsoft.Win32.OpenFileDialog();
            file.FileName = ""; // Default file name
            file.DefaultExt = ""; // Default file extension
            file.Filter = "PNG Image Files (.png)|*.png"; // Filter files by extension

            Nullable<bool> result = file.ShowDialog();

            if (result == true)
            {
                // Open document
                string filename = file.FileName;



                frame save = new frame()
                {
                    src = filename,
                    delay = 200,
                };

                proj.append(ref proj, save);

                benchgrid.ItemsSource.


            }
        }
        //moving frames
        public void move(int to, ref frame x)
        {
            frame copy = x;
            working.Remove(x);
            working.Insert(to, copy);


        }
        /* Function: move
        * Parameters: to, int primitive. x, ref: reference of frame object
        * Purpose: Takes current reference of frame object on storyboard, moves it
        * to position specified by to. Has safety measures to prevent crash.
        */
        public void move(int to, ref frame x)
        {
            try
            {
                frame copy = x;
                working.Remove(x);
                working.Insert(to, copy);
            }
            catch
            {
                // do not move, invalid parameters, no crash
            }

        }
        private void open_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog fileload = new Microsoft.Win32.OpenFileDialog();
            fileload.FileName = ""; // Default file name
            fileload.DefaultExt = ""; // Default file extension
            fileload.Filter = "Simplimation Project Files (.spf)|*.spf"; // Filter files by extension
            Nullable<bool> result = fileload.ShowDialog();

             if (result == true)
            {
                // Open document
                string line;
                // Kill content
                proj.working.Clear();
                CineBench.Children.Clear();
                Big.Source = new BitmapImage(new Uri("pack://application:,,,/Simplimation;component/graphics/nonbut.png")); 
                // read and store
                 using (StreamReader sr = new StreamReader(fileload.FileName))
                {
                    while (sr.EndOfStream.Equals(false))
                    {
                        line = sr.ReadLine();
                        char[] comsep = new char[] { ',' };

                        string[] data = line.Split(comsep, StringSplitOptions.None);

                        string f = data[1];
                        string d = data[2];

                        frame save = new frame()
                        {
                            src = f,
                            delay = Convert.ToInt32(d),
                        };

                        proj.append(save);

                        index = proj.working.Count() - 1;
                        add();
                    }
                }
                 char[] slashsep = new char[] { '\\' };

                 string[] titlechg = fileload.FileName.Split(slashsep, StringSplitOptions.None);



                 Title = (titlechg.Last() + " - Simplimation"); 
             }



        }
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog fileload = new Microsoft.Win32.OpenFileDialog();
            fileload.FileName = ""; // Default file name
            fileload.DefaultExt = ""; // Default file extension
            fileload.Filter = "Image Files (*.png; *.bmp; *.jpg)|*.png;*.bmp;*.jpg"; // Filter files by extension
            fileload.Multiselect = true;
            Nullable<bool> result = fileload.ShowDialog();
            int del;
            try
            {
                del = Convert.ToInt32(DelayDef.Text);
            }
            catch
            {
                DelayDef.Text = "0";
                del = 0;
            }

            if (result == true)
            {
                // Open document
                int reads = fileload.FileNames.Count();
                int cur = 0;
                foreach (String file in fileload.FileNames)
                {
                    string filename = fileload.FileNames[cur];

                    frame save = new frame()
                    {
                        src = filename,
                        delay = del,
                    };

                    tottime = tottime + save.delay;

                    proj.append(save);
                    index = proj.working.Count() - 1;
                    add();  //invokes add function to create UI element.
                    if (cur < reads)
                    {
                        cur++;
                    }
                }
                /*if (index > 5)
                {
                    index = index - 5;
                }
                else
                {
                    index = 0;
                }
                reconfig_bench();
                 */
                
            }
        }
 //add frames
 public void append(frame ins)
 {
     working.Add(ins);
 }
        private void Add_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog fileload = new Microsoft.Win32.OpenFileDialog();
            fileload.FileName = ""; // Default file name
            fileload.DefaultExt = ""; // Default file extension
            fileload.Filter = "PNG Image Files (.png)|*.png"; // Filter files by extension
            fileload.Multiselect = true;
            Nullable<bool> result = fileload.ShowDialog();

            if (result == true)
            {
                // Open document
                int reads = fileload.FileNames.Count();
                int cur = 0;
                foreach (String file in fileload.FileNames)
                {
                    string filename = fileload.FileNames[cur];



                    frame save = new frame()
                    {
                        src = filename,
                        delay = 100,
                    };

                    proj.append(save);
                    if (cur < reads)
                    {
                        cur++;
                    }
                }

                index = proj.working.Count();
                if (index > 5)
                {
                    index = index - 5;
                }
                else
                {
                    index = 0;
                }
                reconfig_bench();
            }
        }