Esempio n. 1
0
        public void saveMsg(string friend, AppCore.Message message)
        {
            string tmpMsgs = LegionUtils.parceToGson(msgs);

            appPreferences.saveKey(friend, tmpMsgs);
            saveRecentUser(friend, message);
        }
Esempio n. 2
0
        public void saveMsg(string username)
        {
            string tmpMsgs = LegionUtils.parceToGson(msgs);

            appPreferences.saveKey(username, tmpMsgs);
            saveRecentUser(username);
        }
Esempio n. 3
0
        void saveRecentUser(string username)
        {
            UserService useruserService = new UserService();

            if (recentConversationsUserName == null)
            {
                recentConversationsUserName = useruserService.getRecentUsers(appPreferences);
            }

            if (recentConversationsUserName.TryGetValue(username, out message))
            {
                recentConversationsUserName.Remove(username);
            }

            Dictionary <string, AppCore.Message> reTm = new Dictionary <string, AppCore.Message>();

            foreach (var item in recentConversationsUserName)
            {
                reTm.Add(item.Key, item.Value);
            }
            reTm.Add(username, msgs[msgs.Count - 1]);
            string recentUserConv = LegionUtils.parceToGson(reTm);

            appPreferences.saveKey(AppPreferences.CONVERSA_BY_JID, recentUserConv);
        }
Esempio n. 4
0
        protected void addNewGroup(AppCore.User group)
        {
            group.Jid     = AddNewGroup();
            group.isGroup = true;
            listGroups.Add(group);
            saveSeachGroups(listGroups);

            ChangeGroupSubject(group.Jid, group.username);
            invictFriend(usersIsCheck(userGroups), group.Jid);

            RunOnUiThread(() =>
                          VisibleProgress(Resource.Id.pbHeaderProgress, VISIBLE)
                          );
            Task.Delay(TimeSpan.FromSeconds(5)).Wait();

            string groupJson = LegionUtils.parceToGson(group);

            appPreferences.saveKey(AppPreferences.GROUP_JSON, groupJson);

            var activityChat = new Intent(this, typeof(ChatActivity));

            activityChat.PutExtra("chatGroup", true);
            activityChat.PutExtra("groupJson", "");
            activityChat.PutExtra("isFromGroup", true);

            this.StartActivity(activityChat);
            OverridePendingTransition(Resource.Animator.slide_out_right, Resource.Animator.stable);
            RunOnUiThread(() =>
                          VisibleProgress(Resource.Id.pbHeaderProgress, INVISIBLE)
                          );
        }
Esempio n. 5
0
        void OnClick(string calltype, int position)
        {
            User   userChat     = user.users.ElementAt(position);
            string jsonTmp      = LegionUtils.parceToGson(userChat);
            var    activityChat = new Intent(activity, typeof(ChatActivity));

            activityChat.PutExtra("userChat", jsonTmp);
            activityChat.PutExtra("isDirectCall", true);
            activityChat.PutExtra("callType", calltype);
            activity.StartActivity(activityChat);
        }
Esempio n. 6
0
        public void saveMsg(AppCore.Message msg)
        {
            string tmpMsgs   = LegionUtils.parceToGson(msgs);
            string recentKey = null;

            if (msg.isGroup)
            {
                recentKey = msg.GroupId;
                appPreferences.saveKey(msg.GroupId, tmpMsgs);
            }
            else
            {
                recentKey = friend.username;
                appPreferences.saveKey(friend.username, tmpMsgs);
            }
            saveRecentUser(recentKey);
        }
Esempio n. 7
0
        void saveRecentUser(string recentKey)
        {
            if (recentConversationsUserName.TryGetValue(recentKey, out message))
            {
                recentConversationsUserName.Remove(recentKey);
            }

            Dictionary <string, AppCore.Message> reTm = new Dictionary <string, AppCore.Message>();

            foreach (var item in recentConversationsUserName)
            {
                reTm.Add(item.Key, item.Value);
            }
            reTm.Add(recentKey, msgs[msgs.Count - 1]);
            string recentUserConv = LegionUtils.parceToGson(reTm);

            appPreferences.saveKey(AppPreferences.CONVERSA_BY_JID, recentUserConv);
        }
Esempio n. 8
0
        //Raise an event when the item-click takes place
        void OnClick(int position)
        {
            User   userChat     = user.users.ElementAt(position);
            string jsonTmp      = LegionUtils.parceToGson(userChat);
            var    activityChat = new Intent(activity, typeof(ChatActivity));

            if (userChat.isGroup)
            {
                activityChat.PutExtra("chatGroup", true);
                activityChat.PutExtra("groupJson", jsonTmp);
            }
            else
            {
                activityChat.PutExtra("userChat", jsonTmp);
                activityChat.PutExtra("isDirectCall", false);
            }


            activity.StartActivity(activityChat);
        }
Esempio n. 9
0
        public static void saveFoundJidsServer(List <string> contacts, AppPreferences appPref, string KEY)
        {
            string json = LegionUtils.parceToGson(contacts);

            appPref.saveKey(KEY, json);
        }
Esempio n. 10
0
        public static void saveFoundGroups(List <AppCore.User> groups, AppPreferences appPref, string KEY)
        {
            string json = LegionUtils.parceToGson(groups);

            appPref.saveKey(KEY, json);
        }
Esempio n. 11
0
        public void saveFoundVcards(List <User> contacts, AppPreferences appPref)
        {
            String json = LegionUtils.parceToGson(contacts);

            appPref.saveKey(AppPreferences.CONTACTS_VCARDS, json);
        }