private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            //Configure open file dialog box
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = "Document"; // Default file name
            dlg.Filter   = "All supported graphics|*.jpg;*.jpeg;*.gif;*.png;|" +
                           "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                           "Gif (*.gif)|*.gif|" +
                           "Portable Network Graphic (*.png)|*.png"; // Filter files by extension

            if (dlg.ShowDialog() == true)
            {
                BitmapImage img = new BitmapImage(new Uri(dlg.FileName));

                string fileName = Path.GetFileName(dlg.FileName).Split('.')[0];
                string ext      = Path.GetFileName(dlg.FileName).Split('.')[1];

                OSAEImageManager imgMgr = new OSAEImageManager();

                int    imgID = 0;
                byte[] byt;

                if (ext.ToLower() == "jpg" || ext.ToLower() == "jpeg")
                {
                    byt   = imgMgr.GetJPGFromImageControl(img);
                    imgID = imgMgr.AddImage(fileName, ext, byt);
                }
                else if (ext.ToLower() == "png")
                {
                    byt   = imgMgr.GetPNGFromImageControl(img);
                    imgID = imgMgr.AddImage(fileName, ext, byt);
                }
                else if (ext.ToLower() == "gif")
                {
                    byt   = imgMgr.GetGIFFromFileStream(dlg.FileName);
                    imgID = imgMgr.AddImage(fileName, ext, byt);
                }

                BindImages();
            }
        }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            //Configure open file dialog box
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName = "Document"; // Default file name
            dlg.Filter = "All supported graphics|*.jpg;*.jpeg;*.gif;*.png;|" +
                "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                "Gif (*.gif)|*.gif|" +
                "Portable Network Graphic (*.png)|*.png"; // Filter files by extension

            if (dlg.ShowDialog() == true)
            {
                BitmapImage img = new BitmapImage(new Uri(dlg.FileName));

                string fileName = Path.GetFileName(dlg.FileName).Split('.')[0];
                string ext = Path.GetFileName(dlg.FileName).Split('.')[1];

                OSAEImageManager imgMgr = new OSAEImageManager();

                int imgID = 0;
                byte[] byt;

                if (ext.ToLower() == "jpg" || ext.ToLower() == "jpeg")
                {
                    byt = imgMgr.GetJPGFromImageControl(img);
                    imgID = imgMgr.AddImage(fileName, ext, byt);
                }
                else if (ext.ToLower() == "png")
                {
                    byt = imgMgr.GetPNGFromImageControl(img);
                    imgID = imgMgr.AddImage(fileName, ext, byt);
                }
                else if (ext.ToLower() == "gif")
                {
                    byt = imgMgr.GetGIFFromFileStream(dlg.FileName);
                    imgID = imgMgr.AddImage(fileName, ext, byt);
                }

                BindImages();
            }
        }