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

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

            if (registrations == null)
            {
                registrations = (MFAUserList)this.ParentSheet.SelectionObject;
                if (registrations == null)
                {
                    registrations = new MFAUserList();
                    MFAUser reg = new MFAUser
                    {
                        Enabled = true
                    };
                    registrations.Add(reg);
                }
                shareddata.SetData(registrations);
            }
            return(registrations);
        }
        /// <summary>
        /// SetSharedUserData method implementation
        /// </summary>
        internal void SetSharedUserData(RegistrationList registrations)
        {
            if (usersFormView == null)
            {
                return;
            }
            WritableSharedDataItem shareddata = usersFormView.SharedUserData.GetItem("@adfsmfa_useredit" + seed);

            if (shareddata == null)
            {
                return;
            }
            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);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public ExtensibleNode()
        {
            this.DisplayName = "Extensible ScopeNode";

            // add data item viewable by extensions
            WritableSharedDataItem writableSharedDataItem = new WritableSharedDataItem(Data1ClipboardFormatId, true);

            // writableSharedDataItem.SetData(Encoding.Unicode.GetBytes("Some Sample Data1"));
            this.SharedData.Add(writableSharedDataItem);
        }
        /// <summary>
        /// Handles call back shared data items
        /// </summary>
        /// <param name="sharedDataItem">shared data</param>
        /// <returns>the item data in binary form</returns>
        protected byte[] OnGetSharedData(WritableSharedDataItem sharedDataItem)
        {
            byte[] sharedDataBytes = null;

            if (sharedDataItem.ClipboardFormatId == Data1ClipboardFormatId)
            {
                sharedDataBytes = Encoding.Unicode.GetBytes("Some Sample Data " + System.DateTime.Now.ToShortTimeString());
            }
            return(sharedDataBytes);
        }
 /// <summary>
 /// Initialize the notification for the page.
 /// </summary>
 protected override void OnInitialize()
 {
     base.OnInitialize();
     if (usersFormView != null)
     {
         WritableSharedDataItem shareddata = usersFormView.SharedUserData.GetItem("@adfsmfa_useredit" + seed);
         if (shareddata == null)
         {
             shareddata = new WritableSharedDataItem("@adfsmfa_useredit" + seed, false);
             usersFormView.SharedUserData.Add(shareddata);
         }
         LoadSharedUserData(this.userPropertiesControl, true);
     }
     Dirty = false;
 }
        private void selectionService_SelectionChanged(object sender, EventArgs e)
        {
            ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeFormView>(0L, "-->ExchangeFormView.SelectionChanged: {0}", this);
            this.DelayUpdates();
            SelectedObjects    selectedObjects     = new SelectedObjects(this.selectionService.GetSelectedComponents());
            DataObject         selectionDataObject = this.ResultPane.SelectionDataObject;
            WritableSharedData writableSharedData  = new WritableSharedData();
            UnicodeEncoding    unicodeEncoding     = new UnicodeEncoding();

            foreach (string text in selectionDataObject.GetFormats())
            {
                object data = selectionDataObject.GetData(text);
                if (data is string)
                {
                    WritableSharedDataItem writableSharedDataItem = new WritableSharedDataItem(text, false);
                    writableSharedDataItem.SetData(unicodeEncoding.GetBytes(data as string));
                    writableSharedData.Add(writableSharedDataItem);
                    ExTraceGlobals.DataFlowTracer.Information <string, object>(0L, "ExchangeFormView.SelectionChanged: shared data: {0} => {1}", text, data);
                }
                else
                {
                    ExTraceGlobals.DataFlowTracer.Information <string, object>(0L, "ExchangeFormView.SelectionChanged: {0}:{1} is not published to MMC because it is not a string.", text, data);
                }
            }
            if (selectedObjects.Count > 0)
            {
                ExTraceGlobals.DataFlowTracer.Information <int>(0L, "ExchangeFormView.SelectionChanged: selectedComponents.Count:{0}", selectedObjects.Count);
                base.SelectionData.Update(selectedObjects, selectedObjects.Count > 1, ExchangeFormView.emptyGuidArray, writableSharedData);
                base.SelectionData.DisplayName = selectionDataObject.GetText();
                ExTraceGlobals.DataFlowTracer.Information <string>(0L, "ExchangeFormView.SelectionChanged: this.SelectionData.DisplayName:{0}", base.SelectionData.DisplayName);
                base.SelectionData.Description = (selectionDataObject.GetData("Description") as string);
                ExTraceGlobals.DataFlowTracer.Information <string>(0L, "ExchangeFormView.SelectionChanged: this.SelectionData.Description:{0}", base.SelectionData.Description);
                base.SelectionData.HelpTopic = (string.IsNullOrEmpty(this.ResultPane.SelectionHelpTopic) ? base.ScopeNode.HelpTopic : this.ResultPane.SelectionHelpTopic);
                ExTraceGlobals.DataFlowTracer.Information <string>(0L, "ExchangeFormView.SelectionChanged: this.SelectionData.HelpTopic:{0}", base.SelectionData.HelpTopic);
            }
            else
            {
                ExTraceGlobals.DataFlowTracer.Information(0L, "ExchangeFormView.SelectionChanged: clearing selection.");
                base.SelectionData.Clear();
                base.SelectionData.HelpTopic = base.ScopeNode.HelpTopic;
            }
            ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeFormView>(0L, "<--ExchangeFormView.SelectionChanged: {0}", this);
        }
