public WatchSharing() { switch (Configuration.Streaming.WatchSharing["type"]) { case "trakt": service = new TraktSharingProvider(); break; case "follwit": service = new FollwitSharingProvider(); break; case "debug": service = new WatchSharingDebug(); break; case "none": // no reason that's explicitely listed here default: enabled = false; return; } enabled = true; service.MediaService = MPEServices.MAS; service.Configuration = Configuration.Streaming.WatchSharing; }
private void btnTest_Click(object sender, RoutedEventArgs e) { lblTestResult.Foreground = Brushes.Black; lblTestResult.Content = "Testing credentials, please wait..."; btnTest.IsEnabled = false; worker = new BackgroundWorker(); worker.DoWork += delegate(object s, DoWorkEventArgs args) { TestCredentialsData data = args.Argument as TestCredentialsData; IWatchSharingService service = GetImplementation(); args.Result = service.TestCredentials(data.Username, data.Password); }; worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs args) { if ((bool)args.Result) { lblTestResult.Content = "Login successful!"; lblTestResult.Foreground = Brushes.Green; btnSave.IsEnabled = true; } else { lblTestResult.Content = "Login failed."; lblTestResult.Foreground = Brushes.Red; } btnTest.IsEnabled = true; }; worker.RunWorkerAsync(new TestCredentialsData() { Username = txtUsername.Text, Password = txtPassword.Password }); }
public WatchSharingTimer(string identifier, IWatchSharingService service) : base() { AutoReset = true; Interval = CYCLE_TIME; Identifier = identifier; Service = service; Iteration = 0; CanceledWaitIterations = -1; }
public WatchSharing() { mas = MPEServices.MAS; switch (Configuration.Streaming.WatchSharing) { case WatchService.Trakt: enabled = true; service = new Trakt.TraktBridge(mas, Configuration.Streaming.TraktConfiguration); break; case WatchService.Debug: enabled = true; service = new WatchSharingDebug(); break; case WatchService.None: default: enabled = false; break; } }