Ejemplo n.º 1
0
        private void Open_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.DefaultExt = ".txt";
            dlg.Filter     = "Text Files (*.txt)|*.txt";
            Nullable <bool> result   = dlg.ShowDialog();
            string          filename = "";

            // Get the selected file name and display in a TextBox
            if (result == true)
            {
                // Open document
                filename = dlg.FileName.Replace("list.txt", null);
                try
                {
                    Gryffi.SCurrentDirectory = filename;
                    Gryffi.GryffiPatchlist   = null;
                    GryffiLib.Gryffi.DeserializePatchlist();
                    DataContext = new DirectoryViewModel();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Ejemplo n.º 2
0
 public MainWindow()
 {
     InitializeComponent();
     try
     {
         GryffiLib.Gryffi.DeserializePatchlist();
     }
     catch (Exception)
     {
         MessageBox.Show("list.txt could not be found.");
     }
     DataContext = new DirectoryViewModel();
 }