Example #7
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);
 }
        /// <summary>
        /// Manage shortcut menu for selection
        /// </summary>
        /// <param name="status">asynchronous status for updating the console</param>
        protected override void OnSelectionChanged(SyncStatus status)
        {
            if (this.SelectedNodes.Count == 0)
            {
                this.SelectionData.Clear();
            }
            else
            {
                //// store dragged name
                WritableSharedData     writableSharedData     = new WritableSharedData();
                WritableSharedDataItem writableSharedDataItem = new WritableSharedDataItem("DisplayName", false);
                writableSharedDataItem.SetData(Encoding.Unicode.GetBytes(this.SelectedNodes[0].Tag + "\0"));
                writableSharedData.Add(writableSharedDataItem);

                // update context
                this.SelectionData.Update(null, this.SelectedNodes.Count > 1, null, writableSharedData);
                this.SelectionData.EnabledStandardVerbs = StandardVerbs.Copy | StandardVerbs.Paste | StandardVerbs.Refresh;

                //Set SetAllowedClipboardFormatIdsForPaste so that ListView only accepts clipboard objects that support "DisplayName" clipboard format
                this.SelectionData.SetAllowedClipboardFormatIdsForPaste(new string[] { "DisplayName" });
            }
        }
        /// <summary>
        /// Manage shortcut menu for selection  
        /// </summary>
        /// <param name="status">asynchronous status for updating the console</param>
        protected override void OnSelectionChanged(SyncStatus status)
        {
            if (this.SelectedNodes.Count == 0)
            {
                this.SelectionData.Clear();
            }
            else
            {
                //// store dragged name
                WritableSharedData writableSharedData = new WritableSharedData();
                WritableSharedDataItem writableSharedDataItem = new WritableSharedDataItem("DisplayName", false);
                writableSharedDataItem.SetData(Encoding.Unicode.GetBytes(this.SelectedNodes[0].Tag + "\0"));
                writableSharedData.Add(writableSharedDataItem);

                // update context
                this.SelectionData.Update(null, this.SelectedNodes.Count > 1, null, writableSharedData);
                this.SelectionData.EnabledStandardVerbs = StandardVerbs.Copy | StandardVerbs.Paste | StandardVerbs.Refresh;

                //Set SetAllowedClipboardFormatIdsForPaste so that ListView only accepts clipboard objects that support "DisplayName" clipboard format
                this.SelectionData.SetAllowedClipboardFormatIdsForPaste(new string[] { "DisplayName" });
            }
        }