Beispiel #1
0
 public override void Execute(Rtm rtm)
 {
     foreach (var request in Requests)
     {
         request.Execute(rtm);
     }
 }
Beispiel #2
0
        public static void LoadData()
        {
            string RtmAuthToken = IsolatedStorageHelper.GetObject<string>("RtmAuthToken");
            int? Timeline = IsolatedStorageHelper.GetObject<int?>("RtmTimeline");
            ListsResponse = IsolatedStorageHelper.GetObject<Response>("ListsResponse");
            TasksResponse = IsolatedStorageHelper.GetObject<Response>("TasksResponse");

            if (!string.IsNullOrEmpty(RtmAuthToken))
            {
                RtmClient = new Rtm(RtmApiKey, RtmSharedKey, RtmAuthToken);
            }
            else
            {
                RtmClient = new Rtm(RtmApiKey, RtmSharedKey);
            }

            RtmClient.Client.UseHttps = true;

            if (Timeline.HasValue)
            {
                RtmClient.CurrentTimeline = Timeline.Value;
            }

            RtmClient.Resources = App.Current.Resources;
        }
Beispiel #3
0
 public override void Execute(Rtm rtm)
 {
     rtm.GetResponse(Method, Parameters, ThrowOnError, (response) => {
         if (Callback != null)
             Callback(response);
     });
 }
Beispiel #4
0
        public RTMFacade()
        {
            API_KEY = ConfigurationManager.AppSettings["RTM_APIKEY"].ToString();
            SECRET = ConfigurationManager.AppSettings["RTM_SECRET"].ToString();

            _rtm = new Rtm(API_KEY, SECRET);
        }
Beispiel #5
0
        public static async void LoadData()
        {
            string RtmAuthToken = IsolatedStorageHelper.GetObject<string>("RtmAuthToken");
            int? Timeline = IsolatedStorageHelper.GetObject<int?>("RtmTimeline");
            TasksResponse = IsolatedStorageHelper.GetObject<Response>("TasksResponse");
            ListsResponse = IsolatedStorageHelper.GetObject<Response>("ListsResponse");
            LocationsResponse = IsolatedStorageHelper.GetObject<Response>("LocationsResponse");
            SettingsResponse = IsolatedStorageHelper.GetObject<Response>("SettingsResponse");
            LastUpdated = IsolatedStorageHelper.GetObject<DateTime>("LastUpdated");

            if (!string.IsNullOrEmpty(RtmAuthToken))
            {
                RtmClient = new Rtm(RtmApiKey, RtmSharedKey, RtmAuthToken);
            }
            else
            {
                RtmClient = new Rtm(RtmApiKey, RtmSharedKey);
            }

            RtmClient.Client.UseHttps = true;

            if (Timeline.HasValue)
            {
                RtmClient.CurrentTimeline = Timeline.Value;
            }

            RtmClient.CacheTasksEvent += OnCacheTasks;
            RtmClient.CacheListsEvent += OnCacheLists;
            RtmClient.CacheLocationsEvent += OnCacheLocations;
            RtmClient.CacheUserSettingsEvent += OnCacheSettings;

            if (SettingsResponse != null)
            {
                RtmClient.LoadUserSettingsFromResponse(SettingsResponse);
            }
            if (LocationsResponse != null)
            {
                RtmClient.LoadLocationsFromResponse(LocationsResponse);
            }
            if (ListsResponse != null)
            {
                RtmClient.LoadListsFromResponse(ListsResponse);
            }
            if (TasksResponse != null)
            {
                RtmClient.LoadTasksFromResponse(TasksResponse);
            }

            RtmClient.Resources = App.Current.Resources;

            //await VoiceCommandService.InstallCommandSetsFromFileAsync(new Uri("ms-appx:///Commands.xml"));
        }
