예제 #1
0
        public AppState(Context context, IApplicationDataStorage dataStorage, Action <Intent> startActivity)
        {
            DataStorage = dataStorage;
            var languages = LoadLanguages();

            LanguageFile        = new LanguageFile(languages);
            TherapistCollection = new TherapistCollection(context, dataStorage, startActivity);
            //TherapistCollection.NotifiedTherapists.Add(TherapistCollection.AllTherapists.First());
        }
예제 #2
0
        public TherapistCollection(Context context, IApplicationDataStorage dataStorage, Action <Intent> startActivity)
        {
            Context     = context;
            DataStorage = dataStorage;
            DataStorage.DeleteValue(NOTIFIED);
            StartActivity = startActivity;
            var psychoStream = typeof(TherapistCollection).Assembly.GetManifestResourceStream("PsychoAssist.Droid.therapists.psycho");
            var serializer   = new XmlSerializer(typeof(Therapist[]));

            using (psychoStream)
            {
                var therapists = (Therapist[])serializer.Deserialize(psychoStream ?? throw new InvalidOperationException());
                therapists    = therapists.OrderBy(t => t.FamilyName).ThenBy(t => t.Name).ToArray();
                AllTherapists = new ReadOnlyCollection <Therapist>(therapists);
            }

            LoadStarredTherapists();
            StarredTherapists.CollectionChanged += StarredTherapists_CollectionChanged;
            //LoadNotifiedTherapists();
            //NotifiedTherapists.CollectionChanged += NotifiedTherapists_CollectionChanged;
        }