本文整理汇总了C#中Composite.C1Console.Security.EntityToken类的典型用法代码示例。如果您正苦于以下问题:C# EntityToken类的具体用法?C# EntityToken怎么用?C# EntityToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityToken类属于Composite.C1Console.Security命名空间,在下文中一共展示了EntityToken类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetActions
public IEnumerable<ElementAction> GetActions(EntityToken entityToken)
{
if (entityToken is DataEntityToken)
{
var token = entityToken as DataEntityToken;
if (token.Data.DataSourceId.InterfaceType == typeof(ApiKey))
{
if (!token.Data.GetProperty<bool>("Default"))
{
yield return new ElementAction(new ActionHandle(new SetDefaultActionToken()))
{
VisualData = new ActionVisualizedData
{
Label = "Set Default",
ToolTip = "Set Dafault",
Icon = new ResourceHandle("Composite.Icons", "accept"),
ActionLocation = new ActionLocation
{
ActionType = ActionType.Add,
IsInFolder = false,
IsInToolbar = true,
ActionGroup = _actionGroup
}
}
};
}
}
}
}
示例2: IsAttachingPoint
/// <exclude />
public static bool IsAttachingPoint(EntityToken leftEntityToken, EntityToken rightEntityToken)
{
return leftEntityToken.GetType() == rightEntityToken.GetType()
&& leftEntityToken.Id == rightEntityToken.Id
&& leftEntityToken.Type == rightEntityToken.Type
&& leftEntityToken.Source == rightEntityToken.Source;
}
示例3: OnAddAction
protected override void OnAddAction(Action<ElementAction> actionAdder, EntityToken entityToken, TreeNodeDynamicContext dynamicContext, DynamicValuesHelperReplaceContext dynamicValuesHelperReplaceContext)
{
actionAdder(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.GenericDeleteDataWorkflow"), this.PermissionTypes)))
{
VisualData = CreateActionVisualizedData(dynamicValuesHelperReplaceContext)
});
}
示例4: Create
public static IEnumerable<IPackItem> Create(EntityToken entityToken)
{
if (entityToken is GeneratedDataTypesElementProviderTypeEntityToken)
{
yield return new PCDynamicDataTypesData(entityToken);
}
}
示例5: HaveCustomChildElements
public bool HaveCustomChildElements(EntityToken parentEntityToken,
Dictionary<string, string> piggybag)
{
if (ElementAttachingPointFacade.IsAttachingPoint(parentEntityToken,
AttachingPoint.ContentPerspective) == false) return false;
return true;
}
示例6: Execute
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
{
var packageName = PackageCreatorFacade.ActivePackageName;
if (entityToken is PackageCreatorEntityToken)
{
packageName = (entityToken as PackageCreatorEntityToken).Source;
}
if (string.IsNullOrEmpty(packageName))
{
flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
var consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
consoleServices.ShowMessage(DialogType.Warning, PackageCreatorFacade.GetLocalization("NoPackages.Title"),
PackageCreatorFacade.GetLocalization("NoPackages.Message"));
return null;
}
if (actionToken is AddLocalizationActionToken)
{
var token = actionToken as AddLocalizationActionToken;
PackageCreatorFacade.AddItem(new PCLocalizations(token.CultureName), packageName);
}
var treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());
return null;
}
示例7: Execute
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
{
var packageName = PackageCreatorFacade.ActivePackageName;
if (entityToken is PackageCreatorEntityToken)
{
packageName = (entityToken as PackageCreatorEntityToken).Source;
}
if (string.IsNullOrEmpty(packageName))
{
flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
consoleServices.ShowMessage(DialogType.Warning, PackageCreatorFacade.GetLocalization("NoPackages.Title"), PackageCreatorFacade.GetLocalization("NoPackages.Message"));
return null;
}
if (actionToken is PackageCreatorActionToken)
{
var token = actionToken as PackageCreatorActionToken;
foreach (var item in PackageCreatorActionFacade.GetPackageCreatorItems(entityToken))
{
if (item.CategoryName == token.CategoryName)
{
//if diffent item for one category and entitytoken
var itemActionToken = item as IPackItemActionToken;
if (itemActionToken != null)
{
if (token.Name != itemActionToken.ActionTokenName)
{
continue;
}
}
if (item is IPackToggle)
{
if ((item as IPackToggle).CheckedStatus == ActionCheckedStatus.Checked)
{
PackageCreatorFacade.RemoveItem(item, packageName);
}
else
{
PackageCreatorFacade.AddItem(item, packageName);
}
var parentTreeRefresher = new ParentTreeRefresher(flowControllerServicesContainer);
parentTreeRefresher.PostRefreshMesseges(entityToken);
}
else
{
PackageCreatorFacade.AddItem(item, packageName);
}
break;
}
}
}
SpecificTreeRefresher treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());
return null;
}
示例8: GetActions
public IEnumerable<ElementAction> GetActions(EntityToken entityToken)
{
if (entityToken is NugetPackageEntityToken)
{
var isRemote = ((NugetPackageEntityToken)entityToken).IsRemotePackage();
var isUpdate = ((NugetPackageEntityToken)entityToken).IsUpdatePackage();
ElementAction elementAction = new ElementAction(new ActionHandle(new NugetActionToken()))
{
VisualData = new ActionVisualizedData
{
Label = isRemote ? "Install Package" : isUpdate? "Update Package" : "Uninstall Package",
ToolTip = string.Empty,
Icon = isRemote ? CommonCommandIcons.AddNew : isUpdate? CommonCommandIcons.Refresh : CommonCommandIcons.Delete,
ActionLocation = new ActionLocation
{
ActionType = ActionType.Edit,
IsInToolbar = true,
ActionGroup = AppendedActionGroup
}
}
};
yield return elementAction;
}
}
示例9: CreateNewTasks
public TaskContainer CreateNewTasks(EntityToken entityToken, ActionToken actionToken, TaskManagerEvent taskManagerEvent)
{
List<Task> newTasks = new List<Task>();
lock (_lock)
{
foreach (Func<EntityToken, ActionToken, Task> taskCreator in _taskCreators)
{
try
{
Task task = taskCreator(entityToken, actionToken);
if (task == null) continue;
bool result = task.TaskManager.OnCreated(task.Id, taskManagerEvent);
if (result == false) continue;
_tasks.Add(task);
newTasks.Add(task);
}
catch (Exception ex)
{
Log.LogError("TaskManagerFacade", "Starting new task failed with following exception");
Log.LogError("TaskManagerFacade", ex);
}
}
}
return new TaskContainer(newTasks, null);
}
示例10: PreparePiggybag
/// <exclude />
public static Dictionary<string, string> PreparePiggybag(this Dictionary<string, string> piggybag, TreeNode parentNode, EntityToken parentEntityToken)
{
var newPiggybag = new Dictionary<string, string>();
foreach (KeyValuePair<string, string> kvp in piggybag)
{
if (kvp.Key.StartsWith(ParentEntityTokenPiggybagString))
{
int generation = int.Parse(kvp.Key.Substring(ParentEntityTokenPiggybagString.Length));
generation += 1;
newPiggybag.Add(string.Format("{0}{1}", ParentEntityTokenPiggybagString, generation), kvp.Value);
}
else if (kvp.Key.StartsWith(ParentNodeIdPiggybagString))
{
int generation = int.Parse(kvp.Key.Substring(ParentNodeIdPiggybagString.Length));
generation += 1;
newPiggybag.Add(string.Format("{0}{1}", ParentNodeIdPiggybagString, generation), kvp.Value);
}
else
{
newPiggybag.Add(kvp.Key, kvp.Value);
}
}
newPiggybag.Add(string.Format("{0}1", ParentEntityTokenPiggybagString), EntityTokenSerializer.Serialize(parentEntityToken));
newPiggybag.Add(string.Format("{0}1", ParentNodeIdPiggybagString), parentNode.Id.ToString());
return newPiggybag;
}
示例11: GetChildren
public IEnumerable<Element> GetChildren(EntityToken entityToken, SearchToken seachToken)
{
if (entityToken.Id == DeveloperApplicationProviderEntityToken.TreeRootFolderId)
{
foreach (string treeDefinitionFilename in this.TreeDefinitionFilenames)
{
string filename = Path.GetFileName(treeDefinitionFilename);
Element treeDefintionElement = new Element(_context.CreateElementHandle(
new DeveloperApplicationProviderEntityToken(DeveloperApplicationProviderEntityToken.TreeDefinitionId, filename)))
{
VisualData = new ElementVisualizedData
{
Label = filename,
ToolTip = filename,
Icon = TreeDefinitionIcon
}
};
treeDefintionElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.DeleteTreeDefinitionWorkflow"), PermissionTypePredefined.Delete)))
{
VisualData = new ActionVisualizedData
{
Label = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Delete.Label"),
ToolTip = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Delete.ToolTip"),
Icon = TreeDefinitionIconDelete,
Disabled = false,
ActionLocation = ActionLocation.DeletePrimaryActionLocation
}
});
treeDefintionElement.AddAction(new ElementAction(new ActionHandle(new WorkflowActionToken(WorkflowFacade.GetWorkflowType("Composite.C1Console.Trees.Workflows.EditTreeDefinitionWorkflow"), PermissionTypePredefined.Edit)))
{
VisualData = new ActionVisualizedData
{
Label = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Edit.Label"),
ToolTip = StringResourceSystemFacade.GetString("Composite.C1Console.Trees", "TreeDeleteTreeDefinitionWorkflow.Edit.ToolTip"),
Icon = TreeDefinitionIconEdit,
Disabled = false,
ActionLocation = ActionLocation.EditPrimaryActionLocation
}
});
yield return treeDefintionElement;
}
yield break;
}
else if (entityToken.Id == DeveloperApplicationProviderEntityToken.TreeDefinitionId)
{
//DeveloperApplicationProviderEntityToken castedEntityToken = (DeveloperApplicationProviderEntityToken)entityToken;
//foreach (Element element in TreeFacade.GetElementsByTreeId(castedEntityToken.Filename, entityToken, new Dictionary<string, string>()))
//{
// yield return element;
//}
}
yield break;
}
示例12: GetActions
public IEnumerable<ElementAction> GetActions(EntityToken entityToken)
{
if (entityToken is WebsiteFileElementProviderEntityToken)
{
if (Path.GetExtension(entityToken.Id).ToLower() == ".xml")
{
if (entityToken.Id.Replace("/", "\\").Contains(StoreHelper.StoringPath.Replace("/", "\\")))
{
yield return new ElementAction(new ActionHandle(new HandleActionToken()))
{
VisualData = new ActionVisualizedData
{
Label = "Export to Excel",
ToolTip = "Export to Excel",
Icon = new ResourceHandle("Composite.Icons", "mimetype-xls"),
ActionLocation = new ActionLocation
{
ActionType = ActionType.Other,
IsInFolder = false,
IsInToolbar = false,
ActionGroup = new ActionGroup("Export", ActionGroupPriority.PrimaryLow)
}
}
};
}
}
}
yield break;
}
示例13: Execute
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
{
PackageCreatorFacade.DeletePackageInformation(entityToken.Source);
SpecificTreeRefresher treeRefresher = new SpecificTreeRefresher(flowControllerServicesContainer);
treeRefresher.PostRefreshMesseges(new PackageCreatorElementProviderEntityToken());
return null;
}
示例14: GetActions
public IEnumerable<ElementAction> GetActions(EntityToken entityToken)
{
var dataEntityToken = entityToken as DataEntityToken;
if (dataEntityToken == null) return NoActions;
if (dataEntityToken.InterfaceType != typeof(IXsltFunction)) return NoActions;
var action = new ElementAction(new ActionHandle(new ConvertFunctionActionToken()))
{
VisualData = new ActionVisualizedData
{
Label = "Convert to Razor",
ToolTip = "Creates a new razor function with the same name and parameters while renaming the existing xsl function",
Icon = ActionIcon,
Disabled = false,
ActionLocation = new ActionLocation
{
ActionType = ActionType.Other,
IsInFolder = false,
IsInToolbar = true,
ActionGroup = PrimaryActionGroup
}
}
};
return new [] { action };
}
示例15: Execute
public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
{
//string documentTitle = "Unpublished Pages and Page Folder Data";
//string description = "The list below display pages and page data which are currently being edited or are ready to be approved / published.";
string documentTitle = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-title");
string description = StringResourceSystemFacade.GetString("Composite.Plugins.PageElementProvider", "PageElementProvider.ViewUnpublishedItems-document-description");
string emptyLabel = StringResourceSystemFacade.GetString("Composite.Plugins.GeneratedDataTypesElementProvider", "ViewUnpublishedItems-document-empty-label");
string url = string.Format("{0}?showpagedata=true&title={1}&description={2}&emptyLabel={3}",
UrlUtils.ResolveAdminUrl(string.Format("content/views/publishworkflowstatus/ViewUnpublishedItems.aspx")),
HttpUtility.UrlEncode(documentTitle, Encoding.UTF8),
HttpUtility.UrlEncode(description, Encoding.UTF8),
HttpUtility.UrlEncode(emptyLabel, Encoding.UTF8));
IManagementConsoleMessageService consoleServices = flowControllerServicesContainer.GetService<IManagementConsoleMessageService>();
OpenViewMessageQueueItem openViewMsg = new OpenViewMessageQueueItem
{
EntityToken = EntityTokenSerializer.Serialize(entityToken, true),
ViewId = "ViewUnpublishedPageItems",
Label = documentTitle,
Url = url,
ViewType = ViewType.Main
};
ConsoleMessageQueueFacade.Enqueue(openViewMsg, consoleServices.CurrentConsoleId);
return null;
}