Inheritance: SharedDataItemBase
        /// <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;
        }
示例#3
0
文件: View.cs 项目: SiteView/ECC8.13
 private SharedDataObjectUpdate CreateSharedDataObjectUpdate(WritableSharedDataItem[] addedItems, WritableSharedDataItem[] modifiedItems, WritableSharedDataItem[] removedItems)
 {
     SharedDataObjectUpdate update = new SharedDataObjectUpdate();
     ArrayList dataUpdate = new ArrayList();
     ArrayList formats = new ArrayList();
     ArrayList list3 = new ArrayList();
     this.ParseSharedDataItems(addedItems, formats, dataUpdate);
     update.SetAddedFormats((DataFormatConfiguration[]) formats.ToArray(typeof(DataFormatConfiguration)));
     this.ParseSharedDataItems(modifiedItems, list3, dataUpdate);
     update.SetChangedFormats((DataFormatConfiguration[]) list3.ToArray(typeof(DataFormatConfiguration)));
     update.SetUpdatedData((ClipboardData[]) dataUpdate.ToArray(typeof(ClipboardData)));
     ArrayList list4 = new ArrayList();
     foreach (WritableSharedDataItem item in removedItems)
     {
         list4.Add(item.ClipboardFormatId);
     }
     update.SetRemovedClipboardFormatIds((string[]) list4.ToArray(typeof(string)));
     return update;
 }
示例#4
0
 public void Add(WritableSharedDataItem item)
 {
     if (item == null)
     {
         throw new ArgumentNullException("item");
     }
     Microsoft.ManagementConsole.Internal.Utility.CheckStringNullOrEmpty(item.ClipboardFormatId, "ClipboardFormatId", true);
     string key = item.ClipboardFormatId.ToUpper(CultureInfo.InvariantCulture);
     if (this._dataItems.ContainsKey(key))
     {
         throw new ArgumentException(Microsoft.ManagementConsole.Internal.Utility.LoadResourceString(Microsoft.ManagementConsole.Internal.Strings.AdvancedSharedDataAddFormatError));
     }
     this._dataItems.Add(key, item);
     item.Changed += new WritableSharedDataItem.SharedDataChangedEventHandler(this.OnSharedDataChanged);
     item.PropertyChangeRequested += new WritableSharedDataItem.SharedDataChangeRequestEventHandler(this.OnPropertyChangeRequested);
     if (this.Changed != null)
     {
         this.Changed(this, new WritableSharedDataChangedEventArgs(WritableSharedDataChangeType.Add, item));
     }
 }
示例#5
0
        private void OnSharedDataChanged(object source, WritableSharedDataChangedEventArgs e)
        {
            if (this._view.Shutdown)
            {
                TraceSources.ExecutiveSource.TraceEvent(TraceEventType.Warning, 12, "Ignoring published data changes since view has been shutdown.");
            }
            else
            {
                WritableSharedDataItem[] itemArray = new WritableSharedDataItem[0];
                WritableSharedDataItem[] addedItems = itemArray;
                WritableSharedDataItem[] modifiedItems = itemArray;
                WritableSharedDataItem[] removedItems = itemArray;
                switch (e.ChangeType)
                {
                    case WritableSharedDataChangeType.Add:
                        addedItems = new WritableSharedDataItem[] { e.SharedDataItem };
                        break;

                    case WritableSharedDataChangeType.Remove:
                        removedItems = new WritableSharedDataItem[] { e.SharedDataItem };
                        break;

                    case WritableSharedDataChangeType.Modify:
                        modifiedItems = new WritableSharedDataItem[] { e.SharedDataItem };
                        break;
                }
                if (this._view.Initialized)
                {
                    this._view.OnSharedDataChanged(addedItems, modifiedItems, removedItems);
                }
            }
        }
示例#6
0
 protected virtual void OnSharedDataChangeRequested(WritableSharedDataItem item, byte[] newValue, AsyncStatus status)
 {
 }
示例#7
0
 protected virtual byte[] OnGetSharedData(WritableSharedDataItem item, SyncStatus status)
 {
     return null;
 }
示例#8
0
 internal WritableSharedDataItem[] GetItems()
 {
     WritableSharedDataItem[] array = new WritableSharedDataItem[this._dataItems.Values.Count];
     this._dataItems.Values.CopyTo(array, 0);
     return array;
 }
 internal WritableSharedDataChangeRequestEventArgs(byte[] newValue, IRequestStatus requestStatus, WritableSharedDataItem publishedDataItem)
 {
     this._newValue = newValue;
     this._requestStatus = requestStatus;
     this._publishedDataItem = publishedDataItem;
 }
 internal WritableSharedDataChangedEventArgs(WritableSharedDataChangeType changeType, WritableSharedDataItem publishedDataItem)
 {
     this._changeType = changeType;
     this._publishedDataItem = publishedDataItem;
 }
示例#11
0
文件: View.cs 项目: SiteView/ECC8.13
 private void ParseSharedDataItems(WritableSharedDataItem[] items, ArrayList formats, ArrayList dataUpdate)
 {
     foreach (WritableSharedDataItem item in items)
     {
         DataFormatConfiguration configuration = new DataFormatConfiguration();
         configuration.ClipboardFormatId = item.ClipboardFormatId;
         configuration.RequiresQuery = item.RequiresCallback;
         formats.Add(configuration);
         if (!item.RequiresCallback)
         {
             ClipboardData data = new ClipboardData();
             data.SetValue(item.GetData());
             data.ClipboardFormatId = item.ClipboardFormatId;
             dataUpdate.Add(data);
         }
     }
 }
示例#12
0
文件: View.cs 项目: SiteView/ECC8.13
 internal void OnSharedDataChanged(WritableSharedDataItem[] addedItems, WritableSharedDataItem[] modifiedItems, WritableSharedDataItem[] removedItems)
 {
     ISnapInPlatform snapInPlatform = this.SnapIn.SnapInPlatform;
     if (snapInPlatform == null)
     {
         throw Microsoft.ManagementConsole.Internal.Utility.CreateClassNotInitializedException("SnapIn", "OnSharedDataChanged");
     }
     UpdateViewSharedDataCommand command = new UpdateViewSharedDataCommand();
     command.ViewInstanceId = this.ViewInstanceId;
     command.UpdatedSharedData = this.CreateSharedDataObjectUpdate(addedItems, modifiedItems, removedItems);
     snapInPlatform.ProcessCommand(command);
 }
示例#13
0
文件: View.cs 项目: SiteView/ECC8.13
 internal void OnSelectionContextChanged(int id, SelectionCardinality type, Guid[] uniqueNodeTypes, WritableSharedDataItem[] sharedDataItems)
 {
     ISnapInPlatform snapInPlatform = this.SnapIn.SnapInPlatform;
     if (snapInPlatform == null)
     {
         throw Microsoft.ManagementConsole.Internal.Utility.CreateClassNotInitializedException("SnapIn", "OnSelectionContextChanged");
     }
     SetNewSelectionCommand command = new SetNewSelectionCommand();
     command.ViewInstanceId = this.ViewInstanceId;
     command.Id = id;
     command.SelectionCardinality = type;
     command.UniqueNodeTypes = uniqueNodeTypes;
     command.UpdatedSharedData = this.CreateSharedDataObjectUpdate(sharedDataItems, new WritableSharedDataItem[0], new WritableSharedDataItem[0]);
     snapInPlatform.ProcessCommand(command);
 }
示例#14
0
文件: View.cs 项目: SiteView/ECC8.13
 protected virtual byte[] OnGetSharedData(object selectionObject, WritableSharedDataItem item, SyncStatus status)
 {
     return null;
 }