Ejemplo n.º 1
0
 private void GroupRequestCompleted(Group group, GroupRequestDialog.RequestPurpose purpose)
 {
     if (purpose == GroupRequestDialog.RequestPurpose.newGroupName)
     {
         _localData.AddUserToGroup(_user, group);
         _user.Groups.Add(group);
         SetGroupsView();
     }
 }
Ejemplo n.º 2
0
        public GroupView(User user, Group group, LocalData localData)
        {
            Debug.WriteLine("[m] [GroupView] Constructor running");

            InitializeComponent();

            _image.Clicked += Image_Clicked;

            _removeBt.Clicked += (object sender, EventArgs e) =>
            {
                Button button = sender as Button;

                if (CurrentUser.Groups.Contains(Group))
                {
                    button.Text = "Add to groups list";
                    CurrentUser.Groups.Remove(Group);
                    _localData.DeleteUserFromGroup(CurrentUser, Group);
                }
                else
                {
                    button.Text = "Remove from groups list";
                    CurrentUser.Groups.Add(Group);
                    _localData.AddUserToGroup(CurrentUser, Group);
                }
            };

            _editBt.Clicked += (object sender, EventArgs e) => EditGroupRequest(GroupEditor.EditPurpose.edit, Group);

            _showMembersBt.Clicked += (object o, EventArgs e) => ShowMembersRequest(FriendsView.Mode.ReadOnly);

            //debug

            _editBt.Clicked        += (object o, EventArgs e) => Debug.WriteLine("[m] [GroupView] _editBt Clicked");
            _removeBt.Clicked      += (object sender, EventArgs e) => Debug.WriteLine("[m] [GroupView] _removeBt Clicked");
            _image.Clicked         += (object sender, EventArgs e) => Debug.WriteLine("[m] [GroupView] _image Clicked");
            _showMembersBt.Clicked += (object o, EventArgs e) => Debug.WriteLine("[m] [GroupView] _showMembersBt Clicked running");

            //debug

            Update(user, group, localData);
        }