Exemplo n.º 1
0
        public FriendsPage()
        {
            InitializeComponent();

            FriendService friendService = new FriendService();
            var           userFriends   = friendService.GetUserFriends(AuthenticationService.CurrentUser);

            FriendsDataGrid.ItemsSource = userFriends;
        }
Exemplo n.º 2
0
        public MessagePage()
        {
            InitializeComponent();

            //user user2 = new user() { user_id = 2, nickname = "EEE", register_date = new DateTime(1582, 10, 5), status_id = 1, IsDeleted = 0, password = "******", wallet_id = 1 };
            FriendService friendService = new FriendService();
            var           userFriends   = friendService.GetUserFriends(AuthenticationService.CurrentUser);

            //FriendsDataGrid.ItemsSource = userFriends.Select(s => new { Value = s }).ToList();
            FriendsDataGrid.ItemsSource = userFriends;
        }
Exemplo n.º 3
0
        private void dataBindingFriendsButtonClick(object i_Sender, EventArgs i_EventArgs)
        {
            contentSpinner.Visible = true;
            resetContentPanel();

            try
            {
                friendsDataBindingContentPanel.Visible = true;

                friendsDataBindingContentPanel.Padding = new Padding(10);
                friendsDataBindingContentPanel.Dock    = DockStyle.Fill;
                contentPanel.Controls.Add(friendsDataBindingContentPanel);

                new Thread(() =>
                {
                    //time consuming operation
                    IFriendService friendService = new FriendService();
                    FacebookObjectCollection <User> userFriends = friendService.GetUserFriends(r_LoginService.LoggedInUser);

                    //invoke the UI
                    if (!friendsListBox.InvokeRequired)
                    {
                        //binding the data source of the binding source, to our data source
                        userBindingSource.DataSource = userFriends;
                        contentSpinner.Visible       = false;
                    }
                    else
                    {
                        // In case of cross-thread operation, invoking the binding code on the listBox's thread
                        friendsListBox.Invoke(new Action(() => userBindingSource.DataSource = userFriends));
                        contentSpinner.Invoke(new Action(() => contentSpinner.Visible       = false));
                    }
                }).Start();
            }
            catch (Exception)
            {
                MessageBox.Show(Resources.RetriveDataErrorMessage, Resources.RetriveDataErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        private void Button_Click_Delete_Row(object sender, RoutedEventArgs e)
        {
            int id = (FriendsDataGrid.SelectedItem as user).user_id;

            FriendService friendService = new FriendService();

            using (SteamContext context = new SteamContext())
            {
                user tmp = (from user in context.Users where user.user_id == id select user).SingleOrDefault();

                friendService.DeleteFriends(tmp);
            }

            user user2 = new user()
            {
                user_id = 2, nickname = "EEE", register_date = new DateTime(1582, 10, 5), status_id = 1, IsDeleted = 0, password = "******", wallet_id = 1
            };

            var userFriends = friendService.GetUserFriends(user2);

            FriendsDataGrid.ItemsSource = userFriends;
        }