Click here to Skip to main content
15,893,487 members
Articles / Programming Languages / C#

Linkify Add-in for Visual Studio

Rate me:
Please Sign up or sign in to vote.
4.59/5 (23 votes)
2 Aug 2008CPOL9 min read 172.8K   433   99  
Link source code comments to your bug tracker, MSDN, development Wiki and more.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace Linkify
{
  public partial class FormConfirm : Form
  {
    bool haveError = false;

    public FormConfirm()
    {
      InitializeComponent();
    }

    public void ResetConstents()
    {
      m_lvInfo.Items.Clear();
    }

    public void AddInfo(string name, string value)
    {
      ListViewItem lvi = m_lvInfo.Items.Add(name);
      lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, value));
      m_lvInfo.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
    }

    public void AddError(string error)
    {
      ListViewItem lvi = m_lvInfo.Items.Insert(0, "Error");
      lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, error));
      lvi.SubItems[0].Font = new Font(lvi.SubItems[0].Font, FontStyle.Bold);
      lvi.SubItems[0].BackColor = lvi.SubItems[1].BackColor = SystemColors.Info;
      lvi.SubItems[0].ForeColor = lvi.SubItems[1].ForeColor = SystemColors.InfoText;
      lvi.ImageIndex = 1;
      lvi.Selected = false;
      lvi.Focused = false;

      m_lvInfo.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

      cbRun.Visible = false;
      haveError = true;
      // focus to cancel button must be set after initializing control
      // when focus does not get set, listview draws "error" line incorrectly. doh!
    }


    private void button1_Click(object sender, EventArgs e)
    {
      // .. nothing
    }

    private bool m_forceSettings = false;
    public bool ForceSettings
    {
      get { return m_forceSettings;  }
    }

    private void cbEditSettings_Click(object sender, EventArgs e)
    {
      m_forceSettings = true;
    }

    public void SetUrl(string url)
    {
      lblMoreInfoLink.Text = url;
      lblMoreInfo.Visible = lblMoreInfoLink.Visible = !String.IsNullOrEmpty(url);
    }

    private void lblMoreInfoLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
    {
      ProcessStartInfo psi = new ProcessStartInfo("iexplore.exe", lblMoreInfoLink.Text);
      System.Diagnostics.Process.Start(psi);
    }

    private void FormConfirm_Shown(object sender, EventArgs e)
    {
      if (haveError)
        cbCancel.Focus();
    }
  }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Klippel
Germany Germany
Peter is tired of being called "Mr. Chen", even so certain individuals insist on it. No, he's not chinese.

Peter has seen lots of boxes you youngsters wouldn't even accept as calculators. He is proud of having visited the insides of a 16 Bit Machine.

In his spare time he ponders new ways of turning groceries into biohazards, or tries to coax South American officials to add some stamps to his passport.

Beyond these trivialities Peter works for Klippel[^], a small german company that wants to make mankind happier by selling them novel loudspeaker measurement equipment.


Where are you from?[^]



Please, if you are using one of my articles for anything, just leave me a comment. Seeing that this stuff is actually useful to someone is what keeps me posting and updating them.
Should you happen to not like it, tell me, too

Comments and Discussions