Exemplo n.º 1
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     Gat.Controls.OpenDialogView      openDialog = new Gat.Controls.OpenDialogView();
     Gat.Controls.OpenDialogViewModel vm         = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;
     vm.IsDirectoryChooser = false;
     vm.StartupLocation    = System.Windows.WindowStartupLocation.CenterScreen;;
     vm.AddFileFilterExtension(".json");
     vm.Show();
     txtFileSource.Text = vm.SelectedFilePath;
     ChangeCutButtomState();
 }
Exemplo n.º 2
0
        private void ChangePhoto()
        {
            Gat.Controls.OpenDialogView      openDialog = new Gat.Controls.OpenDialogView();
            Gat.Controls.OpenDialogViewModel vm         = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;

            // Adding file filter
            vm.AddFileFilterExtension(".jpg;.png");

            // Show dialog and take result into account
            bool?result = vm.Show();

            if (result == true)
            {
                // Get selected file path
                var txt = vm.SelectedFilePath;
                image1.Source = new BitmapImage(new Uri(txt));
            }
            else
            {
                var txt = string.Empty;
            }
        }