Example #1
0
        private void SetupSyncManager()
        {
            SyncManager.Started += (sender, e) => ShowTrayNotification(L10n.Get("AppRunning", AppName), NotificationPeriod.NORMAL);
            SyncManager.Stopped += (sender, e) => ShowTrayNotification(L10n.Get("AppStopped", AppName), NotificationPeriod.NORMAL);

            SyncManager.SubtitleDownloaded += (sender, e) =>
            {
                var subtitleInfo = (e as SubtitleDownloadedEventArgs).SubtitleFile;

                ShowTrayNotification(L10n.Get("SubtitleDownloaded", subtitleInfo.VideoFile.Name), NotificationPeriod.NORMAL);
            };

            SyncManager.InternetConnectivityLost += (sender, e) =>
            {
                if (SyncManager.Status != SyncStatus.RUNNING)
                {
                    return;
                }

                Thread t = new Thread(new ThreadStart(() => BkgWorkerStartStopSync.RunWorkerAsync(SyncAction.STOP)));
                t.Start();

                MessageBox.Show(L10n.Get("InternetOfflineRegularCheck"), CurrentVersion.ReleaseInfo.ApplicationName);
            };
        }
Example #2
0
        public void StartStopSync()
        {
            if (SyncManager.Status == SyncStatus.NOT_RUNNING)
            {
                if (NetworkUtils.IsInternetAvailable())
                {
                    LstDirectories.ClearSelected();
                    LstLanguagePreferences.ClearSelected();
                    LstLanguages.ClearSelected();

                    BkgWorkerStartStopSync.RunWorkerAsync(SyncAction.START);
                }
                else
                {
                    MessageBox.Show(L10n.Get("InternetOfflineStartSync"), CurrentVersion.ReleaseInfo.ApplicationName);
                }
            }
            else if (SyncManager.Status == SyncStatus.RUNNING)
            {
                BkgWorkerStartStopSync.RunWorkerAsync(SyncAction.STOP);
            }
        }