/// <summary> /// Initializes a new instance of the <see cref="SelectOutputFolderControl"/> class. /// </summary> public SelectOutputFolderControl() { // setup folder cache this.folderCache = new FolderCache { RootFolder = "Assets/", Seconds = 2 }; this.ShowAsListCheckBox = true; }
private void SetViewInFolderSource() { var appEnumFolderLst = new List <string>((FolderCache != null ? FolderCache.Count : 0) + AppEnums.ViewBin.Values.Length); appEnumFolderLst.AddRange(AppEnums.ViewBin.Values); FolderCache?.AppendKeyList(appEnumFolderLst); cmbViewInFolder.ItemsSource = appEnumFolderLst; }
public Folder GetFolderById(object id) { var key = "spointd-" + MakeId(id); var folder = FolderCache.Get <Folder>(key); if (folder == null) { folder = GetFolder(id); FolderCache.Insert(key, folder, DateTime.UtcNow.Add(CacheExpiration)); } return(folder); }
public Folder CreateFolder(string id) { Notify.Publish(new SharePointProviderCacheItem { FolderKey = MakeId(GetParentFolderId(id)) }, CacheNotifyAction.Remove); var folder = clientContext.Web.RootFolder.Folders.Add(id); clientContext.Load(folder); clientContext.ExecuteQuery(); FolderCache.Insert("spointd-" + id, folder, DateTime.UtcNow.Add(CacheExpiration)); return(folder); }
// Returns the path to a specified folder relative to a root folder protected string GetRelativeName(Art dbFolder) { if (dbFolder.ID == DbRootItemId) { return(string.Empty); } if (dbFolder.ParentID == DbRootItemId) { return(dbFolder.Name); } if (!FolderCache.ContainsKey(dbFolder.ParentID.Value)) { return(null); } string name = GetRelativeName(FolderCache[dbFolder.ParentID.Value]); return(name == null ? null : Path.Combine(name, dbFolder.Name)); }
public TreePath GetPath(ITabularObject item) { if (item == null) { return(TreePath.Empty); } var stack = new List <object>(); stack.Add(Model); if (item is PartitionViewTable || item is Partition) { stack.Add(Model.Groups.Partitions); if (item is Partition) { stack.Add((item as Partition).Table.PartitionViewTable); } stack.Add(item); return(new TreePath(stack.ToArray())); } if (Options.HasFlag(LogicalTreeOptions.AllObjectTypes) && item != Model) { // If "Show all object types" is enabled, we need to add the "group" of the item to the stack, // to get the complete path. The group can be determined from the type of object: switch (item.ObjectType) { case ObjectType.Culture: stack.Add(Model.Groups.Translations); break; case ObjectType.Role: stack.Add(Model.Groups.Roles); break; case ObjectType.Perspective: stack.Add(Model.Groups.Perspectives); break; case ObjectType.DataSource: stack.Add(Model.Groups.DataSources); break; case ObjectType.Relationship: stack.Add(Model.Groups.Relationships); break; default: // All other object types should appear in the "Tables" group: stack.Add(Model.Groups.Tables); break; } } if (item is Table) { stack.Add(item); } else if (item is ITabularTableObject) { stack.Add((item as ITabularTableObject).Table); var level = item as Level; if (level != null) { item = level.Hierarchy; } if (item is IDetailObject && Options.HasFlag(LogicalTreeOptions.DisplayFolders)) { var dfo = item as IDetailObject; var pathBits = dfo.Table.Name.ConcatPath(dfo.GetDisplayFolder(Culture)).Split('\\'); var folderPath = dfo.Table.Name; for (var i = 1; i < pathBits.Length; i++) { folderPath = folderPath.ConcatPath(pathBits[i]); if (!FolderCache.ContainsKey(folderPath)) { Folder.CreateFolder(dfo.Table, FolderHelper.PathFromFullPath(folderPath)); } stack.Add(FolderCache[folderPath]); } } stack.Add(item); if (level != null) { stack.Add(level); } } return(new TreePath(stack.ToArray())); }
/// <summary> /// Initializes a new instance of the <see cref="SelectOutputFolderControl"/> class. /// </summary> public SelectOutputFolderControl() { // setup folder cache this.folderCache = new FolderCache { RootFolder = "Assets/", Seconds = 2 }; this.ShowAsListCheckBox = true; }