private void Button_Click(object sender, RoutedEventArgs e) { var button = sender as Button; var linkView = button.Tag as LinkView; LinkClicked?.Invoke(linkView); }
/// <summary> /// Fired when a user taps one of the link elements /// </summary> private async void Hyperlink_Click(Hyperlink sender, HyperlinkClickEventArgs args) { // Links that are nested within superscript elements cause the Click event to fire multiple times. // e.g. this markdown "[^bot](http://www.reddit.com/r/youtubefactsbot/wiki/index)" // Therefore we detect and ignore multiple clicks. if (multiClickDetectionTriggered) { return; } multiClickDetectionTriggered = true; await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => multiClickDetectionTriggered = false); // Get the hyperlink URL. var url = (string)sender.GetValue(HyperlinkUrlProperty); if (url == null) { return; } // Fire off the event. var eventArgs = new LinkClickedEventArgs(url); LinkClicked?.Invoke(this, eventArgs); }
/// <summary> /// Raises the LinkClicked event. /// </summary> /// <param name="e">An EventArgs containing the event data.</param> protected virtual void OnLinkClicked(LinkClickedEventArgs e) { LinkClicked?.Invoke(this, e); // If we have an attached command then execute it KryptonCommand?.PerformExecute(); }
/// <summary> /// Called when a link needs to be handled /// </summary> internal async void LinkHandled(string url, bool isHyperlink) { // Links that are nested within superscript elements cause the Click event to fire multiple times. // e.g. this markdown "[^bot](http://www.reddit.com/r/youtubefactsbot/wiki/index)" // Therefore we detect and ignore multiple clicks. if (multiClickDetectionTriggered) { return; } multiClickDetectionTriggered = true; await Dispatcher.RunAsync(CoreDispatcherPriority.High, () => multiClickDetectionTriggered = false); // Get the hyperlink URL. if (url == null) { return; } // Fire off the event. var eventArgs = new LinkClickedEventArgs(url); if (isHyperlink) { LinkClicked?.Invoke(this, eventArgs); } else { ImageClicked?.Invoke(this, eventArgs); } }
private void UiToDoUrlDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) { return; } int rowIndex = e.RowIndex; DataGridViewRow row = uiToDoUrlDataGridView.Rows[rowIndex]; string key = row.Cells[0].Value.ToString(); LinkClicked?.Invoke(this, new TextEventArgs(key)); }
void IPointerClickHandler.OnPointerClick(PointerEventData eventData) { int linkIndex = TMP_TextUtilities.FindIntersectingLink(text, Input.mousePosition, null); if (linkIndex == -1) { return; } TMP_LinkInfo linkInfo = text.textInfo.linkInfo[linkIndex]; if (eventData.clickCount == 1) { LinkClicked?.Invoke(linkInfo.GetLinkID()); } else { LinkDoubleClicked?.Invoke(linkInfo.GetLinkID()); } }
private void uiBookmarksDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { int col = e.ColumnIndex; if (col < 0) { return; } int rowIndex = e.RowIndex; DataGridViewRow row = uiBookmarksDataGridView.Rows[rowIndex]; string key = ""; switch (col) { case 0: DialogResult dr = MessageBox.Show("This will remove this bookmark. Are you sure?", "Remove Bookmark?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (dr != DialogResult.Yes) { return; } key = row.Cells[1].Value.ToString(); OsirtHelper.Favourites.Remove(key); uiBookmarksDataGridView.Rows.Remove(row); uiBookmarksDataGridView.Update(); uiBookmarksDataGridView.Refresh(); OsirtHelper.WriteFavourites(); BookmarkRemoved?.Invoke(this, EventArgs.Empty); break; case 2: //click link key = row.Cells[2].Value.ToString(); LinkClicked?.Invoke(this, new TextEventArgs(key)); break; } }
private void Messages_OnLinkClicked(object sender, LinkClicked e) { if (string.IsNullOrEmpty(e.Href)) { return; } if (!e.Href.Contains("://")) { LoadChapter(e.Href); } else { try { var uri = new Uri(e.Href); Device.OpenUri(uri); } catch (Exception ex) { _toastService.Show("Failed to open url: " + ex.Message); } } }
protected virtual void OnLinkClicked(object sender, LinkClickedEventArgs args) { LinkClicked?.Invoke(sender, args); }
private void OnLinkClicked(object sender, ExecutedRoutedEventArgs e) { LinkClicked?.Invoke(this, new LinkClickedEventArgs((string)e.Parameter)); }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { LinkClicked?.Invoke(sender, e); }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { string Property = e.Link.LinkData as string; PropertyInfo info = action.GetType().GetProperty(Property); if (info == null) { MessageBox.Show("Property " + Property + " Does not exist for " + action.GetType().Name); return; } DialogResult result = DialogResult.Cancel; string valueResult = ""; if (info.PropertyType == typeof(NumberValue)) { VariableEditor editor = new VariableEditor(); if (Variables != null) { editor.SetVariable(Variables.Select(x => x.Name)); } else { editor.SetVariable(new string[] { }); } NumberValue val = info.GetMethod.Invoke(action, new object[] { }) as NumberValue; editor.SetDefault(val == null ? "" : val.ToString()); editor.Text = "Variable Editor - " + Property; result = editor.ShowDialog(); if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { new NumberValue(valueResult) }); } } if (info.PropertyType == typeof(TargetKey)) { TargetKeyEditor editor = new TargetKeyEditor(); editor.SetPresets(ActionContext); editor.VariableList = Variables; TargetKey t = info.GetMethod.Invoke(action, new object[] { }) as TargetKey; if (t == null) { t = new TargetKey(); } editor.Target = t; result = editor.ShowDialog(); if (result == DialogResult.OK) { TargetKey target = editor.Target; info.SetMethod.Invoke(action, new object[] { target }); } } //It's an Enum! if (typeof(Enum).IsAssignableFrom(info.PropertyType)) { Enum enumValue = info.GetMethod.Invoke(action, new object[] { }) as Enum; //Find out if it's a flag and open the flag editor if (info.PropertyType.GetCustomAttribute <FlagsAttribute>() != null) { FlagCheckBoxEditor editor = new FlagCheckBoxEditor(); editor.EnumValue = enumValue; result = editor.ShowDialog(); enumValue = editor.EnumValue; } else { EnumEditor editor = new EnumEditor(); editor.EnumValue = enumValue; result = editor.ShowDialog(); enumValue = editor.EnumValue; } if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { enumValue }); valueResult = enumValue.ToString(); } } if (typeof(bool) == info.PropertyType) { bool val = (bool)info.GetMethod.Invoke(action, new object[] { }); BoolEditor editor = new BoolEditor(); editor.Value = val; result = editor.ShowDialog(); if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { editor.Value }); } } if (typeof(string) == info.PropertyType) { string val = (string)info.GetMethod.Invoke(action, new object[] { }); TextPrompt editor = new TextPrompt(); editor.Text = Property; editor.PromptText = val; result = editor.ShowDialog(); if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { editor.PromptText }); } } if (typeof(ActionCollection) == info.PropertyType) { ActionCollection actions = info.GetMethod.Invoke(action, new object[] { }) as ActionCollection; ActionListEditor editor = new ActionListEditor(); if (actions == null) { actions = new ActionCollection(Property); } editor.ActionContext = ActionContext; editor.Variables = Variables; editor.Actions = actions; result = editor.ShowDialog(); if (result == DialogResult.OK) { info.SetMethod.Invoke(action, new object[] { editor.Actions }); } } if (result == DialogResult.OK) { UpdateLinkTexts(); } if (LinkClicked != null) { LinkClicked.Invoke(this, new LinkClickedEventArgs(e.Link.LinkData as string)); } }
public void FireLink(string url) { LinkClicked?.Invoke(url); }
protected override void OnClick(object sender, EventArgs e) { base.OnClick(sender, e); LinkClicked?.Invoke(this, new LinkLabelLinkClickedEventArgs()); }
/// <summary> /// Propagate the LinkClicked event from root container. /// </summary> protected virtual void OnLinkClicked(HtmlLinkClickedEventArgs e) { LinkClicked?.Invoke(this, e); }
/// <summary> /// Handling richtextbox link clicked event and raising the same event here. /// </summary> /// <param name="sender">object</param> /// <param name="e">EventArgs</param> private void T_LinkClicked(object sender, EventArgs e) { LinkClicked?.Invoke(sender, e); }
private void Link_Click(object sender, EventArgs e) { LinkClicked?.Invoke(this, ((Label)sender).Tag.ToString()); }