public void RequestSync(SyncRequest sync_request)
        {
            bool user_wants_intervention = KeyboardTools.IsCTRLDown() || !ConfigurationManager.Instance.ConfigurationRecord.SyncTermsAccepted;

            WPFDoEvents.SetHourglassCursor();

            SafeThreadPool.QueueUserWorkItem(o =>
            {
                GlobalSyncDetail global_sync_detail = GenerateGlobalSyncDetail();
                WPFDoEvents.InvokeInUIThread(() =>
                {
                    WPFDoEvents.ResetHourglassCursor();

                    SyncControlGridItemSet scgis = new SyncControlGridItemSet(sync_request, global_sync_detail);
                    scgis.AutoTick();

                    if (scgis.CanRunWithoutIntervention() && !user_wants_intervention)
                    {
                        Sync(scgis);
                    }
                    else
                    {
                        SyncControl sync_control = new SyncControl();
                        sync_control.SetSyncParameters(scgis);
                        sync_control.Show();
                    }
                });
            });
        }
        internal void RefreshSyncControl(SyncControlGridItemSet scgis_previous, SyncControl sync_control)
        {
            WPFDoEvents.SetHourglassCursor();

            SafeThreadPool.QueueUserWorkItem(o =>
            {
                //
                // Explicitly instruct the sync info collector to perform a swift scan, which DOES NOT include
                // collecting the precise size of every document in every Qiqqa library (which itself is a *significant*
                // file system load when you have any reasonably large libraries like I do.          [GHo]
                //
                // TODO: fetch and cache document filesizes in the background, so we can improve on the accuracy of
                // our numbers in a future call to this method.
                //
                GlobalSyncDetail global_sync_detail = GenerateGlobalSyncDetail(tally_library_storage_size: false);
                WPFDoEvents.InvokeInUIThread(() =>
                {
                    WPFDoEvents.ResetHourglassCursor();

                    SyncControlGridItemSet scgis = new SyncControlGridItemSet(scgis_previous.sync_request, global_sync_detail);
                    scgis.AutoTick();
                    sync_control.SetSyncParameters(scgis);
                });
            });
        }
예제 #3
0
        private void MainWindow_ContentRendered(object sender, EventArgs e)
        {
            Logging.Debug特("MainWindow::ContentRendered event");

            // hold off: level 2 -> 1
            MaintainableManager.Instance.BumpHoldOffPendingLevel();

            WPFDoEvents.ResetHourglassCursor();
        }
예제 #4
0
        private void ResetHourglassWhenAllIsDone()
        {
            WPFDoEvents.InvokeInUIThread(() => {
                HourglassState--;

                if (HourglassState == 0)
                {
                    WPFDoEvents.ResetHourglassCursor();

#if PROFILE_STARTUP_PHASE
                    Environment.Exit(-2);    // testing & profiling only
#endif
                }
            }, priority: DispatcherPriority.ContextIdle);
        }
        private void MainWindow_ContentRendered(object sender, EventArgs e)
        {
            Logging.Debug特("MainWindow::ContentRendered event");

            // hold off: level 2 -> 1
            MaintainableManager.Instance.BumpHoldOffPendingLevel();

            // https://stackoverflow.com/questions/34340134/how-to-know-when-a-frameworkelement-has-been-totally-rendered
            WPFDoEvents.InvokeInUIThread(() => {
                WPFDoEvents.ResetHourglassCursor();

#if false
                Environment.Exit(-2);    // testing & profiling only
#endif
            }, priority: DispatcherPriority.ContextIdle);
        }
        internal void RefreshSyncControl(SyncControlGridItemSet scgis_previous, SyncControl sync_control)
        {
            WPFDoEvents.SetHourglassCursor();

            SafeThreadPool.QueueUserWorkItem(o =>
            {
                GlobalSyncDetail global_sync_detail = GenerateGlobalSyncDetail();
                WPFDoEvents.InvokeInUIThread(() =>
                {
                    WPFDoEvents.ResetHourglassCursor();

                    SyncControlGridItemSet scgis = new SyncControlGridItemSet(scgis_previous.sync_request, global_sync_detail);
                    scgis.AutoTick();
                    sync_control.SetSyncParameters(scgis);
                });
            });
        }
