예제 #1
0
        static void Main()
        {
            Logging.Info("+static Main()");

            try
            {
                splashscreen_window.UpdateMessage("Logging in");

                LoginWindow login_window = new LoginWindow();
                login_window.ChooseLogin(splashscreen_window);

                splashscreen_window.Close();
                WPFDoEvents.DoEvents();

                try
                {
                    application.Run();
                }
                catch (Exception ex)
                {
                    Logging.Error(ex, "Exception caught at Main() application.Run().  Disaster.");
                }


                DoShutdown();
            }

            catch (Exception ex)
            {
                Logging.Error(ex, "Exception caught at Main().  Disaster.");
            }

            Logging.Info("-static Main()");
        }
        private void StartMainApplication()
        {
            WPFDoEvents.SetHourglassCursor();

            // Initialise the web browser
            try
            {
                splashscreen_window.UpdateMessage("Installing browser components");
                GeckoInstaller.CheckForInstall();
                splashscreen_window.UpdateMessage("Initialising browser components");
                GeckoManager.Initialise();
                GeckoManager.RegisterPDFInterceptor();
            }
            catch (Exception ex)
            {
                Logging.Error(ex, "Problem initialising GeckoFX.");
            }

            // Fire up Qiqqa!
            splashscreen_window.UpdateMessage("Starting background processes");
            StartDaemonSingletons();

            splashscreen_window.UpdateMessage("Launching Qiqqa!");
            FireStartUseFeature();
            MainWindow window = new MainWindow();

            window.Show();

            Hide();
        }
예제 #3
0
        private static void DoPostUpgrade(SplashScreenWindow splashscreen_window)
        {
            // NB NB NB NB: You CANT USE ANYTHING IN THE USER CONFIG AT THIS POINT - it is not yet decided until LOGIN has completed...

            splashscreen_window.UpdateMessage("Loading themes");
            Theme.Initialize();
            DualTabbedLayout.GetWindowOverride = delegate() { return(new StandardWindow()); };

            // Force tooltips to stay open
            ToolTipService.ShowDurationProperty.OverrideMetadata(typeof(DependencyObject), new FrameworkPropertyMetadata(3600000));

            // Make sure the data directories exist...
            if (!Directory.Exists(ConfigurationManager.Instance.BaseDirectoryForUser))
            {
                Directory.CreateDirectory(ConfigurationManager.Instance.BaseDirectoryForUser);
            }

            // NB NB NB NB: You CANT USE ANYTHING IN THE USER CONFIG AT THIS POINT - it is not yet decided until LOGIN has completed...
        }
예제 #4
0
        internal static void RunUpgrade(SplashScreenWindow splashscreen_window)
        {
            Logging.Info("Upgrading from 037 to 038");

            string base_directory_path = BaseDirectoryForQiqqa;

            if (Directory.Exists(base_directory_path))
            {
                int info_library_count, info_item_count;

                string[] library_directories = Directory.GetDirectories(base_directory_path);
                info_library_count = 0;
                foreach (string library_directory in library_directories)
                {
                    ++info_library_count;
                    Logging.Info("Inspecting directory {0}", library_directory);

                    string documents_directory = Path.GetFullPath(Path.Combine(library_directory, @"documents"));
                    string database_file       = Path.GetFullPath(Path.Combine(library_directory, @"Qiqqa.library"));

                    if (!File.Exists(database_file) && Directory.Exists(documents_directory))
                    {
                        Logging.Warn("We have to upgrade {0}", library_directory);

                        SQLiteUpgrade_LibraryDB library_db = new SQLiteUpgrade_LibraryDB(library_directory);

                        using (var connection = library_db.GetConnection())
                        {
                            connection.Open();
                            using (var transaction = connection.BeginTransaction())
                            {
                                // Get a list of ALL the files in the documents directory...
                                string[] full_filenames = Directory.GetFiles(documents_directory, "*.*", SearchOption.AllDirectories);
                                info_item_count = 0;
                                foreach (string full_filename in full_filenames)
                                {
                                    ++info_item_count;
                                    splashscreen_window.UpdateMessage("Upgrading library {0}/{1}: {2:P0}", info_library_count, library_directories.Length, info_item_count / (double)full_filenames.Length);

                                    string fingerprint = Path.GetFileNameWithoutExtension(full_filename);
                                    string extension   = Path.GetExtension(full_filename).Trim('.');

                                    if (EXTENSIONS.Contains(extension))
                                    {
                                        Logging.Info("Upgrading {0}--{1}", fingerprint, extension);
                                        byte[] data = File.ReadAllBytes(full_filename);
                                        library_db.PutBlob(connection, transaction, fingerprint, extension, data);
                                    }
                                    else
                                    {
                                        Logging.Info("NOT upgrading {0}--{1}", fingerprint, extension);
                                    }
                                }

                                transaction.Commit();
                            }
                        }
                    }
                }
            }

            splashscreen_window.UpdateMessage("Finished migrating libraries.");
        }
예제 #5
0
 private static void RenewMessage(SplashScreenWindow splashscreen_window)
 {
     splashscreen_window.UpdateMessage("Running upgrades.  Please be patient.");
 }