Example #1
0
 void ProcessServerNotification(AppNotification not)
 {
     if (not is TrackerAddedNotification) {
         // Show a notification to the user
         var n = (TrackerAddedNotification) not;
         var t = TrackMeApp.WebService.GetTrackerInfo (n.ShareId, n.TrackerId);
         if (t != null) {
             string msg = string.Format (Application.Context.GetString (Resource.String.trackerNotification), t.Name);
             TrackMeApp.Notify (msg, Application.Context.GetString (Resource.String.touchToOpen));
         }
     }
 }
Example #2
0
        public static void WriteNotification(Intent intent, AppNotification not)
        {
            foreach (var p in not.GetType ().GetProperties (System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)) {
                var arg = (IntentArg) Attribute.GetCustomAttribute (p, typeof(IntentArg));
                if (arg != null)
                    SetValue (intent, arg.Name ?? p.Name, p.GetValue (not, null));
            }

            foreach (var p in not.GetType ().GetFields (System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)) {
                var arg = (IntentArg) Attribute.GetCustomAttribute (p, typeof(IntentArg));
                if (arg != null)
                    SetValue (intent, arg.Name ?? p.Name, p.GetValue (not));
            }
        }