Exemplo n.º 1
0
        private void Btn_Open_Click(object sender, RoutedEventArgs e)
        {
            Controls.Button btn = (Controls.Button)sender;
            btn.IsSelected = true;

            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
            ofd.Multiselect = false;
            ofd.Filter      = "Data Sources (*.jpg, *.gif, *.png)|*.jpg*;*.gif;*.png";

            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                OpenFileDelegate del1 = delegate()
                {
                    images = new Ghost.Files.ImageCollection(System.IO.Path.GetDirectoryName(ofd.FileName));
                    Imaging.PixelSnappedImage psi = new Ghost.Imaging.PixelSnappedImage();
                    psi.Source     = Utilities.GetBitmapSourceFromUrlPath(String.Format("{1}/{0}", System.IO.Path.GetFileName(ofd.FileName), System.IO.Path.GetDirectoryName(ofd.FileName)));
                    btn.IsSelected = false;
                    WorkspaceControl.Children.Clear();
                    ControlInView = psi;
                    WorkspaceControl.Children.Add(psi);
                    UpdateMenuWithImages(images);
                    SetOpenMenu();
                };
                Dispatcher.BeginInvoke(DispatcherPriority.Normal, del1);
            }
            else
            {
                btn.IsSelected = false;
            }
        }
Exemplo n.º 2
0
 public void UpdateMenuWithImages(Files.ImageCollection images)
 {
     Btn_Open_Menu.ItemTemplate = (DataTemplate)FindResource("FileMenuItemTemplate");
     Btn_Open_Menu.ItemsSource  = images;
 }
Exemplo n.º 3
0
 public void LoadImageList(Files.ImageCollection images)
 {
     Btn_Open_Menu.ItemsSource = images;
 }