/// <summary> /// Registers the property. /// </summary> /// <param name="workspaceItemProperty">The workspace item property.</param> /// <returns></returns> public string RegisterProperty(WorkspaceItemProperty workspaceItemProperty) { IWorkspaceBrowserProvider provider = WorkspaceBrowserProviderFactory.CreateProvider(WorkspaceBrowserProviderFactory.Key.Instance); if (provider != null) { return(provider.RegisterProperty(workspaceItemProperty)); } Debug.WriteLine(DebugWriteLinePrefix + ": IWorkspaceBrowserProvider == null"); return(null); }
public void RegisterPropertyAsync(WorkspaceItemProperty workspaceItemProperty) { var r = new WorkspaceItemProperty(); using (var wrk = new BackgroundWorker()) { wrk.DoWork += (s, e) => { r.Id = Client.RegisterProperty(workspaceItemProperty); }; wrk.RunWorkerAsync(); } }
private void CreateWorkspaceItemToRegister(string id, string parentId, bool folder, string text) { string title = FormatTitle(text); var props = new WorkspaceItemProperty[CAmountProps]; var descs = new WorkspaceItemDescription[CAmountDesc]; int subIndex; string idHex; string idGuid; subIndex = (_index * 10) + 1; for (int i = 0; i < CAmountProps; i++) { idGuid = new Guid(subIndex, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).ToString(); idHex = idGuid.Substring(6, 2); props[i] = new WorkspaceItemProperty { Id = idGuid, ItemId = id, PropertyName = String.Format("Property({0}) - {1} of {2}", idHex, i + 1, CAmountProps), PropertyValue = String.Format("Property value({0}) - {1} of {2}", idHex, i + 1, CAmountProps), PropertyTypeId = _itemPropertyTypeId, PropertyTypeDescription = String.Format("Property description({0}) - {1} of {2}", subIndex, i + 1, CAmountProps) }; subIndex++; } subIndex = (_index * 10) + 1; for (int i = 0; i < CAmountDesc; i++) { idGuid = new Guid(subIndex, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).ToString(); idHex = idGuid.Substring(6, 2); descs[i] = new WorkspaceItemDescription { CultureId = CultureInfo.CurrentCulture.Name, Id = idGuid, ItemId = id, Title = String.Format("Description({0}) - {1} of {2}", idHex, i + 1, CAmountDesc), TypeId = _itemDescriptionTypeId }; subIndex++; } _items[_index++] = new WorkspaceItem { Id = id, ParentId = parentId, ItemId = id, TypeId = (folder ? _treeViewFolderTypeId : _treeViewLeafTypeId), ItemTitle = title, Descriptions = descs, Properties = props, DateModified = DateTime.Now }; }
public void Try_RegisterProperty() { _index = (_index == 0) ? CAmountItemsToRegister : _index; string id = new Guid((_index * 10) + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0).ToString(); var workspaceItemProperty = new WorkspaceItemProperty { Id = id, ItemId = Guid.Empty.ToString(), PropertyName = "Created", PropertyValue = DateTime.Now.ToString(), PropertyTypeId = _itemPropertyTypeId, }; // create string result1 = _agent.RegisterProperty(workspaceItemProperty); Assert.AreEqual(id, result1); // update workspaceItemProperty.PropertyName = "Updated " + DateTime.Now; string result2 = _agent.RegisterProperty(workspaceItemProperty); Assert.AreEqual(id, result2); // only create workspaceItemProperty = new WorkspaceItemProperty { Id = string.Empty, ItemId = Guid.Empty.ToString(), PropertyName = "Created", PropertyValue = DateTime.Now.ToString(), PropertyTypeId = _itemPropertyTypeId }; string result3 = _agent.RegisterProperty(workspaceItemProperty); Assert.AreNotEqual(string.Empty, result3); Logger.InfoFormat("Property registered (Id = '{0}'", result3); DebugWriteFinished("Try_RegisterProperty finished on {0}"); }
public string RegisterProperty(WorkspaceItemProperty workspaceItemProperty) { return(Client.RegisterProperty(workspaceItemProperty)); }
public string RegisterProperty(WorkspaceItemProperty workspaceItemProperty) { return WorkspaceBrowserDomainGenerator .RegisterMockProperty(workspaceItemProperty); }