Example #1
0
 private static void RunApplication(ILog log, ISupportedFormats plugins, ISettings settings,
                                    UnityContainer container)
 {
     TextOptions.TextFormattingModeProperty.OverrideMetadata(typeof(Window),
                                                             new FrameworkPropertyMetadata(TextFormattingMode.Display,
                                                                                           FrameworkPropertyMetadataOptions.AffectsMeasure | FrameworkPropertyMetadataOptions.AffectsRender |
                                                                                           FrameworkPropertyMetadataOptions.Inherits));
     log.Info("Application Started");
     plugins.LoadFromPath("Plugins", true);
     try
     {
         if (!Directory.Exists(settings.ApplicationPath))
         {
             Directory.CreateDirectory(settings.ApplicationPath);
         }
         var mainWindow = container.Resolve <MainWindow>();
         // mainWindow.Closed += MainWindow_Closed;
         var app = new App();
         app.InitializeComponent();
         app.Run(mainWindow);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Unhandled Exception", MessageBoxButton.OK, MessageBoxImage.Error);
         log.Error("Unhandled exception", ex);
     }
 }
Example #2
0
 public MainWindowViewModel(IBookCore bookCore, IImporter importer, BooksControl bookControl,
                            AuthorsControl authorscontol, ISupportedFormats supportedFormats)
 {
     _authorControl    = authorscontol;
     _supportedFormats = supportedFormats;
     _bookControl      = bookControl;
     _bookCore         = bookCore;
     _importer         = importer;
     View = bookControl;
 }
Example #3
0
 public Importer(IBookCore bookCore, ILog log, ISupportedFormats supportedFormats, ISettings settings, Ctx ctx)
 {
     _ctx                              = ctx;
     _settings                         = settings;
     _supportedFormats                 = supportedFormats;
     _bookCore                         = bookCore;
     _log                              = log;
     Worker                            = new BackgroundWorker();
     Worker.DoWork                    += Worker_DoWork;
     Worker.ProgressChanged           += Worker_ProgressChanged;
     Worker.RunWorkerCompleted        += Worker_RunWorkerCompleted;
     Worker.WorkerReportsProgress      = true;
     Worker.WorkerSupportsCancellation = true;
 }