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);
                });
            });
        }
        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)
        {
            GlobalSyncDetail       global_sync_detail = GenerateGlobalSyncDetail();
            SyncControlGridItemSet scgis = new SyncControlGridItemSet(scgis_previous.sync_request, global_sync_detail);

            scgis.AutoTick();
            sync_control.SetSyncParameters(scgis);
        }
        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);
                });
            });
        }
        public void RequestSync(SyncRequest sync_request)
        {
            bool user_wants_intervention = KeyboardTools.IsCTRLDown() || !ConfigurationManager.Instance.ConfigurationRecord.SyncTermsAccepted;

            GlobalSyncDetail       global_sync_detail = GenerateGlobalSyncDetail();
            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();
            }
        }
Esempio n. 6
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();
                    }
                });
            });
        }
        internal GlobalSyncDetail GenerateGlobalSyncDetail()
        {
            try
            {
                GlobalSyncDetail global_sync_detail = new GlobalSyncDetail();

                // Build the initial knowledge of our libraries
                StatusManager.Instance.UpdateStatusBusy(StatusCodes.SYNC_META_GLOBAL, "Getting your library details", 0, 1);
                List <WebLibraryDetail> web_library_details = WebLibraryManager.Instance.WebLibraryDetails_WorkingWebLibraries_All;
                foreach (WebLibraryDetail web_library_detail in web_library_details)
                {
                    // Create the new LibrarySyncDetail
                    LibrarySyncDetail library_sync_detail = new LibrarySyncDetail();
                    global_sync_detail.library_sync_details.Add(library_sync_detail);

                    // Store our knowledge about the web library detail
                    library_sync_detail.web_library_detail = web_library_detail;
                }

                // Now get the local details of each library
                {
                    StatusManager.Instance.UpdateStatusBusy(StatusCodes.SYNC_META_GLOBAL, String.Format("Gather local library details"));
                    for (int i = 0; i < global_sync_detail.library_sync_details.Count; ++i)
                    {
                        LibrarySyncDetail library_sync_detail = global_sync_detail.library_sync_details[i];
                        StatusManager.Instance.UpdateStatusBusy(StatusCodes.SYNC_META_GLOBAL, String.Format("Getting the local library details for {0}", library_sync_detail.web_library_detail.Title), i, global_sync_detail.library_sync_details.Count);
                        library_sync_detail.local_library_sync_detail = GetLocalLibrarySyncDetail(library_sync_detail.web_library_detail.library);
                    }
                }


                // Work out if they are allowed to sync this record
                StatusManager.Instance.UpdateStatusBusy(StatusCodes.SYNC_META_GLOBAL, String.Format("Determining sync allowances"));
                foreach (LibrarySyncDetail library_sync_detail in global_sync_detail.library_sync_details)
                {
                    //  Eagerly sync metadata
                    library_sync_detail.sync_decision = new LibrarySyncDetail.SyncDecision();
                    library_sync_detail.sync_decision.can_sync_metadata = true;

                    // Else initiator
                    if (false)
                    {
                    }

                    // Never guests
                    else if (library_sync_detail.web_library_detail.IsLocalGuestLibrary)
                    {
                        library_sync_detail.sync_decision.can_sync          = false;
                        library_sync_detail.sync_decision.can_sync_metadata = false;
                        library_sync_detail.sync_decision.is_readonly       = library_sync_detail.web_library_detail.IsReadOnly;
                    }

                    // Intranets are dependent on premium
                    else if (library_sync_detail.web_library_detail.IsIntranetLibrary)
                    {
                        library_sync_detail.sync_decision.can_sync          = true;
                        library_sync_detail.sync_decision.can_sync_metadata = true;
                        library_sync_detail.sync_decision.is_readonly       = library_sync_detail.web_library_detail.IsReadOnly;
                    }

                    // Bundles can never sync
                    else if (library_sync_detail.web_library_detail.IsBundleLibrary)
                    {
                        library_sync_detail.sync_decision.can_sync          = false;
                        library_sync_detail.sync_decision.can_sync_metadata = false;
                        library_sync_detail.sync_decision.is_readonly       = library_sync_detail.web_library_detail.IsReadOnly;
                    }

                    // Unknown library types
                    else
                    {
                        library_sync_detail.sync_decision.can_sync          = false;
                        library_sync_detail.sync_decision.can_sync_metadata = false;
                        library_sync_detail.sync_decision.is_readonly       = true;
                    }
                }

                return(global_sync_detail);
            }

            finally
            {
                // Clear the status bar
                StatusManager.Instance.ClearStatus(StatusCodes.SYNC_META_GLOBAL);
            }
        }
Esempio n. 8
0
        internal static GlobalSyncDetail GenerateGlobalSyncDetail(bool tally_library_storage_size)
        {
            WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread();

            try
            {
                GlobalSyncDetail global_sync_detail = new GlobalSyncDetail();

                // Build the initial knowledge of our libraries
                StatusManager.Instance.UpdateStatus(StatusCodes.SYNC_META_GLOBAL, "Getting your library details");
                List <WebLibraryDetail> web_library_details = WebLibraryManager.Instance.WebLibraryDetails_WorkingWebLibraries;
                foreach (WebLibraryDetail web_library_detail in web_library_details)
                {
                    // Create the new LibrarySyncDetail
                    LibrarySyncDetail library_sync_detail = new LibrarySyncDetail();
                    global_sync_detail.library_sync_details.Add(library_sync_detail);

                    // Store our knowledge about the web library detail
                    library_sync_detail.web_library_detail = web_library_detail;
                }

                // Now get the local details of each library
                {
                    StatusManager.Instance.UpdateStatus(StatusCodes.SYNC_META_GLOBAL, String.Format("Gather local library details"));
                    for (int i = 0; i < global_sync_detail.library_sync_details.Count; ++i)
                    {
                        LibrarySyncDetail library_sync_detail = global_sync_detail.library_sync_details[i];
                        StatusManager.Instance.UpdateStatus(StatusCodes.SYNC_META_GLOBAL, String.Format("Getting the local library details for {0}", library_sync_detail.web_library_detail.Title), i, global_sync_detail.library_sync_details.Count);
                        library_sync_detail.local_library_sync_detail = GetLocalLibrarySyncDetail(library_sync_detail.web_library_detail, tally_library_storage_size);
                    }
                }

                // Work out if they are allowed to sync this record
                StatusManager.Instance.UpdateStatus(StatusCodes.SYNC_META_GLOBAL, String.Format("Determining sync allowances"));
                foreach (LibrarySyncDetail library_sync_detail in global_sync_detail.library_sync_details)
                {
                    //  Eagerly sync metadata
                    LibrarySyncDetail.SyncDecision d = library_sync_detail.sync_decision = new LibrarySyncDetail.SyncDecision();

                    // We do not care what type of (commercial) library this has been:
                    // you are now free to choose and do as you like.
                    //
                    // Hence it should be possible for 'Guest' libraries (and everything else)
                    // to be assigned a sync target directory or URI to sync your libraries anywhere.
                    //
                    // When you think about user access rights to your library, THAT SUBJECT
                    // should be taken care of at the sync target itself: if you have
                    // WRITE access, you should be able to update the library, period.
                    d.can_sync    = true;
                    d.is_readonly = false;

                    // Bundles can never sync
                    if (library_sync_detail.web_library_detail.IsReadOnlyLibrary)
                    {
                        d.can_sync    = false;
                        d.is_readonly = true;
                    }
                }

                return(global_sync_detail);
            }
            finally
            {
                // Clear the status bar
                StatusManager.Instance.ClearStatus(StatusCodes.SYNC_META_GLOBAL);
            }
        }