public void Update(IActionContext context, ref ActionPresentation presentation) { if (context.SelectedResources.Count == 0 || ResourceTypeHelper.AnyResourcesInternal(context.SelectedResources)) { if (context.Kind == ActionContextKind.MainMenu) { presentation.Enabled = false; } else { presentation.Visible = false; } return; } bool anyHasFlag = false; for (int i = 0; i < context.SelectedResources.Count; i++) { if (context.SelectedResources[i].HasProp("Flag")) { anyHasFlag = true; break; } } presentation.Enabled = anyHasFlag; }
public IMConversationsManager(string resType, string resourceTypeDisplayName, string displayNameMask, TimeSpan period, int propAccountLink, int propFromAccount, int propToAccount, IPlugin ownerPlugin) { _store = Core.ResourceStore; _propDate = _store.PropTypes.Register("Date", PropDataType.Date); _propStartDate = ResourceTypeHelper.UpdatePropTypeRegistration("StartDate", PropDataType.Date, PropTypeFlags.Normal); _store.PropTypes.RegisterDisplayName(_propStartDate, "Start Date"); _propFrom = ResourceTypeHelper.UpdatePropTypeRegistration("From", PropDataType.Link, PropTypeFlags.DirectedLink); _propTo = ResourceTypeHelper.UpdatePropTypeRegistration("To", PropDataType.Link, PropTypeFlags.DirectedLink); _propConversationList = ResourceTypeHelper.UpdatePropTypeRegistration("ConversationList", PropDataType.StringList, PropTypeFlags.Internal); _propSubject = _store.PropTypes.Register("Subject", PropDataType.String); _propMySelf = _store.PropTypes.Register("MySelf", PropDataType.Int, PropTypeFlags.Internal); _conversationResType = resType; _store.ResourceTypes.Register(resType, resourceTypeDisplayName, displayNameMask, ResourceTypeFlags.Normal, ownerPlugin); Core.FilterEngine.RegisterRuleApplicableResourceType(resType); _store.RegisterLinkRestriction(resType, _propFrom, null, 1, 1); _store.RegisterLinkRestriction(resType, _propTo, null, 1, 1); _store.RegisterLinkRestriction(resType, propFromAccount, null, 1, 1); _store.RegisterLinkRestriction(resType, propToAccount, null, 1, 1); Core.MessageFormatter.RegisterPreviewTextProvider(resType, new ConversationPreviewBuilder(this)); _period = period; _reverseMode = false; _propAccountLink = propAccountLink; _propFromAccount = propFromAccount; _propToAccount = propToAccount; }
//--------------------------------------------------------------------- // Show only those address books which have their "responsible" // plugins loaded. //--------------------------------------------------------------------- private void LoadAddressBooks() { _addressBooks = Core.ResourceStore.EmptyResourceList; IResourceList abList = Core.ResourceStore.GetAllResourcesLive("AddressBook"); foreach (IResource ab in abList) { string ownerType = ab.GetStringProp(Core.Props.ContentType); if (ResourceTypeHelper.IsResourceTypeActive(ownerType)) { _addressBooks = _addressBooks.Union(ab.ToResourceList()); } } _addressBooks.Sort(new SortSettings(Core.Props.Name, false)); lock ( _addressBooks ) { foreach (IResource res in _addressBooks) { _cmbCategory.Items.Add(res); } } _addressBooks.ResourceAdded += _addressBooks_ResourceAdded; _addressBooks.ResourceDeleting += _addressBooks_ResourceDeleted; }
public void ResourceNodeSelected(IResource res) { bool categoryListRecursive = res.HasProp(_categoryManager.PropShowContentsRecursively); if (res != _lastCategory || categoryListRecursive != _lastCategoryListRecursive) { _lastCategory = res; _lastCategoryListRecursive = categoryListRecursive; if (_lastCategoryListRecursive) { _lastCategoryList = BuildRecursiveContentsList(res); } else { _lastCategoryList = res.GetLinksOfTypeLive(null, _categoryManager.PropCategory); } _lastCategoryList = ResourceTypeHelper.ExcludeUnloadedPluginResources(_lastCategoryList); _lastCategoryList.Sort(new SortSettings(Core.Props.Date, true)); } ResourceListDisplayOptions options = new ResourceListDisplayOptions(); options.Caption = "Resources in category " + res.DisplayName; if (_lastCategoryListRecursive) { options.Caption += " and subcategories"; } options.SeeAlsoBar = true; Core.ResourceBrowser.DisplayConfigurableResourceList(res, _lastCategoryList, options); }
private void RegisterTypes() { IResourceStore store = Core.ResourceStore; _propICQAcct = ResourceTypeHelper.UpdatePropTypeRegistration("ICQAcct", PropDataType.Link, PropTypeFlags.ContactAccount); store.PropTypes.RegisterDisplayName(_propICQAcct, "ICQ UIN"); _propUIN = store.PropTypes.Register("UIN", PropDataType.Int); _propNickName = store.PropTypes.Register("NickName", PropDataType.String); IResource contactRes = store.FindUniqueResource("ResourceType", "Name", "Contact"); string contactDisplayNameMask = contactRes.GetPropText("DisplayNameMask"); if (contactDisplayNameMask.IndexOf("ICQAcct") < 0) { contactRes.SetProp("DisplayNameMask", contactDisplayNameMask + " | ICQAcct"); } store.ResourceTypes.Register(_icqAccountResName, "ICQ Account", "NickName UIN", ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex, this); store.ResourceTypes.Register(_icqConversationResName, "ICQ Conversation", "Subject", ResourceTypeFlags.Normal, this); _propFromICQ = ResourceTypeHelper.UpdatePropTypeRegistration("FromICQ", PropDataType.Link, PropTypeFlags.Internal); _propToICQ = ResourceTypeHelper.UpdatePropTypeRegistration("ToICQ", PropDataType.Link, PropTypeFlags.Internal); IDisplayColumnManager colManager = Core.DisplayColumnManager; colManager.RegisterDisplayColumn(_icqConversationResName, 0, new ColumnDescriptor("From", 120)); colManager.RegisterDisplayColumn(_icqConversationResName, 1, new ColumnDescriptor("To", 120)); colManager.RegisterDisplayColumn(_icqConversationResName, 2, new ColumnDescriptor(new[] { "Subject" }, 300, ColumnDescriptorFlags.AutoSize)); colManager.RegisterDisplayColumn(_icqConversationResName, 3, new ColumnDescriptor("Date", 120)); Core.PluginLoader.RegisterResourceDeleter(_icqConversationResName, new ICQConversationDeleter()); }
public void Execute(IActionContext context) { if (context.SelectedResources.Count == 0) { return; } Core.UIManager.BeginUpdateSidebar(); Core.TabManager.CurrentTabId = Core.TabManager.Tabs [0].Id; Core.UIManager.EndUpdateSidebar(); IResource mailAccount = context.SelectedResources[0]; IResourceList resourceList = mailAccount.GetLinksOfTypeLive(null, Core.ContactManager.Props.LinkEmailAcctFrom); IResourceList resourceListTo = mailAccount.GetLinksOfTypeLive(null, Core.ContactManager.Props.LinkEmailAcctTo); IResourceList resourceListCC = mailAccount.GetLinksOfTypeLive(null, Core.ContactManager.Props.LinkEmailAcctCC); resourceList = resourceList.Union(resourceListTo); resourceList = resourceList.Union(resourceListCC); ResourceTypeHelper.ExcludeUnloadedPluginResources(resourceList); ResourceListDisplayOptions options = new ResourceListDisplayOptions(); options.Caption = "Messages for " + mailAccount.DisplayName; options.SetTransientContainer(Core.ResourceTreeManager.ResourceTreeRoot, StandardViewPanes.ViewsCategories); Core.ResourceBrowser.DisplayResourceList(null, resourceList, options); }
public async void CreateMarkSession_NotMarkedResources_ReturnsMarkSessionModel() { // Arrange var resourceType = ResourceTypeEnum.Metadata; var resourceId = "45db3205-83be-42a1-af14-6a03df9d9536"; var projectId = "73fcb3bf-bc8b-4c8b-801f-8a90d92bf9c2"; var markSessionType = MarkingServiceClient.MarkSessionTypeToBeDeleted; var httpService = new HttpService(new HttpClient()); var markingServiceClient = new MarkingServiceClient(httpService); // Act var result = await markingServiceClient.CreateMarkSession( resourceType, resourceId, projectId, markSessionType ); // Assert // Verify that the mark session is created Assert.NotNull(result); var metadata = await ResourceTypeHelper.RetreiveMetadata(resourceId); // Verify that the metadata is marked Assert.Equal(MetadataModel.ToBeDeletedState, metadata.State); }
public virtual bool AcceptResource(IResource res) { string deepName = res.GetStringProp("DeepName"); string contentType = res.GetStringProp("ContentType"); string[] appTypes = (contentType == null) ? new string[0] : contentType.Split('|'); //----------------------------------------------------------------- // Type of an accepted resource must be either SearchView or ViewFolder //----------------------------------------------------------------- bool resTypeConforms = res.Type == FilterManagerProps.ViewResName || res.Type == FilterManagerProps.ViewFolderResName; //----------------------------------------------------------------- // Resource types for which a view is defined must be "active", that // is for at least one type its supporting plugin must be loaded. //----------------------------------------------------------------- bool contentTypeConforms = contentType == null; foreach (string type in appTypes) { contentTypeConforms = contentTypeConforms || ResourceTypeHelper.IsBaseResourceTypeActive(type); } bool accept = resTypeConforms && contentTypeConforms && (deepName == null || deepName != Core.FilterRegistry.ViewNameForSearchResults); return(accept && !_removedViews.ContainsKey(res.ToString())); }
public bool AcceptNode(JetListViewNode node) { IResource res = (IResource)node.Data; if (res.Type == FilterManagerProps.ConditionResName || res.Type == FilterManagerProps.ConditionTemplateResName) { return(UnusedConditions.IndexOf(res.Id) >= 0); } else if (res.Type == FilterManagerProps.ConditionGroupResName) { IResourceList condInGroup = res.GetLinksOfType(FilterManagerProps.ConditionResName, Core.Props.Parent).Union (res.GetLinksOfType(FilterManagerProps.ConditionTemplateResName, Core.Props.Parent)); foreach (IResource cond in condInGroup) { string appResType = cond.GetStringProp(Core.Props.ContentType); if (ResourceTypeHelper.IsResourceTypeActive(appResType) && ResTypesIntersect(appResType, UsedResTypes)) { return(true); } } } return(false); }
public override void Update(IActionContext context, ref ActionPresentation presentation) { base.Update(context, ref presentation); if (ResourceTypeHelper.GetCustomProperties().Count == 0) { presentation.Visible = false; } }
private static IResourceList ComputeList(IResource view) { IResourceList list = Core.FilterEngine.ExecView(view, null, SelectionType.Live); list = ResourceTypeHelper.ExcludeUnloadedPluginResources(list); list = list.Minus(Core.ResourceStore.FindResourcesWithProp(null, Core.Props.IsDeleted)); list = list.Intersect(Core.ResourceStore.FindResourcesWithProp(null, Core.Props.IsUnread), true); return(list); }
public IResource ShowNewCategoryDialog(IWin32Window ownerWindow, string defaultName, IResource defaultParent, string defaultContentType) { _edtName.Text = defaultName; RestoreSettings(); _resourceTree.AddNodeFilter(_categoryTypeFilter); _resourceTree.RootResource = Core.ResourceTreeManager.ResourceTreeRoot; _resourceTree.ParentProperty = Core.Props.Parent; _resourceTree.OpenProperty = Core.ResourceStore.GetPropId("CategoryExpanded"); if (defaultParent != null) { _resourceTree.SelectResourceNode(defaultParent); } else { _resourceTree.SelectResourceNode(Core.CategoryManager.RootCategory); } bool foundType = false; _cmbResourceType.Items.Add("All Resources"); foreach (IResource res in ResourceTypeHelper.GetVisibleResourceTypes()) { string resType = res.GetStringProp("Name"); if (resType == "Fragment" || Core.ResourceStore.ResourceTypes [resType].HasFlag(ResourceTypeFlags.FileFormat) || !Core.ResourceStore.ResourceTypes [resType].OwnerPluginLoaded) { continue; } _cmbResourceType.Items.Add(res); if (resType == defaultContentType) { _cmbResourceType.SelectedIndex = _cmbResourceType.Items.Count - 1; foundType = true; } } if (!foundType) { _cmbResourceType.SelectedIndex = 0; } UpdateButtonState(); if (ShowDialog(ownerWindow) == DialogResult.OK) { Core.ResourceAP.RunJob(new MethodInvoker(DoCreateCategory)); } else { Core.ResourceAP.QueueJob(new MethodInvoker(CategoryManager.DeleteUnusedCategoryRoots)); } return(_newCategoryResource); }
private string ResourcePath <TResource>() where TResource : class { return(_cache.GetOrAdd($"_xml_{typeof(TResource).FullName}", _ => { string typeName = ResourceTypeHelper.CreateResourceName(typeof(TResource), _options.ResourcesPath); return $".\\{_options.ResourcesPath}\\{typeName}.{{0}}.xml"; })); }
private void SaveBtn_Click(object sender, EventArgs e) { ResourceType resourceType = new ResourceType(); ResourceTypeHelper hlp = new ResourceTypeHelper(); Result <ResourceType> res = new Result <ResourceType>(); resourceType.Name = NameText.Text; resourceType.Code = CodeText.Text; res = hlp.Create(resourceType); }
private ResourceManager ResourceManager <TResource>() where TResource : class { return(_cache.GetOrAdd($"_resMan_{typeof(TResource).FullName}", _ => { // Create a fully qualified resource name var typeName = ResourceTypeHelper.CreateCompiledResourceName(typeof(TResource), _options.ResourcesPath); return new ResourceManager($"{typeName}", typeof(TResource).Assembly); })); }
public static void RegisterResources() { Core.ResourceStore.ResourceTypes.Register("DebugOption", string.Empty, ResourceTypeFlags.NoIndex | ResourceTypeFlags.Internal); IntDebugSetting = ResourceTypeHelper.UpdatePropTypeRegistration("IntDbgSetting", PropDataType.Int, PropTypeFlags.Internal); BoolDebugSetting = ResourceTypeHelper.UpdatePropTypeRegistration("BoolDbgSetting", PropDataType.Bool, PropTypeFlags.Internal); StringDebugSetting = ResourceTypeHelper.UpdatePropTypeRegistration("StringDbgSetting", PropDataType.String, PropTypeFlags.Internal); StringDebugSettingDef = ResourceTypeHelper.UpdatePropTypeRegistration("StringDbgSettingDef", PropDataType.String, PropTypeFlags.Internal); IntComboDebugSetting = ResourceTypeHelper.UpdatePropTypeRegistration("IntComboDbgSetting", PropDataType.Int, PropTypeFlags.Internal); IntRadioDebugSetting = ResourceTypeHelper.UpdatePropTypeRegistration("IntRadioDbgSetting", PropDataType.Int, PropTypeFlags.Internal); RecreateOptionsImpl(); }
/// <summary> /// Initializes a new instance of the <see cref="AuthenticationClient"/> class using the specified <see cref="HttpClient"/>. /// </summary> /// <param name="apiClientConfiguration"> /// The client configuration. If <c>null</c>, the library will attempt to load /// configuration from an <c>okta.yaml</c> file or environment variables. /// </param> /// <param name="httpClient">The HTTP client to use for requests to the Okta API.</param> /// <param name="logger">The logging interface to use, if any.</param> public AuthenticationClient( OktaClientConfiguration apiClientConfiguration = null, HttpClient httpClient = null, ILogger logger = null) : base( apiClientConfiguration, httpClient, logger, new UserAgentBuilder("okta-auth-dotnet", typeof(AuthenticationClient).GetTypeInfo().Assembly.GetName().Version), new AbstractResourceTypeResolverFactory(ResourceTypeHelper.GetAllDefinedTypes(typeof(Resource)))) { }
private static IResourceList FilterOutRulesByLoadedPluginType(IResourceList allRules) { IResourceList result = Core.ResourceStore.EmptyResourceList; foreach (IResource rule in allRules) { string type = rule.GetStringProp(Core.Props.ContentType); if (!ResourceTypeHelper.IsResourceTypePassive(type)) { result = result.Union(rule.ToResourceList()); } } return(result); }
/** * Shows the custom properties for the specified resource. */ private void ShowCustomPropertiesForResource(IResource res, ref int curX, ref int curY) { foreach (IResource propTypeRes in ResourceTypeHelper.GetCustomProperties()) { int propID = propTypeRes.GetIntProp("ID"); if (res.HasProp(propID)) { AddLinkTypeLabel(ref curX, ref curY, Core.ResourceStore.PropTypes.GetPropDisplayName(propID)); string propText = GetCustomPropText(res, propID); AddRegularLabel(new Rectangle(_linkLabelX, curY, Width - _linkLabelX, 16), propText); curY += 16; } } }
public void Update(IActionContext context, ref ActionPresentation presentation) { if (context.SelectedResources.Count == 0 || ResourceTypeHelper.AnyResourcesInternal(context.SelectedResources)) { if (context.Kind == ActionContextKind.MainMenu) { presentation.Enabled = false; } else { presentation.Visible = false; } } }
private string ResourcePath <TResource>() where TResource : class { return(_cache.GetOrAdd($"_xml_{typeof(TResource).FullName}", _ => { if (!Directory.Exists(_options.ResourcesPath)) { Directory.CreateDirectory(_options.ResourcesPath); } string typeName = ResourceTypeHelper.CreateResourceName(typeof(TResource), _options.ResourcesPath); return $"{_options.ResourcesPath}{Path.DirectorySeparatorChar}{typeName}.{{0}}.xml"; })); }
/// <summary> /// Create a new IStringLocalizer using the given type name /// </summary> /// <param name="baseName"></param> /// <param name="location"></param> /// <returns></returns> public IStringLocalizer Create(string baseName, string location) { if (baseName == null) { throw new ArgumentNullException(nameof(baseName)); } if (location == null) { throw new ArgumentNullException(nameof(location)); } var type = ResourceTypeHelper.GetResourceType(baseName, location); return(Create(type)); }
/// <summary> /// Create a new instance of <see cref="ResxWriter"/> /// </summary> /// <param name="type"></param> /// <param name="location"></param> /// <param name="culture"></param> /// <param name="loggerFactory"></param> public ResxWriter(Type type, string location, string culture, ILoggerFactory loggerFactory) { _logger = loggerFactory.CreateLogger <ResxWriter>(); string resFileName = ResourceTypeHelper.CreateResourceName(type, location); ResourceFilePath = Path.Combine(location, $"{resFileName}.{culture}.resx"); if (!File.Exists(ResourceFilePath)) { CreateNewResxFile(); } _xd = XDocument.Load(ResourceFilePath); _logger.LogInformation($"Resource file loaded: '{ResourceFilePath}'"); }
internal void RegisterFormatters() { _columnManager.RegisterPropertyToTextCallback(Core.Props.Date, DateToString); _columnManager.RegisterPropertyToTextCallback(Core.Props.Size, SizeString); _customProperties = ResourceTypeHelper.GetCustomProperties(); foreach (IResource res in _customProperties) { int propTypeID = res.GetIntProp("ID"); IPropType propType = Core.ResourceStore.PropTypes [propTypeID]; if (propType.DataType == PropDataType.Bool) { _columnManager.RegisterPropertyToTextCallback(propTypeID, BoolPropToString); } } _customProperties.ResourceAdded += OnCustomPropertyAdded; }
/** * Registering FileTypeMap resource types */ public FileResourceManager() { _store = Core.ResourceStore; _store.ResourceTypes.Register("FileTypeMap", "FileTypeMap", string.Empty, ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex); _propExtension = _store.PropTypes.Register("Extension", PropDataType.String, PropTypeFlags.Internal); _propResType = _store.PropTypes.Register("ResType", PropDataType.String, PropTypeFlags.Internal); _propLastModified = _store.PropTypes.Register("LastModified", PropDataType.Date, PropTypeFlags.Internal); _propCharset = _store.PropTypes.Register("Charset", PropDataType.String, PropTypeFlags.Internal); _propSource = ResourceTypeHelper.UpdatePropTypeRegistration("Source", PropDataType.Link, PropTypeFlags.Internal | PropTypeFlags.SourceLink); _propFileType = _store.PropTypes.Register("FileType", PropDataType.String); _store.PropTypes.RegisterDisplayName(_propFileType, "File Type"); _store.RegisterUniqueRestriction("FileTypeMap", _propExtension); _store.RegisterUniqueRestriction("FileTypeMap", Core.Props.ContentType); _store.RegisterDisplayNameProvider(new SourceDisplayNameProvider()); }
public static void Deep2Display(string deepName, out string shortName, out string fullName) { string[] resTypes, formats, linkTypes; ResourceTypeHelper.ExtractFields(deepName, out formats, out resTypes, out linkTypes); fullName = shortName = ""; if (resTypes.Length > 0) { foreach (string str in resTypes) { fullName += ResourceTypeHelper.ResTypeDisplayName(str) + ", "; shortName += ResourceTypeHelper.ResTypeDisplayName(str) + ", "; } fullName = fullName.Substring(0, fullName.Length - 2); shortName = shortName.Substring(0, shortName.Length - 2); } if (resTypes.Length > 0 && linkTypes.Length > 0) { shortName += " and "; fullName += " and "; } if (linkTypes.Length > 0) { foreach (string str in linkTypes) { fullName += ResourceTypeHelper.LinkTypeReversedDisplayName(str) + ", "; shortName += ResourceTypeHelper.LinkTypeReversedDisplayName(str) + ", "; } fullName = fullName.Substring(0, fullName.Length - 2); shortName = shortName.Substring(0, shortName.Length - 2); } if (formats.Length == 0 && linkTypes.Length > 0) { fullName += " within all formats"; } else if (formats.Length > 0) { fullName += " within "; foreach (string str in formats) { fullName += str + ", "; } fullName = fullName.Substring(0, fullName.Length - 2); } }
/// <summary> /// Export xml data to resx /// </summary> /// <param name="type"></param> /// <param name="culture"></param> /// <param name="approvedOnly"></param> /// <param name="overwriteExistingKeys"></param> /// <returns></returns> public async Task <int> ExportToResxAsync(Type type, string culture, bool approvedOnly, bool overwriteExistingKeys) { string resFileName = ResourceTypeHelper.CreateResourceName(type, _options.ResourcesPath); var filePath = Path.Combine(_options.ResourcesPath, $"{resFileName}.{culture}"); var xmlFilePath = $"{filePath}.xml"; var resxFilePath = $"{filePath}.resx"; var _xd = XDocument.Load(xmlFilePath); var elements = approvedOnly ? _xd.Root.Descendants("data") .Where(x => x.Attribute("isActive").Value == "true") .Select(x => new ResxElement { Key = x.Element("key")?.Value, Value = x.Element("value")?.Value, Comment = x.Element("comment")?.Value }) : _xd.Root.Descendants("data") .Select(x => new ResxElement { Key = x.Element("key")?.Value, Value = x.Element("value")?.Value, Comment = x.Element("comment")?.Value }); var resxWriter = new ResxWriter(resxFilePath, _loggerFactory); var totalExported = await resxWriter.AddRangeAsync(elements.Where(x => x.Key != null && x.Value != null), overwriteExistingKeys); if (totalExported > 0) { var saved = await resxWriter.SaveAsync(); if (saved) { _logger.LogInformation($"Total '{totalExported}' resources exported to '{resxFilePath}'"); } else { _logger.LogError($"Exported not successful to '{resxFilePath}'"); } } return(totalExported); }
private void OnResourceSaved(object sender, ResourcePropEventArgs e) { IResourceList resList = _resourceList; if (resList != null && resList.Count == 1 && e.Resource.Id == resList.ResourceIds [0]) { int[] changedPropIDs = e.ChangeSet.GetChangedProperties(); for (int i = 0; i < changedPropIDs.Length; i++) { int propId = changedPropIDs [i]; if (Core.ResourceStore.PropTypes [propId].DataType == PropDataType.Link || ResourceTypeHelper.IsCustomPropType(propId)) { Core.UIManager.QueueUIJob(new MethodInvoker(UpdateLinksPane)); break; } } } }
private void RegisterTypes() { IResourceStore store = Core.ResourceStore; _propDescription = store.PropTypes.Register("Description", PropDataType.String); store.ResourceTypes.Register("Task", "Task", "Subject", ResourceTypeFlags.ResourceContainer, this); _propStatus = store.PropTypes.Register("Status", PropDataType.Int); _propPriority = store.PropTypes.Register("Priority", PropDataType.Int); _propRemindDate = ResourceTypeHelper.UpdatePropTypeRegistration("RemindDate", PropDataType.Date, PropTypeFlags.AskSerialize); _propStartDate = ResourceTypeHelper.UpdatePropTypeRegistration("StartDate", PropDataType.Date, PropTypeFlags.Normal); store.PropTypes.RegisterDisplayName(_propStartDate, "Start Date"); _propCompletedDate = store.PropTypes.Register("CompletedDate", PropDataType.Date); store.PropTypes[_propCompletedDate].Flags = store.PropTypes[_propCompletedDate].Flags & ~PropTypeFlags.Internal; _propIsRoot = store.PropTypes.Register("IsRoot", PropDataType.Int, PropTypeFlags.Internal); _linkTarget = ResourceTypeHelper.UpdatePropTypeRegistration("Target", PropDataType.Link, PropTypeFlags.DirectedLink); _linkSuperTask = ResourceTypeHelper.UpdatePropTypeRegistration("SuperTask", PropDataType.Link, PropTypeFlags.DirectedLink | PropTypeFlags.Internal); _propRemindWorkspace = ResourceTypeHelper.UpdatePropTypeRegistration("RemindWorkspace", PropDataType.Link, PropTypeFlags.Internal); /** * delete obsolete properties */ if (store.PropTypes.Exist("ReminderActive")) { IResourceList tasks = store.GetAllResources("Task"); foreach (IResource task in tasks) { if (task.HasProp("ReminderActive") && task.GetIntProp("ReminderActive") == 0) { task.DeleteProp(_propRemindDate); } } store.PropTypes.Delete(store.PropTypes["ReminderActive"].Id); } if (store.PropTypes.Exist("WorkspaceActivationReminder")) { store.PropTypes.Delete(store.PropTypes["WorkspaceActivationReminder"].Id); } store.PropTypes.RegisterDisplayName(_propCompletedDate, "Completed"); store.PropTypes.RegisterDisplayName(_linkTarget, "Task", "Resources"); }
/** * Registers the resource and property types related to categories. */ public CategoryManager(IResourceStore store, IResourceTreeManager resourceTreeManager) { _store = store; _resourceTreeManager = resourceTreeManager; _store.ResourceTypes.Register("Category", "Category", "Name", ResourceTypeFlags.ResourceContainer | ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex); _store.ResourceTypes.Register("ResourceTreeRoot", "ResourceTreeRoot", "", ResourceTypeFlags.Internal | ResourceTypeFlags.NoIndex); _propCategory = ResourceTypeHelper.UpdatePropTypeRegistration("Category", PropDataType.Link, PropTypeFlags.CountUnread); _propCategoryExpanded = _store.PropTypes.Register("CategoryExpanded", PropDataType.Int, PropTypeFlags.Internal); _propCategoryExpandedInSelector = _store.PropTypes.Register("CategoryExpandedInSelector", PropDataType.Int, PropTypeFlags.Internal); _propShowContentsRecursively = _store.PropTypes.Register("ShowContentsRecursively", PropDataType.Bool, PropTypeFlags.Internal); UpdateCategoryRoot(); if (_store.ResourceTypes.Exist("CategoryIntersection")) { _store.GetAllResources("CategoryIntersection").DeleteAll(); _store.ResourceTypes.Delete("CategoryIntersection"); } }