Exemplo n.º 1
0
        private void ModeMenuCommand_Executed(object context)
        {
            //string menuName = context.ToString().ToLowerInvariant();
            Window win = context as Window;

            MainWindowViewModel model;

            if (win.DataContext.GetType() == typeof(MainWindowLibraryViewModel))
            {
                model = new MainWindowMatchingViewModel(dialogService, fileDialogService, matches);
            }
            else
            {
                model = new MainWindowLibraryViewModel(dialogService, fileDialogService, matches);
            }
            if (libGen != null)
            {
                model.libGen      = libGen;
                model.LibraryFile = libGen.FileName;
            }
            if (specdata != null)
            {
                model.specdata = specdata;
                //model.LibraryFile = libGen.FileName;
            }
            CurrentModeViewModel = model;
            win.DataContext      = CurrentModeViewModel;
        }
Exemplo n.º 2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            MainWindow mainWin = new MainWindow();

            _ = new FileDragDropService();
            IDialogService dialogService = new DialogService(mainWin);

            dialogService.Register <DialogViewModel, DialogView>();
            dialogService.Register <SpectralSettingsViewModel, SpectralSettingsView>();
            dialogService.Register <MatchSettingsViewModel, MatchingSettingsView>();
            dialogService.Register <LibrarySettingsViewModel, LibrarySettingsView>();

            IFileDialogService fileDialogService = new FileDialogService(mainWin);

            var viewModel = new ViewModels.MainWindowMatchingViewModel(dialogService, fileDialogService);

            mainWin.DataContext = viewModel;

            mainWin.ShowDialog();
        }