public void Save(CheckedListBox clbVisibilityToUsers)
 {
     if (clbVisibilityToUsers != null)
     {
         clbVisibilityToUsers.DoThreadSafe(() =>
         {
             for (int i = 0; i < clbVisibilityToUsers.Items.Count; i++)
             {
                 SINerUserRight obj = (SINerUserRight)clbVisibilityToUsers.Items[i];
                 clbVisibilityToUsers.SetItemChecked(i, obj.CanEdit.Value);
             }
         });
     }
 }
示例#2
0
        public void Save(CheckedListBox clbVisibilityToUsers)
        {
            var test = ChummerHub.Client.Properties.Settings.Default.SINnerVisibility = Newtonsoft.Json.JsonConvert.SerializeObject(this);

            ChummerHub.Client.Properties.Settings.Default.Save();
            if (clbVisibilityToUsers != null)
            {
                for (int i = 0; i < clbVisibilityToUsers.Items.Count; i++)
                {
                    SINerUserRight obj = (SINerUserRight)clbVisibilityToUsers.Items[i];
                    clbVisibilityToUsers.SetItemChecked(i, obj.CanEdit.Value);
                }
            }
        }
        public void AddVisibilityForEmail(string email)
        {
            if (!IsValidEmail(email))
            {
                MessageBox.Show("Please enter a valid email address!");
                return;
            }
            SINerUserRight ur = new SINerUserRight()
            {
                EMail   = email,
                CanEdit = true,
                Id      = Guid.NewGuid()
            };
            var found = from a in this.UserRightsObservable where a.EMail.ToLowerInvariant() == email.ToLowerInvariant() select a;

            if (found.Any())
            {
                ur = found.FirstOrDefault();
            }
            if (!this.UserRightsObservable.Contains(ur))
            {
                this.UserRightsObservable.Add(ur);
            }
        }