예제 #1
0
        public MainWindowViewModel(IFormViewModel formViewModel, IMapViewModel mapViewModel, IProgressViewModel progressViewModel,
                                   IFileDialogService fileDialogService, IPackageService packageService,
                                   IImportService importservice, ISaveService saveService, ILoadService
                                   loadService, ILogService logService, IWindowService windowService,
                                   IProgressService progressService)
        {
            Loggers.PerformanceLogger.Debug("MainWindowViewModel constructor started");

            this.loadService             = loadService;
            loadService.PackageLoaded   += PackageServiceOnPackageLoaded;
            loadService.PackageUnloaded += OnPackageUnloaded;
            this.saveService             = saveService;
            // this.gisService = gisService;
            this.windowService     = windowService;
            this.fileDialogService = fileDialogService;
            this.packageService    = packageService;
            this.importservice     = importservice;
            this.progressService   = progressService;
            MapViewModel           = mapViewModel;
            FormViewModel          = formViewModel;
            ProgressViewModel      = progressViewModel;

            ShowHideKarteCommand    = new DelegateCommand(() => MapViewModel.IsVisible = !MapViewModel.IsVisible);
            ShowHideFormularCommand = new DelegateCommand(() => FormViewModel.IsVisible = !FormViewModel.IsVisible);

            ExitCommand      = new DelegateCommand(App.Current.Shutdown);
            ImportCommand    = new DelegateCommand(startImportWorker);
            SaveCommand      = new DelegateCommand(() => fileDialogService.ShowSaveDialog(saveService.Save));
            ExportCommand    = new DelegateCommand(exportSingle);
            ExportAllCommand = new DelegateCommand(() => fileDialogService.ShowExportDialog(packageService.Export, true));
            ExportLogCommand = new DelegateCommand(() => fileDialogService.ShowExportLogDialog(logService.ExportLog));
            WindowTitle      = string.Format("{0} v{1}-{2}", LocalizationLocator.MobileLocalization.MainWindowTitle, typeof(MainWindow).Assembly.GetName().Version, VersionPostfix.Postfix);
            MenuItemsVisible = false;
            isEnabled        = true;
            fileDialogService.ImportStart    += new EventHandler(fileDialogServiceImportStart);
            fileDialogService.ImportFinished += new EventHandler(fileDialogServiceImportFinished);
            progressService.OnStart          += progressOnStart;
            progressService.OnStop           += progressOnStop;

            Loggers.PerformanceLogger.Debug("MainWindowViewModel constructor ended");
        }