예제 #1
0
        private void SyncButton_Click(object sender, EventArgs e)
        {
            int i = Array.IndexOf(_syncButtons, sender);

            if (i >= 0)
            {
                Cursor = Cursors.WaitCursor;

                try
                {
                    ResyncOption option = (ResyncOption)i;
                    bool         done   = _syncState.Resync(option);
                    UpdateUI();

                    Cursor = null;

                    if (!done && !string.IsNullOrEmpty(OPTION_TEXT[i]))
                    {
                        // Feedback
                        MessageBox.Show(this,
                                        OPTION_TEXT[i],
                                        Properties.Resources.SyncState_Resync_Caption,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information
                                        );
                    }
                }
                finally
                {
                    Cursor = null;
                }
            }
        }
예제 #2
0
            public bool Resync(ResyncOption option)
            {
                if (!CanResync(option))
                {
                    return(true);
                }

                switch (option)
                {
                case ResyncOption.GAB:
                    if (IsSyncing)
                    {
                        // Already syncing, resync GAB asynchronously
                        _featureGAB.FullResync(null, _accounts);
                        // Cannot resync again until the dialog is reopened
                        _canResync[(int)ResyncOption.GAB] = false;
                        return(false);
                    }
                    else
                    {
                        ProgressDialog.Execute("GABSync",
                                               (ct, tracker) =>
                        {
                            _featureGAB.FullResync(tracker, _accounts);
                            return(0);
                        }
                                               );
                        return(true);
                    }

                case ResyncOption.Signatures:
                    ProgressDialog.Execute("SignaturesSync",
                                           (ct) =>
                    {
                        _featureSignatures.Resync(_accounts);
                        return(0);
                    }
                                           );
                    return(true);

                case ResyncOption.ServerData:
                    ProgressDialog.Execute("ServerSync",
                                           (ct) =>
                    {
                        ThisAddIn.Instance.Watcher.Sync.ExecuteTasks(_accounts);
                        return(0);
                    }
                                           );

                    return(true);

                case ResyncOption.Full:
                    IRestarter restarter = ThisAddIn.Instance.Restarter();
                    restarter.ResyncAccounts(_accounts);
                    restarter.Restart();
                    return(true);
                }
                return(true);
            }
예제 #3
0
 public bool CanResync(ResyncOption option)
 {
     // TODO: check if outlook is not offline?
     return(_canResync[(int)option]);
 }