public MainWindow() { InitializeComponent(); var _mainWindow = new VCardsViewModel(new PhoneBookDialogService(), new VCardFileService(), new ImageDialogService()); DataContext = new RootViewModel() { RootVM = _mainWindow }; }
public MainWindow(string fileName) { InitializeComponent(); if (!string.IsNullOrWhiteSpace(fileName) && File.Exists(fileName)) { try { var _mainWindow = new VCardsViewModel(new PhoneBookDialogService(), new VCardFileService(), new ImageDialogService(), new string[] { fileName }); DataContext = new RootViewModel() { RootVM = _mainWindow }; } catch (Exception ex) { MessageBox.Show(ex.Message); var _mainWindow = new VCardsViewModel(new PhoneBookDialogService(), new VCardFileService(), new ImageDialogService()); DataContext = new RootViewModel() { RootVM = _mainWindow }; } } }