public List <WebsiteLink> GetAllLinks(string usernumber) { List <WebsiteLink> Links = new List <WebsiteLink>(); OpenDBConnection(); SqlCommand ucommand; ucommand = new SqlCommand("SELECT * from dash_website where fld_UserNumber = @usernumber AND (fld_Status IS NULL OR fld_Status <> 'D') order by date DESC", conn); ucommand.Parameters.Add(new SqlParameter("usernumber", usernumber)); using (SqlDataReader reader = ucommand.ExecuteReader()) { while (reader.Read()) { WebsiteLink links = new WebsiteLink(); links.website = reader["website"].ToString(); Links.Add(links); } } ucommand.Dispose(); CloseDBConnection(); return(Links); }
/// <summary> /// Opens default web browser with provided link. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param> private void ListBox_MouseLeftButtonDown_OpenLinkURL(object sender, System.Windows.Input.MouseButtonEventArgs e) { ListBoxItem item = sender as ListBoxItem; if (item != null) { WebsiteLink link = (WebsiteLink)item.DataContext; Process.Start(new ProcessStartInfo(link.LinkURL)); e.Handled = true; } }
/// <summary> /// Handles the MouseLeftButtonUp event of the MenuItems inside the Help drowndown menu. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param> private void HelpMenuItem_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { MenuItem item = sender as MenuItem; if (item != null) { WebsiteLink link = (WebsiteLink)item.DataContext; Process.Start(new ProcessStartInfo(link.LinkURL)); e.Handled = true; } }
/// <summary> /// Opens experiment when double clicked on the row /// </summary> /// <param name="source">Source.</param> /// <param name="args">Arguments.</param> private void OpenWebsiteLink(object source, RowActivatedArgs args) { TreeIter item; NodeView nodeView = (NodeView)source; if (nodeView.Selection.GetSelected(out item)) { WebsiteLink link = (WebsiteLink)nodeView.Model.GetValue(item, 1); link.OpenLink(); } }
public WebsiteLinkMenuItem(WebsiteLink link) : base(link.Title) { m_websiteLink = link; }
private void RenderWebsiteLink(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { WebsiteLink websiteLink = (WebsiteLink)model.GetValue(iter, 1); (cell as CellRendererText).Text = websiteLink.Title + "\n" + websiteLink.Description; }