private void SetLinkOptionalDescriptors(ActionLink actionLink, Link link) { link.HrefLang = actionLink.HrefLang; link.Name = actionLink.Name; link.Title = actionLink.Title; link.Type = actionLink.Type; }
public void TestIsChanged() { ActionLink link = CreateLink(); Assert.IsTrue(link.IsChanged); link.IsChanged = false; link.SourceButton = new DashboardButton(); Assert.IsTrue(link.IsChanged); link.IsChanged = false; link.SourceTags.Add(new Tag("test")); Assert.IsTrue(link.IsChanged); link.IsChanged = false; link.SourceTags = null; Assert.IsTrue(link.IsChanged); link.IsChanged = false; link.DestinationButton = new DashboardButton(); Assert.IsTrue(link.IsChanged); link.IsChanged = false; link.DestinationTags.Remove(link.DestinationTags [0]); Assert.IsTrue(link.IsChanged); link.IsChanged = false; link.DestinationTags = null; Assert.IsTrue(link.IsChanged); link.IsChanged = false; link.KeepPlayerTags = true; Assert.IsTrue(link.IsChanged); link.IsChanged = false; link.KeepGenericTags = true; Assert.IsTrue(link.IsChanged); link.IsChanged = false; }
/// <summary> /// Links action chains together. /// </summary> private static void LinkActionNodes(Dictionary <int, ActionLink> actionLinkDict) { // Exit if no actions if (actionLinkDict.Count == 0) { return; } // Iterate through actions foreach (var item in actionLinkDict) { ActionLink link = item.Value; // Link to next node if (actionLinkDict.ContainsKey(link.nextKey)) { link.gameObject.GetComponent <DaggerfallAction>().NextObject = actionLinkDict[link.nextKey].gameObject; } // Link to previous node if (actionLinkDict.ContainsKey(link.prevKey)) { link.gameObject.GetComponent <DaggerfallAction>().PreviousObject = actionLinkDict[link.prevKey].gameObject; } } }
public async Task <System.Web.Mvc.ActionResult> Portal( string portalUri, string pageUri, string preview, [ModelBinder(typeof(ActionLinkModelBinder))] ActionLink actionLink, [ModelBinder(typeof(AuthTicketModelBinder))] AuthTicket authTicket, CancellationToken cancellationToken) { var portal = await _portalManager.FindByUriAsync(portalUri, PortalField.Project | PortalField.Owners, cancellationToken); if (portal == null) { return(HttpNotFound()); } if (!string.IsNullOrEmpty(portal.Domain)) { return(Redirect(string.Join("/", "http://www." + portal.Domain, pageUri))); } var security = await _securityManager.CheckAccessAsync(portal, User.Identity.Name, AccessPermission.CanView, cancellationToken); if (!security.AccessGranted) { return(new HttpStatusCodeResult(HttpStatusCode.Forbidden)); } var pageLayers = await _portalManager.GetPageLayersByUriAsync(portal, pageUri, cancellationToken); if (pageLayers?.ContentPage == null) { return(HttpNotFound()); } return(View("Content", await CreateResultAsync(security, portal, pageLayers, actionLink, authTicket, preview == null, cancellationToken))); }
public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, ActionLink link) { var controllerName = link.Controller.EndsWith("Controller") ? link.Controller.Substring(0, link.Controller.Length - "Controller".Length) : link.Controller; return(htmlHelper.ActionLink(link.Title, link.Action, controllerName, new { link.Area }, new { })); }
ActionLink CreateActionLink(DashboardButton source, DashboardButton dest) { ActionLink link = new ActionLink(); link.DestinationButton = dest; link.SourceButton = source; return(link); }
public ActionResult DeleteConfirmed(int id) { ActionLink actionlink = db.ActionLink.Find(id); db.ActionLink.Remove(actionlink); db.SaveChanges(); return(RedirectToAction("Index")); }
public Thumbnail(string path, string fileName, string t, string d, ActionLink a, float x = 400, float y = 50) : base(x, y, a) { title = t; description = d; thumbnailPath = path; thumbnailName = fileName; thumbnail = ImageDB.GetImage(thumbnailName, thumbnailPath); }
/// <summary> /// Links action chains together. /// </summary> public static void LinkActionNodes(Dictionary <int, ActionLink> actionLinkDict) { // Exit if no actions if (actionLinkDict.Count == 0) { return; } // Iterate through actions #Lypl foreach (var item in actionLinkDict) { ActionLink link = item.Value; DaggerfallAction dfAction = link.gameObject.GetComponent <DaggerfallAction>(); if (dfAction == null) { continue; } try { // Link to next node if (actionLinkDict.ContainsKey(link.nextKey)) { dfAction.NextObject = actionLinkDict[link.nextKey].gameObject; } // Link to previous node if (actionLinkDict.ContainsKey(link.prevKey)) { dfAction.PreviousObject = actionLinkDict[link.prevKey].gameObject; } } catch (Exception ex) { DaggerfallUnity.LogMessage(ex.Message, true); DaggerfallUnity.LogMessage(string.Format("Error in LinkActionNodes; {0} : {1} : {2} : {3}", link.gameObject.name, link.nextKey, link.prevKey, dfAction), true); } } //// Exit if no actions //if (actionLinkDict.Count == 0) // return; //// Iterate through actions //foreach (var item in actionLinkDict) //{ // ActionLink link = item.Value; // // Link to next node // if (actionLinkDict.ContainsKey(link.nextKey)) // link.gameObject.GetComponent<DaggerfallAction>().NextObject = actionLinkDict[link.nextKey].gameObject; // // Link to previous node // if (actionLinkDict.ContainsKey(link.prevKey)) // link.gameObject.GetComponent<DaggerfallAction>().PreviousObject = actionLinkDict[link.prevKey].gameObject; //} }
private string GetRelationDescription(ActionLink actionLink, DocAction actionDoc, CommonDefinitions commmonDefs) { // Determines the documentation for a given relation by first checking if there was a specific // description specified for the relation for the given action method. If not, the common relation // description is used. return (actionDoc.Relations.FirstOrDefault(r => r.RelName == actionLink.RelationName)?.Description ?? commmonDefs.Relations.FirstOrDefault(r => r.RelName == actionLink.RelationName)?.Description); }
// Populate new instance of the link related with new resource type. internal override void CopyTo <TNewResourceType>(ActionLink actionLink) { base.CopyTo <TNewResourceType>(actionLink); var actionUrlLink = (ActionTemplateLink)actionLink; actionUrlLink.GroupTemplateName = GroupTemplateName; actionUrlLink.ActionTemplateName = ActionTemplateName; }
protected void AddLink(ActionLink link) { if (link == null) { throw new ArgumentNullException(nameof(link), "Reference to link cannot be null."); } _links.Add(link); }
public ActionLink BuildLink(Theme theme) { RouteValueDictionary routeValueDictionary = new RouteValueDictionary(); routeValueDictionary.Add("id", theme.Id); ActionLink actionLink = new ActionLink("Play", "Training", routeValueDictionary); return(actionLink); }
public Thumbnail(string path, string fileName, string t, string d, ActionLink a, float x = 400, float y = 60) : base(x, y, a) { title = t; description = d; thumbnailPath = path; thumbnailName = fileName; thumbnail = ResourceUtility.EditorLoadTexture(thumbnailPath, thumbnailName); }
public ActionResult Edit([Bind(Include = "Id,Name,Controller,Action")] ActionLink actionLink) { if (ModelState.IsValid) { db.Entry(actionLink).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(actionLink)); }
void CreateLink(AnalysisEventButton source, AnalysisEventButton target) { ActionLink link = new ActionLink { SourceButton = source, DestinationButton = target }; link.SourceTags.Add(source.AnalysisEventType.Tags.First()); link.DestinationTags.Add(target.AnalysisEventType.Tags.First()); source.ActionLinks.Add(link); }
// // GET: /ActionLink/Delete/5 public ActionResult Delete(int id = 0) { ActionLink actionlink = db.ActionLink.Find(id); if (actionlink == null) { return(HttpNotFound()); } return(View(actionlink)); }
// Populates the documentation from cached action link data. public DocRelation(ActionLink actionLink) { RelName = actionLink.RelationName; HrefLang = actionLink.HrefLang; Name = actionLink.Name; Title = actionLink.Title; Type = actionLink.Type; IsDepricated = actionLink.Deprecation != null ? true : (bool?)null; }
public ActionResult Edit(ActionLink actionlink) { if (ModelState.IsValid) { db.Entry(actionlink).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(actionlink)); }
public ActionLink BuildLink(Theme theme) { var c = PluginController.LmsService.FindService <ICourseService>().GetCourse(theme.CourseRef); RouteValueDictionary routeValueDictionary = new RouteValueDictionary(); routeValueDictionary.Add("id", c.Id); ActionLink actionLink = new ActionLink("Training", "Play", new RouteValueDictionary(routeValueDictionary)); return(actionLink); }
public ActionResult Create(ActionLink actionlink) { if (ModelState.IsValid) { db.ActionLink.Add(actionlink); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(actionlink)); }
// Called for action link consisting of a hard-coded URL value. private Link SetLinkUrl(ResourceContext context, ActionLink actionLink) { var link = new Link { Href = actionLink.Href, Methods = actionLink.Methods.ToArray() }; UpdateLinkDescriptorsAndResource(context, actionLink, link); return(link); }
void HandleActionLinkCreatedEvent(ActionLink actionLink) { // if (template.HasCircularDependencies ()) { // Config.GUIToolkit.ErrorMessage (Catalog.GetString ( // "This linking option is not valid: infinite loop.")); // RemoveLink (actionLink, true); // } HandleActionLinksSelectedEvent(new List <ActionLink> { actionLink }); }
public ActionResult Create([Bind(Include = "Id,Name,Controller,Action")] ActionLink actionLink) { if (ModelState.IsValid) { db.ActionLink.Add(actionLink); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(actionLink)); }
void RemoveLink(ActionLink link, bool force = false) { string msg = string.Format("{0} {1} ?", Catalog.GetString("Do you want to delete: "), link); if (force || Config.GUIToolkit.QuestionMessage(msg, null, this)) { link.SourceButton.ActionLinks.Remove(link); Edited = true; Refresh(); } }
// Creates a new resource mapping for a new resource type based on an existing resource type. // Only the links for which the new resource meets the criteria of the original resource type // are copied. For example of the original link is based on a resource property of FooBarId, // and the resource to which the link is being copied does not have such a property, the link // will not be assigned to the new resource type. private void AddValidLinks(IResourceMeta resourceMeta) { foreach (ActionLink actionLink in resourceMeta.Links) { if (actionLink.CanBeAppliedTo(typeof(TResource))) { ActionLink newResourceLink = actionLink.CreateCopyFor <TResource>(); AddLink(newResourceLink); } } }
ActionLink CreateActionLink(DashboardButton source, DashboardButton dest, Tag sourceTag, Tag destTag) { ActionLink link = CreateActionLink(source, dest); link.SourceTags = new RangeObservableCollection <Tag> { sourceTag }; link.DestinationTags = new RangeObservableCollection <Tag> { destTag }; return(link); }
private void SetLinkBasedDescriptors(ResourceContext context, ActionLink actionLink, Link link) { if (actionLink.Deprecation != null) { link.Deprecation = SetLinkUrl(context, (dynamic)actionLink.Deprecation); } if (actionLink.Profile != null) { link.Profile = SetLinkUrl(context, (dynamic)actionLink.Profile); } }
private void UpdateLinkDescriptorsAndResource(ResourceContext context, ActionLink actionLink, Link link) { SetLinkTemplatedIndicator(link); SetLinkOptionalDescriptors(actionLink, link); SetLinkBasedDescriptors(context, actionLink, link); // Only generate links with relation-names are added to the resource. if (actionLink.RelationName != null) { var linkedResource = (ILinkedResource)context.Resource; linkedResource.Links.Add(actionLink.RelationName, link); } }
public async Task <IHttpActionResult> GetAsync( [FromUri(BinderType = typeof(ActionLinkModelBinder))] ActionLink linkParams, [FromUri(BinderType = typeof(AuthTicketModelBinder))] AuthTicket authTicket, CancellationToken cancellationToken = default(CancellationToken)) { if (!ModelState.IsValid) { return(StatusCode(HttpStatusCode.Forbidden)); } var contact = await GetContactAsync(linkParams, authTicket, cancellationToken); return(await ExecuteActionAsync(linkParams, authTicket, contact, null, cancellationToken)); }
public void TestEquality() { ActionLink link = CreateLink (); ActionLink link2 = new ActionLink (); Assert.IsTrue (link != link2); Assert.AreNotEqual (link, link2); link2.SourceButton = link.SourceButton; Assert.AreNotEqual (link, link2); link2.DestinationButton = link.DestinationButton; Assert.AreNotEqual (link, link2); link2.SourceTags = new ObservableCollection<Tag> { new Tag ("tag1") }; Assert.AreNotEqual (link, link2); link2.DestinationTags = new ObservableCollection<Tag> { new Tag ("tag2") }; Assert.IsTrue (link == link2); Assert.IsTrue (link.Equals (link2)); }
ActionLink CreateLink() { ActionLink link = new ActionLink (); link.SourceButton = new DashboardButton (); link.SourceTags = new ObservableCollection<Tag> { new Tag ("tag1") }; link.DestinationButton = new DashboardButton (); link.DestinationTags = new ObservableCollection<Tag> { new Tag ("tag2") }; link.Action = LinkAction.Toggle; link.TeamAction = TeamLinkAction.Invert; link.KeepGenericTags = false; link.KeepPlayerTags = false; return link; }
public void TestSerialization() { ActionLink link = new ActionLink (); Utils.CheckSerialization (link); link = CreateLink (); ActionLink link2 = Utils.SerializeDeserialize (link); Assert.AreEqual (link.SourceTags, link2.SourceTags); Assert.AreEqual (link.DestinationTags, link2.DestinationTags); Assert.AreEqual (link.Action, link2.Action); Assert.AreEqual (link.TeamAction, link2.TeamAction); Assert.AreEqual (link.KeepGenericTags, link2.KeepGenericTags); Assert.AreEqual (link.KeepPlayerTags, link2.KeepPlayerTags); }