/// <summary>
        /// GetSharedUserData method implementation
        /// </summary>
        internal RegistrationList GetSharedUserData()
        {
            if (usersFormView == null)
            {
                return(null);
            }
            WritableSharedDataItem shareddata = usersFormView.SharedUserData.GetItem("@adfsmfa_useredit" + seed);

            if (shareddata == null)
            {
                return(new RegistrationList());
            }
            RegistrationList registrations = shareddata.GetData();

            if (registrations == null)
            {
                registrations = (RegistrationList)this.ParentSheet.SelectionObject;
                if (registrations == null)
                {
                    registrations = new RegistrationList();
                    Registration reg = new Registration();
                    reg.Enabled = true;
                    registrations.Add(reg);
                }
                shareddata.SetData(registrations);
            }
            return(registrations);
        }
コード例 #2
0
 /// <summary>
 /// When the Apply button is clicked, this method makes the changes take effect.
 /// </summary>
 /// <returns></returns>
 protected override bool OnApply()
 {
     if (this.Dirty)
     {
         if (userPropertiesControl.CanApplyChanges())
         {
             if (isnew)
             {
                 List <MMCRegistration> reg = new List <MMCRegistration>();
                 if (usersFormView.SelectionData.SharedData.GetItem("@adfsmfanewuser") == null)
                 {
                     reg.Add(new MMCRegistration());
                     userPropertiesControl.GetUserControlData(reg);
                     WritableSharedDataItem sh = new WritableSharedDataItem("@adfsmfanewuser", false);
                     sh.SetData(reg[0]);
                     usersFormView.SelectionData.SharedData.Add(sh);
                 }
                 else if (usersFormView != null)
                 {
                     WritableSharedDataItem sh  = usersFormView.SelectionData.SharedData.GetItem("@adfsmfanewuser");
                     MMCRegistration        res = sh.GetData();
                     reg.Add(res);
                     usersFormView.SelectionData.SharedData.Remove("@adfsmfanewuser");
                     userPropertiesControl.GetUserControlData(reg);
                     usersFormView.AddUserStoreData(reg);
                 }
             }
             else
             {
                 userPropertiesControl.GetUserControlData(this.ParentSheet.SelectionObject);
                 if (usersFormView != null)
                 {
                     usersFormView.SetUserStoreData(this.ParentSheet.SelectionObject);
                 }
             }
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }