/// <summary> /// Creates a link that opens the platform's Xbox Music app with the specified view. /// </summary> /// <param name="action">The view to open for this particular entity.</param> /// <returns></returns> public string GetDeepLink(LinkAction action = LinkAction.View) { var actionString = Enum.GetName(typeof(LinkAction), action).ToLower(); var format = Link.Contains("?") ? "{0}&action={1}" : "{0}?action={1}"; return(string.Format(format, Link, actionString)); }
/// <summary> /// Makes sure the current action is the required Destination action /// </summary> /// <param name="action"></param> private void AssertIsRemoteDestination(LinkAction action) { if (action != LinkAction.ExternalDestination) { throw new ArgumentOutOfRangeException("action"); } }
/// <summary> /// Makes sure the current action is the required ExternalDestination action /// </summary> /// <param name="action"></param> private void AssertIsUrlDestination(LinkAction action) { if (action != LinkAction.Uri) { throw new ArgumentOutOfRangeException("action"); } }
public static MvcHtmlString DynamicLink(this HtmlHelper helper, LinkAction action, string id, string caption, object viewData = null, string href = null) { href = HtmlHelpers.ActionToCommand(action, href); TagBuilder tag = new TagBuilder("a"); tag.Attributes.Add("id", id); tag.Attributes.Add("href", href); tag.SetInnerText(caption); RouteValueDictionary htmlAttributes; RouteValueDictionary viewDataObj = HtmlHelper.AnonymousObjectToHtmlAttributes(viewData); if (viewDataObj.ContainsKey("htmlAttributes")) { htmlAttributes = HtmlHelper.AnonymousObjectToHtmlAttributes(viewDataObj["htmlAttributes"]); } else { htmlAttributes = viewDataObj; } foreach (var attr in viewDataObj) { tag.Attributes.Add(attr.Key, attr.Value.ToString()); } return(tag.ToMvcHtmlString(TagRenderMode.Normal)); }
/// <summary> /// Gets the known PDF name for the specified action. Only the supported named actions will return a value. /// Other action types with throw an ArgumentOutOfRange excpetion /// </summary> /// <param name="linkAction"></param> /// <returns></returns> private string GetNameForAction(LinkAction linkAction) { string name; switch (linkAction) { case LinkAction.Undefined: case LinkAction.Uri: case LinkAction.Destination: case LinkAction.ExternalDestination: case LinkAction.Launch: throw RecordAndRaise.ArgumentOutOfRange("linkAction"); case LinkAction.NextPage: name = "NextPage"; break; case LinkAction.PrevPage: name = "PrevPage"; break; case LinkAction.FirstPage: name = "FirstPage"; break; case LinkAction.LastPage: name = "LastPage"; break; default: throw RecordAndRaise.ArgumentOutOfRange("linkAction"); } return(name); }
/// <summary> /// [RegisterLinkNotifyCallback] /// コマンダーが変更された場合に呼び出されるコールバックを登録する /// 引数1: 登録するコールバック /// </summary> public void RegisterLinkNotifyCallback(LinkAction callback) { if (callback != null) { m_linkNotifyCallback += callback; } }
public Link(string url, int startIndex, int length, LinkAction action, string argument) { Url = url; Index = startIndex; Length = length; Action = action; Argument = argument; }
public void AddLink(string text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null, Action <SpriteText> creationParameters = null) { AddInternal(new DrawableLinkCompiler(AddText(text, creationParameters).ToList()) { TooltipText = tooltipText ?? (url != text ? url : string.Empty), Action = () => { switch (linkType) { case LinkAction.OpenBeatmap: // TODO: proper query params handling if (linkArgument != null && int.TryParse(linkArgument.Contains('?') ? linkArgument.Split('?')[0] : linkArgument, out int beatmapId)) { game?.ShowBeatmap(beatmapId); } break; case LinkAction.OpenBeatmapSet: if (int.TryParse(linkArgument, out int setId)) { game?.ShowBeatmapSet(setId); } break; case LinkAction.OpenChannel: try { channelManager?.OpenChannel(linkArgument); } catch (ChannelNotFoundException e) { Logger.Log($"The requested channel \"{linkArgument}\" does not exist"); } break; case LinkAction.OpenEditorTimestamp: case LinkAction.JoinMultiplayerMatch: case LinkAction.Spectate: showNotImplementedError?.Invoke(); break; case LinkAction.External: host.OpenUrlExternally(url); break; case LinkAction.OpenUserProfile: if (long.TryParse(linkArgument, out long userId)) { game?.ShowUser(userId); } break; default: throw new NotImplementedException($"This {nameof(LinkAction)} ({linkType.ToString()}) is missing an associated action."); } }, });
public void AddLink(IEnumerable <SpriteText> text, LinkAction action = LinkAction.External, string linkArgument = null, string tooltipText = null) { foreach (var t in text) { AddArbitraryDrawable(t); } createLink(text, new LinkDetails(action, linkArgument), tooltipText); }
private void CreateLink(Units target) { this._deltaTime = 0f; this.linePointUnit = target; this.lineTargets.Clear(); this.lineTargets.Add(target); this.linkAction = ActionManager.Link(new SkillDataKey(string.Empty, 0, 0), "PaotaLink", this.self, this.lineTargets, null, null); this.ResetSkillIconMask(base.skillIndex); }
/** * @param string icon * @param string name * @param string href * @return ILinkAction */ public ILinkAction newLinkAction(string icon, string name, string href) { var action = new LinkAction(); action.setName(name); action.setIcon(icon); action.setHref(href); return(action); }
public void AddLink(IEnumerable <SpriteText> text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null) { foreach (var t in text) { AddArbitraryDrawable(t); } createLink(text, null, url, linkType, linkArgument, tooltipText); }
private void Loaded(string args) { LinkAction link = new LinkAction(); link.DisplayName = "AnimatedTabControl"; link.Logo = ""; link.Controller = "Tab"; link.Action = "AnimatedTab"; this.SelectLink = link; }
private void ClearLink() { if (this.linkAction != null) { this.linkAction.Destroy(); this.linkAction = null; } this.linePointUnit = null; this._deltaTime = 0f; this.ResetSkillIconMask(base.skillIndex); }
/// <summary> /// Creates a new remote destination action to link to a destination in another file. /// </summary> /// <param name="owner"></param> /// <param name="action">Must be RemoteDestination</param> /// <param name="file">The path to the file where this is a link action to</param> /// <param name="name">The name of the item in the remote file to link to</param> public PDFRemoteDestinationAction(Component owner, LinkAction action, string file, string name) : base(owner, action) { if (string.IsNullOrEmpty(file)) { throw new ArgumentNullException("file", Errors.NoRemoteDestinationSpecifiedOnLink); } this.File = file; this.DestinationName = name; AssertIsRemoteDestination(action); }
/// <summary> /// Get the content's deep linking URL. Optionaly allows specifying an action. /// </summary> /// <param name="content">An artist, album or track content item.</param> /// <param name="action">An action to take when the link opens the Groove client.</param> /// <returns>The deep link.</returns> public static string GetLink(this Content content, LinkAction action = LinkAction.Default) { string link = content.Link; if (action == LinkAction.Default || string.IsNullOrEmpty(link)) { return(link); } string paramsSeparator = link.Contains("?") ? "&" : "?"; return($"{link}{paramsSeparator}action={action}"); }
private static String GetLink <T>(T model, LinkAction action, String iconClass) { UrlHelper url = new UrlHelper(HttpContext.Current.Request.RequestContext); TagBuilder actionTag = new TagBuilder("a"); TagBuilder icon = new TagBuilder("i"); actionTag.MergeAttribute("href", url.Action(action.ToString(), GetRouteValuesFor(model))); actionTag.AddCssClass(String.Format("{0}-action", action.ToString().ToLower())); icon.AddCssClass(iconClass); actionTag.InnerHtml = icon.ToString(); return(actionTag.ToString()); }
/// <summary> /// Get the content's deep linking URL. Optionaly allows specifying an action. /// </summary> /// <param name="content">An artist, album or track content item.</param> /// <param name="action">An action to take when the link opens the Xbox Music client.</param> /// <returns>The deep link.</returns> public static string GetLink(this Content content, LinkAction action = LinkAction.Default) { string link = content.Link; if (action == LinkAction.Default || String.IsNullOrEmpty(link)) { return(link); } else { return(String.Format(CultureInfo.InvariantCulture, "{0}{1}action={2}", link, link.Contains("?") ? "&" : "?", action)); } }
private bool IsNamedAction(LinkAction action) { switch (action) { case LinkAction.NextPage: case LinkAction.PrevPage: case LinkAction.FirstPage: case LinkAction.LastPage: return(true); default: return(false); } }
public void AddLink(string text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null) { AddInternal(new DrawableLinkCompiler(AddText(text).ToList()) { TooltipText = tooltipText ?? (url != text ? url : string.Empty), Action = () => { switch (linkType) { case LinkAction.OpenBeatmap: // todo: replace this with overlay.ShowBeatmap(id) once an appropriate API call is implemented. if (int.TryParse(linkArgument, out int beatmapId)) { Process.Start($"https://osu.ppy.sh/b/{beatmapId}"); } break; case LinkAction.OpenBeatmapSet: if (int.TryParse(linkArgument, out int setId)) { game?.ShowBeatmapSet(setId); } break; case LinkAction.OpenChannel: game?.OpenChannel(linkArgument); break; case LinkAction.OpenEditorTimestamp: case LinkAction.JoinMultiplayerMatch: case LinkAction.Spectate: showNotImplementedError?.Invoke(); break; case LinkAction.External: Process.Start(url); break; case LinkAction.OpenUserProfile: if (long.TryParse(linkArgument, out long userId)) { game?.ShowUser(userId); } break; default: throw new NotImplementedException($"This {nameof(LinkAction)} ({linkType.ToString()}) is missing an associated action."); } }, });
public void TestBeatmapLinks(LinkAction expectedAction, string expectedArg, string link) { Message result = MessageFormatter.FormatMessage(new Message { Content = link }); Assert.AreEqual(result.Content, result.DisplayContent); Assert.AreEqual(1, result.Links.Count); Assert.AreEqual(expectedAction, result.Links[0].Action); Assert.AreEqual(expectedArg, result.Links[0].Argument); if (expectedAction == LinkAction.External) { Assert.AreEqual(link, result.Links[0].Url); } }
private static void AddLinkAction <T>(IColumn <T> column, LinkAction action) { switch (action) { case LinkAction.Details: column.RenderValueAs(GetDetailsLink); break; case LinkAction.Edit: column.RenderValueAs(GetEditLink); break; case LinkAction.Delete: column.RenderValueAs(GetDeleteLink); break; } }
public static string ActionToCommand(LinkAction action, string customCommand = null) { switch (action) { case LinkAction.Custom: return(customCommand); case LinkAction.Refresh: return("javascript:location.reload();"); case LinkAction.GoBack: return("javascript:window.history.back();"); case LinkAction.GoForward: return("javascript:window.history.forward();"); default: return(null); } }
public static MvcHtmlString DynamicButton(this HtmlHelper helper, LinkAction action, string id, string caption, bool printable = true, object viewData = null, string function = null) { function = HtmlHelpers.ActionToCommand(action, function); TagBuilder tag = new TagBuilder("input"); tag.Attributes.Add("type", "button"); tag.Attributes.Add("id", id); tag.Attributes.Add("value", caption); tag.Attributes.Add("onClick", function); RouteValueDictionary htmlAttributes; RouteValueDictionary viewDataObj = HtmlHelper.AnonymousObjectToHtmlAttributes(viewData); if (viewDataObj.ContainsKey("htmlAttributes")) { htmlAttributes = HtmlHelper.AnonymousObjectToHtmlAttributes(viewDataObj["htmlAttributes"]); } else { htmlAttributes = viewDataObj; } tag.MergeAttributeValue("class", "btn", true); if (!printable) { tag.MergeAttributeValue("class", "d-print-none", true); } foreach (var attr in htmlAttributes) { tag.Attributes.Add(attr.Key, attr.Value.ToString()); } return(tag.ToMvcHtmlString(TagRenderMode.SelfClosing)); }
/// <summary> /// Register a link action between two node types. /// </summary> /// <typeparam name="TLinkerNode"></typeparam> /// <typeparam name="TLinkedNode"></typeparam> /// <param name="action"></param> public static void AddLinkAction <TLinkerNode, TLinkedNode>(LinkAction action) { linkActions.Add(new LinkArguments(typeof(TLinkerNode), typeof(TLinkedNode)), action); }
public LinkDetails(LinkAction action, string argument) { Action = action; Argument = argument; }
/// <summary> /// Get the content's deep linking URL. Optionaly allows specifying an action. /// </summary> /// <param name="content">An Artist, XboxAlbum or track content item.</param> /// <param name="action">An action to take when the link opens the Xbox Music client.</param> /// <returns>The deep link.</returns> public static string GetLink(this Content content, LinkAction action = LinkAction.Default) { string link = content.Link; if (action == LinkAction.Default || String.IsNullOrEmpty(link)) { return link; } else { return String.Format(CultureInfo.InvariantCulture, "{0}{1}action={2}", link, link.Contains("?") ? "&" : "?", action); } }
protected override void DoRegisterArtefacts(PDFLayoutContext context, PDFArtefactRegistrationSet set, Style fullstyle) { base.DoRegisterArtefacts(context, set, fullstyle); LinkAction actiontype = this.Action; if (actiontype == LinkAction.Undefined) { actiontype = this.ResolveActionType(this.Destination, this.File); } object[] entries = null; PDFAction action; if (this.IsNamedAction(actiontype)) { PDFNamedAction named = new PDFNamedAction(this, this.Action); action = named; } else if (actiontype == LinkAction.Uri) { string url = this.File; if (!string.IsNullOrEmpty(url)) { action = new PDFUriDestinationAction(this, actiontype, url); } else { throw new PDFLinkException(Errors.NoFileLinkSpecifiedOnUriAction); } } else if (actiontype == LinkAction.Destination) { //If we start with a # then we are an ID, otherwise we are a uniqueID or Name PDFDestination dest; Component comp; if (string.IsNullOrEmpty(this.Destination)) { //if there is no destination then there is no link. So do not register comp = null; return; } else if (this.Destination.StartsWith(ComponentIDPrefix)) { string id = this.Destination.Substring(ComponentIDPrefix.Length); comp = this.Document.FindAComponentById(id); } else { comp = this.Document.FindAComponentByName(this.Destination); } if (null == comp) { if (context.Conformance == ParserConformanceMode.Strict) { throw new PDFLayoutException(string.Format(Errors.LinkToDestinationCouldNotBeMade, this.Destination)); } else { context.TraceLog.Add(TraceLevel.Error, "PDFLink", string.Format(Errors.LinkToDestinationCouldNotBeMade, this.Destination)); } //cannot continue as we dont have anything to link to return; } dest = new PDFDestination(comp, this.DestinationFit, this.UniqueID); PDFDestinationAction destact = new PDFDestinationAction(this, actiontype, dest); action = destact; if (null != dest) { object link = context.DocumentLayout.RegisterCatalogEntry(context, PDFArtefactTypes.Names, dest); set.SetArtefact(LinkArtefactName, link); } } else if (actiontype == LinkAction.ExternalDestination) { string name = this.Destination; string file = this.File; PDFRemoteDestinationAction remote = new PDFRemoteDestinationAction(this, actiontype, file, name); remote.NewWindow = this.NewWindow; action = remote; } else { throw RecordAndRaise.Argument("actiontype"); } if (null != action) { entries = this.AddActionAnnotationToChildren(context, fullstyle, action); set.SetArtefact(LinkAnnotationChildEntries, entries); } }
/// <summary> /// Creates an Affiliate link that opens the platform's Xbox Music app with the specified view. /// </summary> /// <param name="affiliateId">The AffiliateID assigned to you by LinkSynergy.</param> /// <param name="action">The view to open for this particular entity.</param> /// <returns></returns> public string GetDeepLink(string affiliateId, LinkAction action = LinkAction.View) { var deepLink = Uri.EscapeUriString(GetDeepLink(action)); return string.Format("http://click.linksynergy.com/deeplink?id={0}&mid=39033&murl={1}", affiliateId, deepLink); }
public void AddLink(string text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null, Action <SpriteText> creationParameters = null) => createLink(AddText(text, creationParameters), text, url, linkType, linkArgument, tooltipText);
/// <summary> /// Creates an Affiliate link that opens the platform's Xbox Music app with the specified view. /// </summary> /// <param name="affiliateId">The AffiliateID assigned to you by LinkSynergy.</param> /// <param name="action">The view to open for this particular entity.</param> /// <returns></returns> public string GetDeepLink(string affiliateId, LinkAction action = LinkAction.View) { var deepLink = Uri.EscapeUriString(GetDeepLink(action)); return(string.Format("http://click.linksynergy.com/deeplink?id={0}&mid=39033&murl={1}", affiliateId, deepLink)); }
/// <summary> /// Creates a new known named action with the link action as specified /// </summary> /// <param name="component">The component that owns this action (in this case can be null)</param> /// <param name="action">The action to perform</param> public PDFNamedAction(Component component, LinkAction action) : base(component, action) { AssertLinkAction(action); }
/// <summary> /// Creates a link that opens the platform's Xbox Music app with the specified view. /// </summary> /// <param name="action">The view to open for this particular entity.</param> /// <returns></returns> public string GetDeepLink(LinkAction action = LinkAction.View) { var actionString = Enum.GetName(typeof(LinkAction), action).ToLower(); var format = Link.Contains("?") ? "{0}&action={1}" : "{0}?action={1}"; return string.Format(format, Link, actionString); }