comparison Agendas/trunk/src/Agendas.Google/GooglePublicador.cs @ 158:734d3f0853bf

Manejando configuración de los publicadores con una sección propia en los .config Agregando la opción de habilitar / deshabilitar un publicador
author nelopauselli
date Fri, 05 Aug 2011 16:55:18 -0300
parents 80156ae1493f
children 2a336a6a76b5
comparison
equal deleted inserted replaced
157:f17252543cbf 158:734d3f0853bf
1 using System.Collections.Generic; 1 using System.Collections.Generic;
2 using System.Configuration; 2 using AltNetHispano.Agendas.Configurations;
3 using AltNetHispano.Agendas.Domain; 3 using AltNetHispano.Agendas.Domain;
4 using AltNetHispano.Agendas.Google.DetailsEvents; 4 using AltNetHispano.Agendas.Google.DetailsEvents;
5 5
6 namespace AltNetHispano.Agendas.Google 6 namespace AltNetHispano.Agendas.Google
7 { 7 {
10 private readonly IGCalendarAdapter _adapter; 10 private readonly IGCalendarAdapter _adapter;
11 private readonly IDictionary<TipoEvento, IGEventDetail> _gEventDetails; 11 private readonly IDictionary<TipoEvento, IGEventDetail> _gEventDetails;
12 12
13 private static string GetUserName 13 private static string GetUserName
14 { 14 {
15 get { return ConfigurationManager.AppSettings["userNameGoogleCalendar"]; } 15 get { return AgendasConfigurationManager.Publicadores.Google.Calendar.UserName; }
16 } 16 }
17 17
18 private static string GetPassword 18 private static string GetPassword
19 { 19 {
20 get { return ConfigurationManager.AppSettings["passwordGoogleCalendar"]; } 20 get { return AgendasConfigurationManager.Publicadores.Google.Calendar.Password; }
21 } 21 }
22 22
23 private static string GetCalendarId 23 private static string GetCalendarId
24 { 24 {
25 get { return ConfigurationManager.AppSettings["calendarIdGoogleCalendar"]; } 25 get { return AgendasConfigurationManager.Publicadores.Google.Calendar.CalendarId; }
26 } 26 }
27 27
28 public void Publicar(IEnumerable<Track> tracks) 28 public void Publicar(IEnumerable<Track> tracks)
29 { 29 {
30 if (!AgendasConfigurationManager.Publicadores.Google.Enabled) return;
31
30 foreach (var track in tracks) 32 foreach (var track in tracks)
31 { 33 {
32 switch (track.Accion) 34 switch (track.Accion)
33 { 35 {
34 case Accion.Agendar: 36 case Accion.Agendar: