Exemplo n.º 1
0
        public SyncControlGridItemSet(LibrarySyncManager.SyncRequest sync_request, GlobalSyncDetail global_sync_detail)
        {
            this.sync_request       = sync_request;
            this.global_sync_detail = global_sync_detail;

            // Populate the grid datasource
            grid_items = new List <SyncControlGridItem>();
            foreach (var library_sync_detail in global_sync_detail.library_sync_details)
            {
                var grid_item = new SyncControlGridItem(library_sync_detail);

                grid_items.Add(grid_item);
            }
        }
Exemplo n.º 2
0
        internal void DoMaintenance()
        {
            WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread();

            List <string>           library_identifiers = new List <string>();
            List <WebLibraryDetail> web_library_details = WebLibraryManager.Instance.WebLibraryDetails_WorkingWebLibraries;

            List <WebLibraryDetail> libraries_to_sync = new List <WebLibraryDetail>();

            foreach (WebLibraryDetail web_library_detail in web_library_details)
            {
                // This needs to be written for intranet libraries
                //
                // The best way to do it might be, at the end of a sync, to write a timestamp
                // to the shared folder at the end of a sync, and write that same timestamp to
                // library.WebLibraryDetail.LastSynced
                //
                // That way, if the timestamp in the shared folder has been changed
                // to what our client last saw, we know we need to sync.
                //
                if (web_library_detail.AutoSync)
                {
                    string   syncfilepath = HistoricalSyncFile.GetSyncDbFilename(web_library_detail);
                    DateTime dt           = File.Exists(syncfilepath) ? File.GetLastWriteTimeUtc(syncfilepath) : WebLibraryManager.DATE_ZERO;

                    if (dt != (web_library_detail.LastSynced ?? WebLibraryManager.DATE_ZERO))
                    {
                        Logging.Info("Library {0} is in need of a sync - and has been flagged for autosync", web_library_detail.Title);
                        libraries_to_sync.Add(web_library_detail);
                    }
                }
            }

            if (0 < libraries_to_sync.Count)
            {
                Logging.Info("At least one library needs to autosync");
                WebLibraryManager.Instance.NotifyOfChangeToWebLibraryDetail();

                LibrarySyncManager.SyncRequest sync_request = new LibrarySyncManager.SyncRequest(wants_user_intervention: false, libraries_to_sync, suppress_already_in_progress_notification: true);
                WPFDoEvents.InvokeInUIThread(() =>
                                             LibrarySyncManager.Instance.RequestSync(sync_request)
                                             );
            }
        }
        internal void DoMaintenance()
        {
            WPFDoEvents.AssertThisCodeIs_NOT_RunningInTheUIThread();

            List <string>           library_identifiers = new List <string>();
            List <WebLibraryDetail> web_library_details = WebLibraryManager.Instance.WebLibraryDetails_WorkingWebLibrariesWithoutGuest;

            List <Library> libraries_to_sync = new List <Library>();

            foreach (WebLibraryDetail web_library_detail in web_library_details)
            {
                // TODO - this needs to be written for intranet libraries
                //
                // The best way to do it might be, at the end of a sync, to write a timestamp
                // to the shared folder at the end of a sync, and write that same timestamp to
                // library.WebLibraryDetail.LastServerSyncNotificationDate
                //
                // That way, if the timestamp in the shared folder has been changed
                // to what our client last saw, we know we need to sync.
                //
                if (web_library_detail.AutoSync)
                {
                    Library library = WebLibraryManager.Instance.GetLibrary(web_library_detail.Id);
#if TODO
                    if (_____TIMESTAMP_IN_SHARED_FOLDER_____ != library.WebLibraryDetail.LastServerSyncNotificationDate)
                    {
                        Logging.Info("Library {0} is in need of a sync - and has been flagged for autosync", library.WebLibraryDetail.Title);
                        libraries_to_sync.Add(library);
                    }
#endif
                }
            }

            if (0 < libraries_to_sync.Count)
            {
                Logging.Info("At least one library needs to autosync");
                WebLibraryManager.Instance.NotifyOfChangeToWebLibraryDetail();

                LibrarySyncManager.SyncRequest sync_request = new LibrarySyncManager.SyncRequest(false, libraries_to_sync, true, true, true);
                WPFDoEvents.InvokeInUIThread(() =>
                                             LibrarySyncManager.Instance.RequestSync(sync_request)
                                             );
            }
        }
Exemplo n.º 4
0
        internal void DoMaintenance()
        {
            List <string>           library_identifiers = new List <string>();
            List <WebLibraryDetail> web_library_details = WebLibraryManager.Instance.WebLibraryDetails_WorkingWebLibrariesWithoutGuest;

            List <Library> libraries_to_sync = new List <Library>();

            foreach (WebLibraryDetail web_library_detail in web_library_details)
            {
                /*
                 * *** TODO - this needs to be written for intranet libraries
                 * The best way to do it might be, at the end of a sync, to write a timestamp to the shared folder at the end of a sync, and write that same timestamp to library.WebLibraryDetail.LastServerSyncNotificationDate
                 * That way, if the timestamp in the shared folder has been changed to what our client last saw, we know we need to sync
                 * ***
                 * if (web_library_detail.AutoSync)
                 * {
                 *  Library library = WebLibraryManager.Instance.GetLibrary(web_library_detail.Id);
                 *  if (_____TIMESTAMP_IN_SHARED_FOLDER_____ != library.WebLibraryDetail.LastServerSyncNotificationDate)
                 *  {
                 *      Logging.Info("Library {0} is in need of a sync - and has been flagged for autosync", library.WebLibraryDetail.Title);
                 *      libraries_to_sync.Add(library);
                 *  }
                 * }
                 */
            }

            if (0 < libraries_to_sync.Count)
            {
                Logging.Info("At least one library to autosync");
                WebLibraryManager.Instance.NotifyOfChangeToWebLibraryDetail();

                LibrarySyncManager.SyncRequest sync_request = new LibrarySyncManager.SyncRequest(false, libraries_to_sync, true, true, true);
                Application.Current.Dispatcher.Invoke(((Action)(() =>
                                                                LibrarySyncManager.Instance.RequestSync(sync_request)
                                                                )));
            }
        }