public void Register() { CategoryAttribute category = new CategoryAttribute(Resources.DropboxActivitiesCategory); AttributeTableBuilder builder = new AttributeTableBuilder(); ShowPropertyInOutlineViewAttribute hideFromOutlineAttribute = new ShowPropertyInOutlineViewAttribute() { CurrentPropertyVisible = false, DuplicatedChildNodesVisible = false }; builder.AddCustomAttributes(typeof(WithDropboxSession), nameof(WithDropboxSession.Body), hideFromOutlineAttribute); builder.AddCustomAttributes(typeof(Copy), category); builder.AddCustomAttributes(typeof(CreateFile), category); builder.AddCustomAttributes(typeof(CreateFolder), category); builder.AddCustomAttributes(typeof(Delete), category); builder.AddCustomAttributes(typeof(DownloadFile), category); builder.AddCustomAttributes(typeof(DownloadFolderAsZip), category); builder.AddCustomAttributes(typeof(GetFolderContent), category); builder.AddCustomAttributes(typeof(Move), category); builder.AddCustomAttributes(typeof(UploadFile), category); builder.AddCustomAttributes(typeof(WithDropboxSession), category); MetadataStore.AddAttributeTable(builder.CreateTable()); }
internal static void AddModelItemCollection(TreeViewItemViewModel parent, ModelItemCollection collection, ModelProperty trackingProperty) { parent.GetTracker(trackingProperty).AddCollection(collection); bool duplicatedNodeVisible = true; string childNodePrefix = string.Empty; ShowPropertyInOutlineViewAttribute viewChild = ExtensibilityAccessor.GetAttribute <ShowPropertyInOutlineViewAttribute>(trackingProperty); if (viewChild != null) { duplicatedNodeVisible = viewChild.DuplicatedChildNodesVisible; childNodePrefix = viewChild.ChildNodePrefix; } foreach (ModelItem item in collection) { AddChild(parent, item, item, duplicatedNodeVisible, childNodePrefix, trackingProperty); } }
internal static void AddModelItemDictionary(TreeViewItemViewModel parent, ModelItemDictionary dictionary, ModelProperty trackingProperty) { parent.GetTracker(trackingProperty).AddCollection(dictionary); bool duplicatedNodeVisible = true; string childNodePrefix = string.Empty; ShowPropertyInOutlineViewAttribute viewChild = ExtensibilityAccessor.GetAttribute <ShowPropertyInOutlineViewAttribute>(trackingProperty); if (viewChild != null) { duplicatedNodeVisible = viewChild.DuplicatedChildNodesVisible; childNodePrefix = viewChild.ChildNodePrefix; } foreach (var pair in dictionary) { ModelItem item = null; //AddChild(parent, pair.Value, pair, duplicatedNodeVisible, trackingProperty); AddChild(parent, item, pair, duplicatedNodeVisible, childNodePrefix, trackingProperty); } }
public void Register() { AttributeTableBuilder builder = new AttributeTableBuilder(); ShowPropertyInOutlineViewAttribute hideFromOutlineAttribute = new ShowPropertyInOutlineViewAttribute() { CurrentPropertyVisible = false, DuplicatedChildNodesVisible = false }; builder.AddCustomAttributes(typeof(WithFtpSession), new DesignerAttribute(typeof(WithFtpSessionDesigner))); builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.Body), hideFromOutlineAttribute); builder.AddCustomAttributes(typeof(Delete), new CategoryAttribute(Resources.FTPActivitiesCategory)); builder.AddCustomAttributes(typeof(DirectoryExists), new CategoryAttribute(Resources.FTPActivitiesCategory)); builder.AddCustomAttributes(typeof(DownloadFiles), new CategoryAttribute(Resources.FTPActivitiesCategory)); builder.AddCustomAttributes(typeof(EnumerateObjects), new CategoryAttribute(Resources.FTPActivitiesCategory)); builder.AddCustomAttributes(typeof(FileExists), new CategoryAttribute(Resources.FTPActivitiesCategory)); builder.AddCustomAttributes(typeof(UploadFiles), new CategoryAttribute(Resources.FTPActivitiesCategory)); builder.AddCustomAttributes(typeof(WithFtpSession), new CategoryAttribute(Resources.FTPActivitiesCategory)); MetadataStore.AddAttributeTable(builder.CreateTable()); }
public void Register() { AttributeTableBuilder builder = new AttributeTableBuilder(); ShowPropertyInOutlineViewAttribute hideFromOutlineAttribute = new ShowPropertyInOutlineViewAttribute() { CurrentPropertyVisible = false, DuplicatedChildNodesVisible = false }; builder.AddCustomAttributes(typeof(WithFtpSession), new DesignerAttribute(typeof(WithFtpSessionDesigner))); builder.AddCustomAttributes(typeof(MoveItem), new DesignerAttribute(typeof(MoveItemsDesigner))); builder.AddCustomAttributes(typeof(DownloadFiles), new DesignerAttribute(typeof(DownloadFilesDesigner))); builder.AddCustomAttributes(typeof(UploadFiles), new DesignerAttribute(typeof(UploadFilesDesigner))); builder.AddCustomAttributes(typeof(Delete), new DesignerAttribute(typeof(DeleteDesigner))); builder.AddCustomAttributes(typeof(DirectoryExists), new DesignerAttribute(typeof(DirectoryExistsDesigner))); builder.AddCustomAttributes(typeof(EnumerateObjects), new DesignerAttribute(typeof(EnumerateObjectsDesigner))); builder.AddCustomAttributes(typeof(FileExists), new DesignerAttribute(typeof(FileExistsDesigner))); builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.Body), hideFromOutlineAttribute); // Category CategoryAttribute FTPCategoryAttribute = new CategoryAttribute($"{Resources.CategoryAppIntegration}.{Resources.CategoryFTP}"); builder.AddCustomAttributes(typeof(Delete), FTPCategoryAttribute); builder.AddCustomAttributes(typeof(DirectoryExists), FTPCategoryAttribute); builder.AddCustomAttributes(typeof(DownloadFiles), FTPCategoryAttribute); builder.AddCustomAttributes(typeof(EnumerateObjects), FTPCategoryAttribute); builder.AddCustomAttributes(typeof(FileExists), FTPCategoryAttribute); builder.AddCustomAttributes(typeof(MoveItem), FTPCategoryAttribute); builder.AddCustomAttributes(typeof(UploadFiles), FTPCategoryAttribute); builder.AddCustomAttributes(typeof(WithFtpSession), FTPCategoryAttribute); // Activities DisplayName builder.AddCustomAttributes(typeof(Delete), new DisplayNameAttribute(SharedResources.Activity_Delete_Name)); builder.AddCustomAttributes(typeof(DirectoryExists), new DisplayNameAttribute(SharedResources.Activity_DirectoryExists_Name)); builder.AddCustomAttributes(typeof(DownloadFiles), new DisplayNameAttribute(SharedResources.Activity_DownloadFiles_Name)); builder.AddCustomAttributes(typeof(EnumerateObjects), new DisplayNameAttribute(SharedResources.Activity_EnumerateObjects_Name)); builder.AddCustomAttributes(typeof(FileExists), new DisplayNameAttribute(SharedResources.Activity_FileExists_Name)); builder.AddCustomAttributes(typeof(MoveItem), new DisplayNameAttribute(SharedResources.Activity_MoveItem_Name)); builder.AddCustomAttributes(typeof(UploadFiles), new DisplayNameAttribute(SharedResources.Activity_UploadFiles_Name)); builder.AddCustomAttributes(typeof(WithFtpSession), new DisplayNameAttribute(SharedResources.Activity_WithFtpSession_Name)); // Properties and Descriptions var ContinueOnError = new DisplayNameAttribute(SharedResources.ContinueOnError); var UsernameDescription = new DescriptionAttribute(SharedResources.UsernameDescription); var PasswordDescription = new DescriptionAttribute(SharedResources.PasswordDescription); var ClientCertificatePasswordDescription = new DescriptionAttribute(SharedResources.ClientCertificatePasswordDescription); var HostDescription = new DescriptionAttribute(SharedResources.HostDescription); var PortDescription = new DescriptionAttribute(SharedResources.PortDescription); var RemotePathDescription = new DescriptionAttribute(SharedResources.RemotePathDescription); var DirectoryExistsDescription = new DescriptionAttribute(SharedResources.DirectoryExistsDescription); var FileExistsDescription = new DescriptionAttribute(SharedResources.FileExistsDescription); var FilesDescription = new DescriptionAttribute(SharedResources.FilesDescription); var MoveItemNewPathDescription = new DescriptionAttribute(SharedResources.NewPathDescription); var LocalPathDescription = new DescriptionAttribute(SharedResources.LocalPathDescription); //Delete properties builder.AddCustomAttributes(typeof(Delete), nameof(Delete.ContinueOnError), ContinueOnError); builder.AddCustomAttributes(typeof(Delete), nameof(Delete.RemotePath), RemotePathDescription); //DirectoryExists properties builder.AddCustomAttributes(typeof(DirectoryExists), nameof(DirectoryExists.ContinueOnError), ContinueOnError); builder.AddCustomAttributes(typeof(DirectoryExists), nameof(DirectoryExists.RemotePath), RemotePathDescription); builder.AddCustomAttributes(typeof(DirectoryExists), nameof(DirectoryExists.Exists), DirectoryExistsDescription); //File properties builder.AddCustomAttributes(typeof(FileExists), nameof(FileExists.ContinueOnError), ContinueOnError); builder.AddCustomAttributes(typeof(FileExists), nameof(FileExists.RemotePath), RemotePathDescription); builder.AddCustomAttributes(typeof(FileExists), nameof(FileExists.Exists), FileExistsDescription); //MoveItem properties builder.AddCustomAttributes(typeof(MoveItem), nameof(MoveItem.ContinueOnError), ContinueOnError); builder.AddCustomAttributes(typeof(MoveItem), nameof(MoveItem.RemotePath), RemotePathDescription); builder.AddCustomAttributes(typeof(MoveItem), nameof(MoveItem.NewPath), MoveItemNewPathDescription); //DownloadFiles properties builder.AddCustomAttributes(typeof(DownloadFiles), nameof(DownloadFiles.ContinueOnError), ContinueOnError); builder.AddCustomAttributes(typeof(DownloadFiles), nameof(DownloadFiles.RemotePath), RemotePathDescription); builder.AddCustomAttributes(typeof(DownloadFiles), nameof(DownloadFiles.LocalPath), LocalPathDescription); //EnumerateObjects properties builder.AddCustomAttributes(typeof(EnumerateObjects), nameof(EnumerateObjects.ContinueOnError), ContinueOnError); builder.AddCustomAttributes(typeof(EnumerateObjects), nameof(EnumerateObjects.RemotePath), RemotePathDescription); builder.AddCustomAttributes(typeof(EnumerateObjects), nameof(EnumerateObjects.Files), FilesDescription); //UploadFiles properties builder.AddCustomAttributes(typeof(UploadFiles), nameof(UploadFiles.ContinueOnError), ContinueOnError); builder.AddCustomAttributes(typeof(UploadFiles), nameof(UploadFiles.LocalPath), LocalPathDescription); builder.AddCustomAttributes(typeof(UploadFiles), nameof(UploadFiles.RemotePath), RemotePathDescription); // WithFTPSession properties builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.ContinueOnError), ContinueOnError); builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.Username), UsernameDescription); builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.Password), PasswordDescription); builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.ClientCertificatePassword), ClientCertificatePasswordDescription); builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.Host), HostDescription); builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.Port), PortDescription); builder.AddCustomAttributes(typeof(WithFtpSession), nameof(WithFtpSession.UseAnonymousLogin), new DescriptionAttribute(SharedResources.UseAnonymousLoginDescription)); MetadataStore.AddAttributeTable(builder.CreateTable()); }
internal static void AddModelProperty(TreeViewItemViewModel parent, ModelItem item, ModelProperty trackingProperty, ModelProperty property) { //in the case of multiple attributes, they go in this order //HidePropertyInOutlineViewAttribute //[item.ShowInOutlineViewAttribute.PromotedProperty = property.Name]. Set VisualValue by property and ignore itself. Usage ActivityDelegate, FlowStep. //ShowPropertyInOutlineViewAttribute //ShowPropertyInOutlineViewAsSiblingAttribute //ShowInOutlineViewAttribute ShowPropertyInOutlineViewAttribute viewChild = ExtensibilityAccessor.GetAttribute <ShowPropertyInOutlineViewAttribute>(property); if (ExtensibilityAccessor.GetAttribute <HidePropertyInOutlineViewAttribute>(property) != null) { //ignore return; } else if (IsPromotedProperty(item, property)) { if (property.IsCollection) { ModelItemCollection mc = property.Value as ModelItemCollection; AddModelItemCollection(parent, mc, trackingProperty); } else if (property.IsDictionary) { ModelItemDictionary dictionary = property.Dictionary; AddModelItemDictionary(parent, dictionary, trackingProperty); } else { parent.GetTracker(trackingProperty).Add(item, property); //if property.Value is null, then this would not add any node // Use promoted ModelItem's property to track, so pass null to AddModelItem method. AddModelItem(parent, property.Value, null); } } else if (viewChild != null) { if (viewChild.CurrentPropertyVisible) //property node visible { if (property.Value != null) { TreeViewItemViewModel childModel = TreeViewItemViewModel.CreateViewModel(parent, property); childModel.DuplicatedNodeVisible = viewChild.DuplicatedChildNodesVisible; parent.AddChild(childModel, trackingProperty); } else { //just add the notification tracker without adding the empty child parent.GetTracker(trackingProperty, true).Add(item, trackingProperty); } } else { if (property.IsCollection) { ModelItemCollection mc = property.Value as ModelItemCollection; AddModelItemCollection(parent, mc, trackingProperty); } else if (property.IsDictionary) { ModelItemDictionary dictionary = property.Dictionary; AddModelItemDictionary(parent, dictionary, trackingProperty); } else { if (property.Value != null) { TreeViewItemViewModel childModel = TreeViewItemViewModel.CreateViewModel(parent, property.Value); childModel.DuplicatedNodeVisible = viewChild.DuplicatedChildNodesVisible; parent.AddChild(childModel, trackingProperty); } else { parent.GetTracker(trackingProperty).Add(item, property); } } } } else if (ExtensibilityAccessor.GetAttribute <ShowPropertyInOutlineViewAsSiblingAttribute>(property) != null) { //add notification to the tracker that is responsible for this node ChangeNotificationTracker tracker = parent.Parent.GetTracker(parent); tracker.Add(item, property); TreeViewItemViewModel siblingNode = null; if (property.Value != null) { siblingNode = TreeViewItemViewModel.CreateViewModel(parent.Parent, property.Value); } parent.Parent.AddChild(siblingNode, tracker.ParentProperty); } else if (ExtensibilityAccessor.GetAttribute <ShowInOutlineViewAttribute>(property) != null) { if (property.Value != null) { ShowInOutlineViewAttribute outlineView = ExtensibilityAccessor.GetAttribute <ShowInOutlineViewAttribute>(property); if (string.IsNullOrWhiteSpace(outlineView.PromotedProperty)) { parent.AddChild(TreeViewItemViewModel.CreateViewModel(parent, property), trackingProperty); } else { ModelProperty promotedProperty = property.Value.Properties.Find(outlineView.PromotedProperty); if (promotedProperty == null) { throw FxTrace.Exception.AsError(new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, SR.PromotedPropertyNotFound, outlineView.PromotedProperty, property.Value.Name))); } // Add promoted ModelItem and property into tracker. So when property got changed, the grandparent of promoted ModelItem will be notified. ChangeNotificationTracker tracker = parent.GetTracker(trackingProperty, true); tracker.Add(property.Value, promotedProperty); if (promotedProperty.Value == null) { tracker.Add(item, property); } else { parent.AddChild(TreeViewItemViewModel.CreateViewModel(parent, property), trackingProperty); } } } else { parent.GetTracker(trackingProperty, true).Add(item, property); } } //if the values in the dictionary is viewvisible, note this only works with generic dictionary else if (property.IsDictionary && property.PropertyType.IsGenericType) { Type[] arguments = property.PropertyType.GetGenericArguments(); if (ExtensibilityAccessor.GetAttribute <ShowInOutlineViewAttribute>(arguments[1]) != null) { if (property.Value != null) { parent.AddChild(TreeViewItemViewModel.CreateViewModel(parent, property), trackingProperty); } else { parent.GetTracker(trackingProperty, true).Add(item, property); } } } }