public UserViewModel(User model, UserDetailType primaryUserDetailType, UserDetailType secondaryUserDetailType) : base(model) { TitleText = Model.Name; DetailPrimaryText = GetDetail(primaryUserDetailType); DetailSecondaryText = GetDetail(secondaryUserDetailType); ImageUri = model.Avatar?.Large ?? model.Avatar?.Medium; }
// constructor receives all the information about data type to be updated public UpdateUserDataForm(int recordingId, UserDetailType type) { _recordingId = recordingId; _updateConnectType = type; InitializeComponent(); switch (_updateConnectType) { case UserDetailType.Address: pnUpdateConnect.Controls.Add(_ucAddress); _ucAddress.UpdateAddress(_recordingId); break; case UserDetailType.Email: pnUpdateConnect.Controls.Add(_ucEmail); _ucEmail.UpdateEmail(_recordingId); break; case UserDetailType.Telephone: pnUpdateConnect.Controls.Add(_ucTelephone); _ucTelephone.UpdateTelephone(_recordingId); break; case UserDetailType.User: pnUpdateConnect.Controls.Add(_ucUserNames); _ucUserNames.UpdateNames(_recordingId); break; } }
// for the add new user functionality public AddUserDataForm(UserDetailType type) { _addConnectType = type; InitializeComponent(); switch (_addConnectType) { case UserDetailType.User: pnAddConnect.Controls.Add(_ucNewUser); break; case UserDetailType.Password: pnAddConnect.Controls.Add(_ucResetPassword); break; } }
private string GetDetail(UserDetailType detailType) { string retString = null; if (detailType == UserDetailType.Following) { retString = Model.IsFollowing ? "Following" : ""; } else if (detailType == UserDetailType.Donator) { retString = Model.DonatorTier > 0 ? "Donator" : ""; } return(retString); }
// depending on data type, corresponding uc will be opened public AddUserDataForm(int userId, UserDetailType type) { _userID = userId; _addConnectType = type; InitializeComponent(); switch (_addConnectType) { case UserDetailType.Address: pnAddConnect.Controls.Add(ucAddress); break; case UserDetailType.Email: pnAddConnect.Controls.Add(ucEmail); break; case UserDetailType.Telephone: pnAddConnect.Controls.Add(ucPhone); break; } }