[go: up one dir, main page]

Menu

[r91]: / frmAbout.cs  Maximize  Restore  History

Download this file

167 lines (147 with data), 6.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Shell32;
using Microsoft.Win32;
namespace RDPManager
{
public partial class frmAbout : Form
{
String version = "";
String mainWebsite = "http://sourceforge.net/projects/rdpmanager/";
String softwareJediSite = "http://www.AnAppADay.com";
String willisKnightonSite = "http://sourceforge.net/users/jwbrit/";
dlgShowMachineSettings dlgDispManual = null;
public frmAbout()
{
InitializeComponent();
#if DEBUG
this.Text = this.Text + " *";
#endif
}
public String Version
{
get { return version; }
set { version = value; }
}
private void linkWebsite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(mainWebsite);
}
private void llblSoftwareJedi_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(softwareJediSite);
}
private void llblWillisKnighton_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start(willisKnightonSite);
}
private void About_Shown(object sender, EventArgs e)
{
lblVersion.Text = "Version " + version;
#if DEBUG
lblVersion.Text += " (Debug)";
#endif
llblSoftwareJedi.AutoSize = true;
llblSoftwareJedi.Text = "Dana Hanna";
llblSoftwareJedi.LinkArea = new System.Windows.Forms.LinkArea(0, 10);
llblWillisKnighton.AutoSize = true;
llblWillisKnighton.Text = "Jeff Britton";
llblWillisKnighton.LinkArea = new System.Windows.Forms.LinkArea(0, 15);
txtRecent.Text = RdpManager.RecentMaxCount.ToString();
txtMRUs.Text = RdpManager.MUMaxCount.ToString();
}
private void btnOK_Click(object sender, EventArgs e)
{
Close();
}
private void btnShortcut_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog fileDg = new OpenFileDialog();
fileDg.InitialDirectory = Environment.GetEnvironmentVariable("USERPROFILE") + "\\Start Menu\\Programs\\Startup";
fileDg.FileName = "RdpManager.lnk";
fileDg.AutoUpgradeEnabled = true;
fileDg.CheckFileExists = false;
fileDg.DefaultExt = ".lnk";
fileDg.DereferenceLinks = false;
fileDg.RestoreDirectory = true;
fileDg.ValidateNames = true;
fileDg.Multiselect = false;
fileDg.AddExtension = true;
fileDg.Filter = "Shortcuts (*.lnk)|*.lnk";
fileDg.Title = "Locate xml file";
if (fileDg.ShowDialog() != DialogResult.Cancel)
{
ShellShortcut shortCut = new ShellShortcut(fileDg.FileName);
shortCut.Description = "Launch RDP Manager";
String execPath = String.Format("\"{0}\"", Application.ExecutablePath);
shortCut.Path = execPath;
shortCut.IconPath = Application.ExecutablePath;
shortCut.IconIndex = 0;
if (MessageBox.Show("Do you want to set the configuration files RDPManager is currently using as arguments?", "RDPManager Start Menu Shortcut", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
shortCut.Arguments = "";
foreach( String configFile in RdpManager.ConfigFiles )
{
shortCut.Arguments += "\"" + configFile + "\" ";
}
}
shortCut.Save();
MessageBox.Show("Shortcut Created!", "Shortcut Created", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception exc)
{
MessageBox.Show("Could not create shortcut, error: " + exc.ToString(), "Shortcut not created", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnReloadConfig_Click(object sender, EventArgs e)
{
RdpManager.reloadConfig();
}
private void btnResetRecent_Click(object sender, EventArgs e)
{
RdpManager.ResetRecent();
RdpManager.reloadConfig();
}
private void btnAddtoRegistry_Click(object sender, EventArgs e)
{
int count = 0;
if ( MessageBox.Show("This will import all the machines RDPManager knows about into the registry, which will suppress the unknown publisher warning dialog box. Continue?", "Import machines into registry", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No) return;
foreach (Machine mach in RdpManager.Machines.Values)
{
if( mach.MachineName == "Default" ) continue;
RDPManager.RdpManager.AddToReg(mach.MachineName);
count++;
}
MessageBox.Show( String.Format("Registry import completed, {0} machines imported", count), "Registry Import Done", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
private void btnDisplayMRU_Click(object sender, EventArgs e)
{
frmDisplayMUs dispMRU = new frmDisplayMUs();
dispMRU.ShowDialog();
}
private void btnShowMach_Click(object sender, EventArgs e)
{
if (dlgDispManual == null)
{
dlgDispManual = new dlgShowMachineSettings();
dlgDispManual.ShowDialog();
dlgDispManual.Dispose();
dlgDispManual = null;
}
else
{
dlgDispManual.BringToFront();
}
}
}
}