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);
        }
        /// <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>
 /// UsersFormView Constructor
 /// </summary>
 public UsersFormView()
 {
     _sharedUserData = new WritableSharedData();
     _deletemmc.MakeTransparent();
 }
示例#4
0
 /// <summary>
 /// UsersFormView Constructor
 /// </summary>
 public UsersFormView()
 {
     _sharedUserData = new WritableSharedData();
 }
        /// <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" });
            }
        }
示例#6
0
 public UsersMMCListView()
 {
     _sharedUserData = new WritableSharedData();
 }