Esempio n. 1
0
        public HikeViewModel(List <ConversationListObject> convList)
        {
            _convMap    = new Dictionary <string, ConversationListObject>(convList.Count);
            _pendingReq = new ObservableCollection <ConversationListObject>();
            _favList    = new ObservableCollection <ConversationListObject>();

            List <ConversationBox> listConversationBox = new List <ConversationBox>();

            // this order should be maintained as _convMap should be populated before loading fav list
            for (int i = 0; i < convList.Count; i++)
            {
                ConversationListObject convListObj = convList[i];
                _convMap[convListObj.Msisdn] = convListObj;
                convListObj.ConvBoxObj       = new ConversationBox(convListObj);//context menu wil bind on page load
                listConversationBox.Add(convListObj.ConvBoxObj);
            }
            _messageListPageCollection = new ObservableCollection <ConversationBox>(listConversationBox);
            MiscDBUtil.LoadFavourites(_favList, _convMap);
            int count = 0;

            App.appSettings.TryGetValue <int>(HikeViewModel.NUMBER_OF_FAVS, out count);
            if (count != _favList.Count) // values are not loaded, move to backup plan
            {
                _favList.Clear();
                MiscDBUtil.LoadFavouritesFromIndividualFiles(_favList, _convMap);
            }
            RegisterListeners();
        }
Esempio n. 2
0
        public HikeViewModel()
        {
            _messageListPageCollection = new ObservableCollection <ConversationBox>();
            _convMap    = new Dictionary <string, ConversationListObject>();
            _favList    = new ObservableCollection <ConversationListObject>();
            _pendingReq = new ObservableCollection <ConversationListObject>();
            MiscDBUtil.LoadFavourites(_favList, _convMap);
            int count = 0;

            App.appSettings.TryGetValue <int>(HikeViewModel.NUMBER_OF_FAVS, out count);
            if (count != _favList.Count) // values are not loaded, move to backup plan
            {
                _favList.Clear();
                MiscDBUtil.LoadFavouritesFromIndividualFiles(_favList, _convMap);
            }
            RegisterListeners();
        }