private void add_Click(object sender, RoutedEventArgs e) { VModel = new VModel(); Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog { DefaultExt = ".att", // Default file extension Filter = "PDMS ATT (.att)|*.att|Text documents (.txt)|*.txt" // Filter files by extension }; bool?result = dlg.ShowDialog(); // Process open file dialog box results if (result == false) { return; } save.IsEnabled = true; // Open document mstrfilepath = dlg.FileName; tbfilepath.Text = mstrfilepath; readfile(mstrfilepath); DataContext = VModel; //Action<string> showMethod = VModel.readfile; //showMethod.BeginInvoke(mstrfilepath, null, null); //this.Dispatcher.BeginInvoke(showMethod, mstrfilepath); //readfile(mstrfilepath); }
private void Window_Loaded(object sender, RoutedEventArgs e) { VModel = new VModel(); DataContext = VModel; }