Example #1
0
        public MainWindow()
        {
            InitializeComponent();
            var _mainWindow = new VCardsViewModel(new PhoneBookDialogService(), new VCardFileService(), new ImageDialogService());

            DataContext = new RootViewModel()
            {
                RootVM = _mainWindow
            };
        }
Example #2
0
 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
             };
         }
     }
 }