Пример #1
0
        // Ctor
        public ViewModel()
        {
            // Stop background worker and save path properties in config file when main window is being closed
            App.appclosingEventHandler += delegate(object sender)
            {
                if (PdfFile.isFilePathOK(".pdf"))
                {
                    Model.Config.AddSettingFor(Model.Config.PdfFile, PdfFile);
                }
                if (EditOutputPath.isDirectoryPathOK())
                {
                    Model.Config.AddSettingFor(Model.Config.EditOutputPath, EditOutputPath);
                }
                if (WPsToExtractFile.isFilePathOK(".txt"))
                {
                    Model.Config.AddSettingFor(Model.Config.WPsToExtractFile, WPsToExtractFile);
                }
                if (ExportFile.isFilePathOK(".txt"))
                {
                    Model.Config.AddSettingFor(Model.Config.ExportFile, ExportFile);
                }

                StopWorker();
            };

            MainThreadDispatcher = Dispatcher.CurrentDispatcher;

            //Application.Current.MainWindow.Closing += delegate(object sender, System.ComponentModel.CancelEventArgs e)
            //{
            //    StopWorker();
            //};

            //App.Kernel = new StandardKernel();

            App.Kernel.Bind <Model.ISplitter>().To <Model.Splitter>().InTransientScope();         //.Named("Splitter");
            App.Kernel.Bind <Model.IExtractor>().To <Model.Extractor>().InTransientScope();       //.Named("Extractor");
            App.Kernel.Bind <Model.IDataExporter>().To <Model.DataExporter>().InTransientScope(); //.Named("DataExporter");
        }