コード例 #1
0
ファイル: SyncView.cs プロジェクト: MetroStar/eBriefingiOS
        public static void Show(UIView view, CloudSync.SyncType syncType)
        {
            if (Reachability.IsDefaultNetworkAvailable())
            {
                LoadingView.CancelEvent += HandleCancelEvent;
                LoadingView.Show("Syncing", "Please wait while" + '\n' + "eBriefing is syncing." + '\n' + "This may take a few minutes...");

                // Pull sync
                if (syncType == CloudSync.SyncType.PULL)
                {
                    CloudSync.ReceiveDoneEvent += HandleReceiveDoneEvent;

                    CloudSync.Pull();
                }

                // Push and Pull sync
                else if (syncType == CloudSync.SyncType.PUSH_AND_PULL)
                {
                    PushNPullInProgress      = true;
                    CloudSync.SyncDoneEvent += HandleSyncDoneEvent;

                    CloudSync.PushAndPull();
                }
            }
            else
            {
                StartTimer();
            }
        }
コード例 #2
0
        async private Task OpenSyncView()
        {
            LoadingView.Show("Syncing", "Please wait while" + '\n' + "eBriefing is syncing." + '\n' + "This may take a few minutes...", false);

            // Start Push and Pull
            if (!CloudSync.SyncingInProgress)
            {
                CloudSync.SyncingInProgress = true;
                await eBriefingService.Run(() => CloudSync.PushAndPull());

                CloudSync.SyncingInProgress = false;
            }

            LoadingView.Hide();

            // Once syncing is finished, check books to download
            BookUpdater.CheckBooks2Download();
        }
コード例 #3
0
        async private Task OpenSyncView(bool bfromSyncButton = false)
        {
            LoadingView.Show("Syncing", "Please wait while" + '\n' + "eBriefing is syncing." + '\n' + "This may take a few minutes...", false);

            // Start Push and Pull
            if (!CloudSync.SyncingInProgress)
            {
                CloudSync.SyncingInProgress = true;
                await eBriefingService.Run(() => CloudSync.PushAndPull());

                CloudSync.SyncingInProgress = false;
            }

            LoadingView.Hide();

            // Once syncing is finished, check books to download
            BookUpdater.CheckBooks2Download();

            // Refresh
            HandleRefreshEvent1(this, EventArgs.Empty);

            if (tabBarController.SelectedIndex == 1)
            {
                HandleRefreshEvent2(this, EventArgs.Empty);
            }
            else if (tabBarController.SelectedIndex == 2)
            {
                HandleRefreshEvent3(this, EventArgs.Empty);
            }
            else if (tabBarController.SelectedIndex == 3)
            {
                vc4.LoadBooks();
            }

            if (!bfromSyncButton)
            {
                // Start the PUSH timer in the background
                SyncPushTimer.Start();
            }
        }