private void CboLanguage1_SelectedIndexChanged_1(object sender, EventArgs e) { _strSelectedLanguage = cboLanguage1.SelectedValue?.ToString() ?? GlobalOptions.DefaultLanguage; imgLanguageFlag.Image = FlagImageGetter.GetFlagFromCountryCode(_strSelectedLanguage.Substring(3, 2)); bool isEnabled = !string.IsNullOrEmpty(_strSelectedLanguage) && _strSelectedLanguage != GlobalOptions.DefaultLanguage; }
public void InitializeMe(bool onlyPWHash) { cbIsPublic.Checked = false; if (StaticUtils.UserRoles?.Contains("GroupAdmin") == true) { EditMode = true; } this.cboLanguage1 = frmViewer.PopulateLanguageList(cboLanguage1, null); imgLanguageFlag.Image = FlagImageGetter.GetFlagFromCountryCode(_strSelectedLanguage.Substring(3, 2)); if (MyGroup != null) { tbAdminRole.Text = MyGroup.MyAdminIdentityRole; tbGroupId.Text = MyGroup.Id?.ToString(); tbGroupname.Text = MyGroup.Groupname; tbParentGroupId.Text = MyGroup.MyParentGroupId?.ToString(); tbPassword.Text = ""; tbGroupCreatorUsername.Text = MyGroup.GroupCreatorUserName; this.cboLanguage1.SelectedValue = MyGroup.Language; if (MyGroup.IsPublic.HasValue) { cbIsPublic.Checked = MyGroup.IsPublic.Value; } } tbGroupCreatorUsername.ReadOnly = true; tbAdminRole.ReadOnly = true; tbGroupId.ReadOnly = true; tbGroupname.ReadOnly = !EditMode; cboLanguage1.Enabled = EditMode; cbIsPublic.Enabled = EditMode; tbParentGroupId.ReadOnly = true; tbPassword.ReadOnly = !EditMode; if (StaticUtils.UserRoles?.Contains("GroupAdmin") == true) { tbAdminRole.ReadOnly = !EditMode; tbGroupId.ReadOnly = true; tbParentGroupId.ReadOnly = !EditMode; tbGroupCreatorUsername.ReadOnly = !EditMode; } if (onlyPWHash) { tbAdminRole.ReadOnly = true; tbGroupId.ReadOnly = true; tbGroupname.ReadOnly = true; cboLanguage1.Enabled = false; tbParentGroupId.ReadOnly = true; tbPassword.ReadOnly = false; } }
public SINnerGroupSearch() { InitializeComponent(); ImageList myCountryImageList = new ImageList(); foreach (var lang in frmViewer.LstLanguages) { var img = FlagImageGetter.GetFlagFromCountryCode(lang.Value.ToString().Substring(3, 2)); myCountryImageList.Images.Add(img); } tvGroupSearchResult.ImageList = myCountryImageList; bCreateGroup.Enabled = false; bJoinGroup.Enabled = false; }
public void InitializeMe(bool onlyPWHash) { cbIsPublic.Checked = false; if (StaticUtils.UserRoles?.Contains("GroupAdmin") == true) { EditMode = true; } cboLanguage1 = frmViewer.PopulateLanguageList(cboLanguage1, null); imgLanguageFlag.Image = FlagImageGetter.GetFlagFromCountryCode(_strSelectedLanguage.Substring(3, 2)); if (MyGroup != null) { tbDescription.Text = MyGroup.Description; tbAdminRole.Text = MyGroup.MyAdminIdentityRole; tbGroupId.Text = MyGroup.Id?.ToString(); tbGroupname.Text = MyGroup.Groupname; tbParentGroupId.Text = MyGroup.MyParentGroupId?.ToString(); tbPassword.Text = string.Empty; tbGroupCreatorUsername.Text = !string.IsNullOrEmpty(MyGroup.GroupCreatorUserName) ? MyGroup.GroupCreatorUserName : Properties.Settings.Default.UserEmail; cboLanguage1.SelectedValue = !string.IsNullOrEmpty(MyGroup.Language) ? MyGroup.Language : GlobalOptions.Language; if (MyGroup.IsPublic.HasValue) { cbIsPublic.Checked = MyGroup.IsPublic.Value; } } tbGroupCreatorUsername.ReadOnly = true; tbAdminRole.ReadOnly = true; tbGroupId.ReadOnly = true; tbGroupname.ReadOnly = !EditMode; cboLanguage1.Enabled = EditMode; cbIsPublic.Enabled = EditMode; tbPassword.ReadOnly = !EditMode; if (StaticUtils.UserRoles?.Contains("GroupAdmin") == true) { tbAdminRole.ReadOnly = !EditMode; tbGroupId.ReadOnly = true; tbGroupCreatorUsername.ReadOnly = !EditMode; } if (onlyPWHash) { tbAdminRole.ReadOnly = true; tbGroupId.ReadOnly = true; tbGroupname.ReadOnly = true; cboLanguage1.Enabled = false; tbParentGroupId.ReadOnly = true; tbPassword.ReadOnly = false; tbGroupCreatorUsername.Enabled = false; cbIsPublic.Enabled = false; tbDescription.Enabled = false; ActiveControl = tbPassword; } if (ParentForm != null) { ParentForm.AcceptButton = bOk; } }
public void InitializeMe(bool onlyPWHash) { cbIsPublic.Checked = false; if (StaticUtils.UserRoles?.Contains("GroupAdmin") == true) { EditMode = true; } LanguageManager.PopulateSheetLanguageList(cboLanguage1, string.Empty); imgLanguageFlag.Image = FlagImageGetter.GetFlagFromCountryCode(_strSelectedLanguage.Substring(3, 2)); if (MyGroup != null) { tbDescription.Text = MyGroup.Description; tbAdminRole.Text = MyGroup.MyAdminIdentityRole; tbGroupId.Text = MyGroup.Id?.ToString(); tbGroupname.Text = MyGroup.Groupname; tbParentGroupId.Text = MyGroup.MyParentGroupId?.ToString(); tbPassword.Text = string.Empty; tbGroupCreatorUsername.Text = !string.IsNullOrEmpty(MyGroup.GroupCreatorUserName) ? MyGroup.GroupCreatorUserName : Properties.Settings.Default.UserEmail; cboLanguage1.SelectedValue = !string.IsNullOrEmpty(MyGroup.Language) ? MyGroup.Language : GlobalSettings.Language; if (MyGroup.IsPublic) { cbIsPublic.Checked = MyGroup.IsPublic; } } tbGroupCreatorUsername.ReadOnly = true; tbAdminRole.ReadOnly = true; tbGroupId.ReadOnly = true; tbGroupname.ReadOnly = !EditMode; cboLanguage1.Enabled = EditMode; cbIsPublic.Enabled = EditMode; tbPassword.ReadOnly = !EditMode; if (StaticUtils.UserRoles?.Contains("GroupAdmin") == true) { tbAdminRole.ReadOnly = !EditMode; tbGroupId.ReadOnly = true; tbGroupCreatorUsername.ReadOnly = !EditMode; } if (onlyPWHash) { tbAdminRole.ReadOnly = true; tbGroupId.ReadOnly = true; tbGroupname.ReadOnly = true; cboLanguage1.Enabled = false; tbParentGroupId.ReadOnly = true; tbPassword.ReadOnly = false; tbGroupCreatorUsername.Enabled = false; cbIsPublic.Enabled = false; tbDescription.Enabled = false; ActiveControl = tbPassword; } if (ParentForm != null) { ParentForm.AcceptButton = bOk; } string admintooltip = "This field allowes an GroupAdmin (a global role assigned only by one of " + Environment.NewLine; admintooltip += " the chummer devs) to chose other users/roles for this group to be a local \"groupadmin\""; tbAdminRole.SetToolTip(admintooltip); }