コード例 #1
0
        private void UserNotAvailable(Guid userId)
        {
            Guard.Against.Default(userId, nameof(userId));

            var user = AvailableUsers.FirstOrDefault(x => x.UserId == userId);

            if (user is null)
            {
                return;
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                AvailableUsers.Remove(user);
                RaisePropertyChanged(nameof(UsersCount));
            });
        }
コード例 #2
0
        /// <summary>
        /// Removes the <see cref="SelectedUser"/> from the <see cref="AvailableUsers"/>
        /// and deleted its xml file.
        /// </summary>
        public void RemoveUser()
        {
            try
            {
                if (SelectedUser == ActiveUser)
                {
                    ActiveUser = null;
                }

                // remove xml file
                _fileOperator.Delete(Path.Combine(USERSFOLDER, SelectedUser.Username) + ".xml");
                AvailableUsers.Remove(SelectedUser);
            }
            catch (Exception ex)
            {
                _windowManager.MessageBoxService.ShowDialog("Could not remove user from list: " + ex.Message);
            }
        }
コード例 #3
0
        /// <summary>
        /// Removes the <see cref="SelectedUser"/> from the <see cref="AvailableUsers"/>
        /// and deleted its xml file.
        /// </summary>
        public void RemoveUser()
        {
            try
            {
                if (SelectedUser == ActiveUser)
                {
                    ActiveUser = null;
                }

                // remove xml file
                File.Delete(USERSFOLDER + "\\" + SelectedUser.Username + ".xml");
                AvailableUsers.Remove(SelectedUser);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Could not remove user from list: " + ex.Message);
            }
        }