Beispiel #6
0
        public static void DeleteData()
        {
            IsolatedStorageHelper.DeleteObject("RtmAuthToken");
            IsolatedStorageHelper.DeleteObject("ListsResponse");
            IsolatedStorageHelper.DeleteObject("TasksResponse");
            IsolatedStorageHelper.DeleteObject("RtmTimeline");

            RtmClient = new Rtm(RtmApiKey, RtmSharedKey);
            ListsResponse = null;
            TasksResponse = null;

            RtmClient.Resources = App.Current.Resources;
        }
Beispiel #7
0
        public Service()
        {
            if (LazyCow.Properties.Settings.Default.api_key == string.Empty ||
                LazyCow.Properties.Settings.Default.shared_secret == string.Empty)
            {
                AuthFailed(this, new EventArgs());
                return;
            }

            _dueTimers = new Dictionary<Task, Timer>();
            Rtm = new Rtm(LazyCow.Properties.Settings.Default.api_key, LazyCow.Properties.Settings.Default.shared_secret)
                      {RequestThrottling = new System.TimeSpan(0, 0, 0, 0)};
        }
Beispiel #8
0
        public static void DeleteData()
        {
            IsolatedStorageHelper.DeleteObject("RtmAuthToken");
            IsolatedStorageHelper.DeleteObject("RtmTimeline");
            IsolatedStorageHelper.DeleteObject("TasksResponse");
            IsolatedStorageHelper.DeleteObject("ListsResponse");
            IsolatedStorageHelper.DeleteObject("LocationsResponse");
            IsolatedStorageHelper.DeleteObject("SettingsResponse");
            IsolatedStorageHelper.DeleteObject("LastUpdated");

            RtmClient = new Rtm(RtmApiKey, RtmSharedKey);
            TasksResponse = null;
            ListsResponse = null;
            LocationsResponse = null;
            SettingsResponse = null;

            RtmClient.Resources = App.Current.Resources;

            //NotificationsManager.ResetLiveTiles();

            //if (ScheduledActionService.Find("BackgroundTask") != null)
            //    ScheduledActionService.Remove("BackgroundTask");

            //ShellTile primaryTile = ShellTile.ActiveTiles.First();
            //if (primaryTile != null)
            //{
            //    StandardTileData data = new StandardTileData();
            //    primaryTile.Update(data);
            //}
        }
Beispiel #9
0
        public static void LoadData()
        {
            string RtmAuthToken = IsolatedStorageHelper.GetObject<string>("RtmAuthToken");
            int? Timeline = IsolatedStorageHelper.GetObject<int?>("RtmTimeline");
            ListsResponse = IsolatedStorageHelper.GetObject<Response>("ListsResponse");
            TasksResponse = IsolatedStorageHelper.GetObject<Response>("TasksResponse");

            if (!string.IsNullOrEmpty(RtmAuthToken))
            {
                RtmClient = new Rtm(RtmApiKey, RtmSharedKey, RtmAuthToken);
            }
            else
            {
                RtmClient = new Rtm(RtmApiKey, RtmSharedKey);
            }

            if (Timeline.HasValue)
            {
                RtmClient.CurrentTimeline = Timeline.Value;
            }

            RtmClient.CacheListsEvent += OnCacheLists;
            RtmClient.CacheTasksEvent += OnCacheTasks;

            if (ListsResponse != null)
            {
                RtmClient.LoadListsFromResponse(ListsResponse);
            }
            if (TasksResponse != null)
            {
                RtmClient.LoadTasksFromResponse(TasksResponse);
            }
        }
Beispiel #10
0
        public void Reload()
        {
            if (LazyCow.Properties.Settings.Default.api_key == string.Empty ||
                LazyCow.Properties.Settings.Default.shared_secret == string.Empty)
            {
                AuthFailed(this, new EventArgs());
                return;
            }

            Rtm = new Rtm(LazyCow.Properties.Settings.Default.api_key, LazyCow.Properties.Settings.Default.shared_secret)
                      {RequestThrottling = new System.TimeSpan(0, 0, 0, 0)};
            Auth();
        }