예제 #7
0
        public TabWelcome()
        {
            InitializeComponent();

            WPFDoEvents.ResetHourglassCursor();

            ObjBackgroundImage.Source  = SplashScreenWindow.GetSplashImage();
            ObjBackgroundImage.Stretch = Stretch.Fill;
            RenderOptions.SetBitmapScalingMode(ObjBackgroundImage, BitmapScalingMode.HighQuality);

            ObjFlowDocument.Background = new SolidColorBrush(ColorTools.MakeTransparentColor(Colors.Black, 192));

            DataContext = ConfigurationManager.Instance.ConfigurationRecord_Bindable;

            ObjGetGoing.Text             = "Let's get started! >>>";
            ObjGetGoingBorder.MouseDown += ObjGetGoing_MouseDown;
            ObjGetGoingBorder.Cursor     = Cursors.Hand;
        }
예제 #8
0
        public void RequestSync(SyncRequest sync_request)
        {
            WPFDoEvents.AssertThisCodeIsRunningInTheUIThread();

            bool user_wants_intervention = KeyboardTools.IsCTRLDown() || !ConfigurationManager.Instance.ConfigurationRecord.SyncTermsAccepted;

            WPFDoEvents.SetHourglassCursor();

            SafeThreadPool.QueueUserWorkItem(o =>
            {
                //
                // Explicitly instruct the sync info collector to perform a swift scan, which DOES NOT include
                // collecting the precise size of every document in every Qiqqa library (which itself is a *significant*
                // file system load when you have any reasonably large libraries like I do.          [GHo]
                //
                // TODO: fetch and cache document filesizes in the background, so we can improve on the accuracy
                // of our numbers in a future call to this method.
                //
                GlobalSyncDetail global_sync_detail = GenerateGlobalSyncDetail(tally_library_storage_size: false);
                WPFDoEvents.InvokeInUIThread(() =>
                {
                    WPFDoEvents.ResetHourglassCursor();

                    SyncControlGridItemSet scgis = new SyncControlGridItemSet(sync_request, global_sync_detail);
                    scgis.AutoTick();

                    if (scgis.CanRunWithoutIntervention() && !user_wants_intervention)
                    {
                        Sync(scgis);
                    }
                    else
                    {
                        SyncControl sync_control = new SyncControl();
                        sync_control.SetSyncParameters(scgis);
                        sync_control.Show();
                    }
                });
            });
        }
예제 #9
0
        private void ProcessClientVersionInformation(ClientVersionInformation client_version_information)
        {
            _latestClientVersionInformation = client_version_information;

            int current_executing_version = ClientVersion.CurrentVersion;

            string notification_bar_text;
            string notification_bar_tooltip;

            NotificationManager.NotificationType notification_type;

            //  are we on the latest version? whohooooo
            if (current_executing_version == client_version_information.LatestVersion)
            {
                Logging.Info("We are on the latest version: {0}", current_executing_version);
                //  nothing left to do
                return;
            }

            //  is this version ok - based on the compliant version flag, in which case nothing to do except log
            if (client_version_information.CompliantFromVersion.HasValue && current_executing_version >= client_version_information.CompliantFromVersion)
            {
                Logging.Info("User is running an old version (v{0}), but it is still >= the compliant version (v{1}), so not telling them to update.", current_executing_version, client_version_information.CompliantFromVersion);
                //return;
            }

            //  are we ahead of the latest version (in the event we have rolled back, let the user know)
            if (current_executing_version > client_version_information.LatestVersion)
            {
                Logging.Warn("Current executing version (v{0}) is ahead of server version (v{1})??? Have we rolled back a version?", current_executing_version, client_version_information.LatestVersion);
                notification_bar_text    = "We have reverted to an old version of " + _appName + ", please download the previous version.";
                notification_bar_tooltip = "It appears that we have reverted to an old version of " + _appName + ", most likely due to some issues with the latest version.  Please download LexLens again and reinstall (the installer will warn you that you are installing an old version which you can safely ignore).";
                notification_type        = NotificationManager.NotificationType.Warning;
            }
            //  is this version obsolete - let them know with a strongly worded message
            else if (client_version_information.ObsoleteToVersion.HasValue && current_executing_version <= client_version_information.ObsoleteToVersion)
            {
                notification_bar_text    = "Your " + _appName + " version is out-of-date, please download the latest version.";
                notification_bar_tooltip = "You are using an old version of " + _appName + " which is not currently supported, please download the latest version.";
                notification_type        = NotificationManager.NotificationType.Warning;
            }
            //  just a bog standard update message
            else
            {
                notification_bar_text    = "A new version of " + _appName + " is available for download.";
                notification_bar_tooltip = null;
                notification_type        = NotificationManager.NotificationType.Warning;
            }

            //  should we notify them about a new version available - only do if their version isn't compliant
            if (!client_version_information.CompliantFromVersion.HasValue || current_executing_version < client_version_information.CompliantFromVersion)
            {
                WPFDoEvents.ResetHourglassCursor();

                NotificationManager.Instance.AddPendingNotification(
                    new NotificationManager.Notification(
                        notification_bar_text,
                        notification_bar_tooltip,
                        notification_type,
                        _downloadLogo, //Icons.lexlens_logo,
                        "See Changes",
                        ViewChanges,
                        "Download",
                        DownloadNewClientVersion
                        ));
            }
        }
예제 #10
0
        private void PostStartupWork()
        {
            if (ConfigurationManager.Instance.ConfigurationRecord.GUI_RestoreWindowsAtStartup)
            {
                RestoreDesktopManager.RestoreDesktop();
            }
            else
            {
                // Open the most recently accessed web library
                List <WebLibraryDetail> web_libary_details = WebLibraryManager.Instance.WebLibraryDetails_WorkingWebLibrariesWithoutGuest;
                WebLibraryManager.Instance.SortWebLibraryDetailsByLastAccessed(web_libary_details);
                if (0 < web_libary_details.Count)
                {
                    MainWindowServiceDispatcher.Instance.OpenLibrary(web_libary_details[0].library);
                }

                // Also open guest under some circumstances
                bool should_open_guest = false;

                // No web libraries
                if (0 == web_libary_details.Count)
                {
                    should_open_guest = true;
                }
                // Web library is small compared to guest library
                if (0 < web_libary_details.Count && WebLibraryManager.Instance.Library_Guest.PDFDocuments_IncludingDeleted_Count > 2 * web_libary_details[0].library.PDFDocuments_IncludingDeleted_Count)
                {
                    should_open_guest = true;
                }

                if (should_open_guest)
                {
                    MainWindowServiceDispatcher.Instance.OpenLibrary(WebLibraryManager.Instance.Library_Guest);
                }

                // Make sure the start page is selected
                MainWindowServiceDispatcher.Instance.OpenStartPage();
            }

            if (ConfigurationManager.Instance.ConfigurationRecord.GUI_RestoreLocationAtStartup)
            {
                SetupConfiguredDimensions();
            }
            else
            {
                if (!RegistrySettings.Instance.IsSet(RegistrySettings.StartNotMaximized))
                {
                    WindowState = WindowState.Maximized;
                }
            }

            // Install the global keyboard and mouse hooks
            if (!RegistrySettings.Instance.IsSet(RegistrySettings.DisableGlobalKeyHook))
            {
                keyboard_hook          = new KeyboardHook();
                keyboard_hook.KeyDown += keyboard_hook_KeyDown;
                keyboard_hook.Start();
            }
            else
            {
                Logging.Warn("DisableGlobalKeyHook is set!");
            }

            if (true)
            {
                // Start listening for other apps
                ipc_server = new IPCServer();
                ipc_server.IPCServerMessage += ipc_server_IPCServerMessage;

                ipc_server.Start();
            }

            if (ConfigurationManager.Instance.ConfigurationRecord.TermsAndConditionsAccepted)
            {
                StartBackgroundWorkerDaemon();
            }
            else
            {
                // TODO: nothing to do any more; user hasn't accepted the Terms & Conditions... Allow update via UI maybe? Nah, just quit!
                WPFDoEvents.ResetHourglassCursor();

                MessageBoxes.Info("You have not accepted the Qiqqa Terms and Conditions. Consequently, no service can be provided. The application will terminate now.\n\nYou may want to re-install the software and check&accept the Terms & Conditions, which are shown during the installation procedure.");

                MainWindowServiceDispatcher.Instance.ShutdownQiqqa(suppress_exit_warning: true);
            }
        }