NotifyChanges.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using InABox.Mobile;
  2. using System.Collections.Generic;
  3. namespace PRS.Mobile
  4. {
  5. public static class NotifyMobileChanges
  6. {
  7. public static string Notifiy()
  8. {
  9. RemoveOldProperties();
  10. string latestChanges = "";
  11. List<string> changes = new List<string>
  12. {
  13. "- Stability improvements to connections"
  14. };
  15. foreach (string s in changes)
  16. {
  17. latestChanges = s + System.Environment.NewLine + latestChanges;
  18. }
  19. if (App.Current.Properties.ContainsKey("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber))
  20. return "";
  21. else
  22. {
  23. App.Current.Properties.Add("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber, "True");
  24. return latestChanges;
  25. }
  26. }
  27. private static void RemoveOldProperties()
  28. {
  29. if (App.Current.Properties.Count > 0)
  30. {
  31. List<string> toDelete = new List<string>();
  32. foreach (string s in App.Current.Properties.Keys)
  33. {
  34. if (s.Contains("NotifiedOfChanges"))
  35. {
  36. if (!s.Equals("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber))
  37. {
  38. toDelete.Add(s);
  39. }
  40. }
  41. }
  42. foreach (string s in toDelete)
  43. {
  44. App.Current.Properties.Remove(s);
  45. }
  46. }
  47. }
  48. }
  49. }