/SWAT Office App/trunk/SWAT Office App/DriveLogger_Form.Designer.cs |
---|
0,0 → 1,70 |
namespace SWAT_Office_App |
{ |
partial class DriveLogger_Form |
{ |
/// <summary> |
/// Required designer variable. |
/// </summary> |
private System.ComponentModel.IContainer components = null; |
/// <summary> |
/// Clean up any resources being used. |
/// </summary> |
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
protected override void Dispose(bool disposing) |
{ |
if (disposing && (components != null)) |
{ |
components.Dispose(); |
} |
base.Dispose(disposing); |
} |
#region Windows Form Designer generated code |
/// <summary> |
/// Required method for Designer support - do not modify |
/// the contents of this method with the code editor. |
/// </summary> |
private void InitializeComponent() |
{ |
this.listView_Drives = new System.Windows.Forms.ListView(); |
this.SuspendLayout(); |
// |
// listView_Drives |
// |
this.listView_Drives.AutoArrange = false; |
this.listView_Drives.Dock = System.Windows.Forms.DockStyle.Fill; |
this.listView_Drives.FullRowSelect = true; |
this.listView_Drives.GridLines = true; |
this.listView_Drives.LabelEdit = true; |
this.listView_Drives.Location = new System.Drawing.Point(0, 0); |
this.listView_Drives.MultiSelect = false; |
this.listView_Drives.Name = "listView_Drives"; |
this.listView_Drives.Size = new System.Drawing.Size(548, 111); |
this.listView_Drives.TabIndex = 0; |
this.listView_Drives.UseCompatibleStateImageBehavior = false; |
this.listView_Drives.View = System.Windows.Forms.View.Details; |
// |
// DriveLogger_Form |
// |
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
this.ClientSize = new System.Drawing.Size(548, 111); |
this.ControlBox = false; |
this.Controls.Add(this.listView_Drives); |
this.MaximizeBox = false; |
this.Name = "DriveLogger_Form"; |
this.ShowIcon = false; |
this.ShowInTaskbar = false; |
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; |
this.Text = "SWAT DriveLogger"; |
this.ResumeLayout(false); |
} |
#endregion |
private System.Windows.Forms.ListView listView_Drives; |
} |
} |
/SWAT Office App/trunk/SWAT Office App/DriveLogger_Form.cs |
---|
0,0 → 1,337 |
using System; |
using System.Collections.Generic; |
using System.ComponentModel; |
using System.Data; |
using System.Drawing; |
using System.Linq; |
using System.Text; |
using System.Windows.Forms; |
using System.IO; |
using System.Threading; |
namespace SWAT_Office_App |
{ |
public struct DriveEntry |
{ |
public DateTime time; // Time of insertion |
public string drive; // Drive letter of the drive |
public string label; // Label of the drive |
public string size; // Size of the drive in bytes (I think) |
public string owner; // Owner to be specified |
public string dock; // Dock number as choosen |
} |
public partial class DriveLogger_Form : Form |
{ |
private static List<DriveEntry> driveEntryList= new List<DriveEntry>(); |
private static string logLocation = "DriveLogger Log.txt"; |
public static bool instanceAlreadyRunning = false; |
public DriveLogger_Form() |
{ |
// Disable thread safe checking |
CheckForIllegalCrossThreadCalls = false; |
driveEntryList.Clear(); |
InitializeComponent(); |
this.listView_Drives.AfterLabelEdit += new LabelEditEventHandler(listView_Drives_AfterLabelEdit); |
this.KeyPreview = true; |
this.KeyDown += new KeyEventHandler(DriveLogger_Form_KeyDown); |
this.FormClosed += new FormClosedEventHandler(DriveLogger_Form_FormClosed); |
using (StreamWriter sw = File.AppendText(logLocation)) |
{ |
sw.WriteLine("-- New Session Started --"); |
sw.WriteLine("Initializing form details"); |
} |
// Adds columns to the listview |
this.listView_Drives.Columns.Add("Owner", 145, HorizontalAlignment.Left); |
this.listView_Drives.Columns.Add("Dock", 60, HorizontalAlignment.Center); |
this.listView_Drives.Columns.Add("Time", 130, HorizontalAlignment.Center); |
this.listView_Drives.Columns.Add("Drive", 40, HorizontalAlignment.Center); |
this.listView_Drives.Columns.Add("Label", 109, HorizontalAlignment.Center); |
this.listView_Drives.Columns.Add("Size", 60, HorizontalAlignment.Center); |
// Initializes and starts a backgroundworker thread for monitoring for new drives |
BackgroundWorker bgWorker = new BackgroundWorker(); |
instanceAlreadyRunning = true; |
bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); |
bgWorker.RunWorkerAsync(); |
} |
void bgWorker_DoWork(object sender, DoWorkEventArgs e) |
{ |
// Compares a list of drives detected previously with the a list of current |
// drives on the computer. If a change in length is detected, a drive is either |
// added or removed so the drive in question is found and operated upon |
List<string> drivesPreviouslyDetected = new List<string>(); |
DriveInfo[] newlyDetectedDrives = DriveInfo.GetDrives(); |
// Resets both lists to hold the same drives |
foreach (DriveInfo drive in newlyDetectedDrives) |
drivesPreviouslyDetected.Add(drive.Name); |
while (true) |
{ |
// Pulls list of new drives |
newlyDetectedDrives = DriveInfo.GetDrives(); |
if (newlyDetectedDrives.Length > drivesPreviouslyDetected.Count) |
{ |
// Applies if a drive is attached to the computer |
// Goes through each list and finds the drive that was recently attached |
bool attachedDriveExisted = false; |
bool newDrivesDetected = false; |
string driveOwner = ""; |
string driveDock = ""; |
foreach (DriveInfo drive in newlyDetectedDrives) |
{ |
attachedDriveExisted = false; |
// Loop here checks for non-matching entries in the two lists |
foreach (string str in drivesPreviouslyDetected) |
{ |
// If entries match, drive is unchanged |
if (str == drive.Name) |
{ |
attachedDriveExisted = true; |
break; |
} |
} |
// If list mismatch is detected, adds new entry to driveEntryList |
if (attachedDriveExisted == false) |
{ |
// Creates and populates a new DriveEntry |
DriveEntry newEntry = new DriveEntry(); |
if (newDrivesDetected == false) |
{ |
// First entry detected is prompted for dock label and owner name |
newDrivesDetected = true; |
DriveLogger_LabelPrompt_Form newPrompt = new DriveLogger_LabelPrompt_Form(); |
newPrompt.ShowDialog(); |
newEntry.owner = newPrompt.driveOwner; |
driveOwner = newPrompt.driveOwner; |
newEntry.dock = newPrompt.driveDock; |
driveDock = newPrompt.driveDock; |
} |
else |
{ |
// Subsequent entries use the previously entered dock label and owner |
newDrivesDetected = true; |
newEntry.owner = driveOwner; |
newEntry.dock = driveDock; |
} |
// Sets other drive details for the drive |
newEntry.time = DateTime.Now; |
newEntry.drive = drive.Name; |
DriveInfo tempDrive = null; |
DriveInfo[] allDrives = DriveInfo.GetDrives(); |
foreach (DriveInfo driveSearch in allDrives) |
{ |
if (driveSearch.IsReady) |
{ |
if (driveSearch.Name == newEntry.drive) |
{ |
tempDrive = driveSearch; |
break; |
} |
} |
} |
newEntry.label = tempDrive.VolumeLabel; |
// Determines the size of the attached drive |
if ((tempDrive.TotalSize / 1073741824) > 0) |
newEntry.size = (tempDrive.TotalSize / 1073741824).ToString() + " GB"; |
else |
newEntry.size = (tempDrive.TotalSize / 1048576).ToString() + " MB"; |
// Adds the new DriveEntry into driveList |
driveEntryList.Add(newEntry); |
using (StreamWriter sw = File.AppendText(logLocation)) |
{ |
sw.WriteLine("Drive Attached -- [" + newEntry.time.ToString() + "]\t\"" + newEntry.owner + "\"\t" + newEntry.drive + "\t\"" + newEntry.label + "\"\t" + newEntry.size); |
} |
paintDriveListbox(); |
} |
} |
// Clears and refreshes the drivesPreviouslyDetected list |
drivesPreviouslyDetected.Clear(); |
foreach (DriveInfo drive in newlyDetectedDrives) |
{ |
drivesPreviouslyDetected.Add(drive.Name); |
} |
} |
else if (newlyDetectedDrives.Length < drivesPreviouslyDetected.Count) |
{ |
// Applies if a drive is removed to the computer |
// Goes through each list and finds the drive that was recently removed |
bool removedDriveFound = false; |
foreach (string str in drivesPreviouslyDetected) |
{ |
removedDriveFound = false; |
// Loop here checks for non-matching entries in the two lists |
foreach (DriveInfo drive in newlyDetectedDrives) |
{ |
// If entries match, drive was not removed |
if (str == drive.Name) |
{ |
removedDriveFound = true; |
break; |
} |
} |
// If list mismatch is detected, remove from driveEntryList |
if (removedDriveFound == false) |
{ |
// Removes drive from driveList |
foreach (DriveEntry entry in driveEntryList) |
{ |
if (str == entry.drive) |
{ |
driveEntryList.Remove(entry); |
// Log the removal of the drive |
using (StreamWriter sw = File.AppendText(logLocation)) |
{ |
sw.WriteLine("Drive Removed -- [" + entry.time.ToString() + "]\t" + entry.drive + "\t\"" + entry.label + "\"\t" + entry.size); |
} |
break; |
} |
} |
paintDriveListbox(); |
} |
} |
// Clears and refreshes the drivesPreviouslyDetected list |
drivesPreviouslyDetected.Clear(); |
foreach (DriveInfo drive in newlyDetectedDrives) |
{ |
drivesPreviouslyDetected.Add(drive.Name); |
} |
} |
else |
{ |
// Sets the two lists to hold the same drives |
drivesPreviouslyDetected.Clear(); |
foreach (DriveInfo drive in newlyDetectedDrives) |
{ |
drivesPreviouslyDetected.Add(drive.Name); |
} |
} |
// Sleeps the thread for a specified amount of time |
Thread.Sleep(Settings_Form.driveLoggerRefreshInterval); |
} |
} |
void DriveLogger_Form_KeyDown(object sender, KeyEventArgs e) |
{ |
// Monitors for keypresses for the about box and refresh |
switch (e.KeyCode) |
{ |
case Keys.OemQuestion: |
AboutBox window = new AboutBox(); |
window.ShowDialog(); |
break; |
case Keys.F5: |
refreshDrives(); |
break; |
} |
} |
void listView_Drives_AfterLabelEdit(object sender, LabelEditEventArgs e) |
{ |
// Logs the new label if it is changed |
if (e.Label != null) |
{ |
using (StreamWriter sw = File.AppendText(logLocation)) |
{ |
ListViewItem entry = listView_Drives.Items[e.Item]; |
sw.WriteLine("Label \"" + e.Label + "\" added to drive " + entry.SubItems[3].Text); |
} |
} |
} |
void DriveLogger_Form_FormClosed(object sender, FormClosedEventArgs e) |
{ |
// Resets variable so form can be opened again |
instanceAlreadyRunning = false; |
} |
private void paintDriveListbox() |
{ |
// Updates the listview |
this.listView_Drives.BeginUpdate(); |
this.listView_Drives.Items.Clear(); |
// Adds each entry from the driveList into the listView |
foreach (DriveEntry entry in driveEntryList) |
{ |
if (entry.owner != "System Reserved") |
{ |
ListViewItem item = new ListViewItem(); |
item.Text = entry.owner; |
ListViewItem.ListViewSubItem subDock = new ListViewItem.ListViewSubItem(); |
subDock.Text = entry.dock; |
item.SubItems.Add(subDock); |
ListViewItem.ListViewSubItem subTime = new ListViewItem.ListViewSubItem(); |
subTime.Text = entry.time.ToString(); |
item.SubItems.Add(subTime); |
ListViewItem.ListViewSubItem subDrive = new ListViewItem.ListViewSubItem(); |
subDrive.Text = entry.drive; |
item.SubItems.Add(subDrive); |
ListViewItem.ListViewSubItem subLabel = new ListViewItem.ListViewSubItem(); |
subLabel.Text = entry.label; |
item.SubItems.Add(subLabel); |
ListViewItem.ListViewSubItem subSize = new ListViewItem.ListViewSubItem(); |
subSize.Text = entry.size; |
item.SubItems.Add(subSize); |
this.listView_Drives.Items.Add(item); |
} |
} |
this.listView_Drives.EndUpdate(); |
} |
private void refreshDrives() |
{ |
// Checks list of drive entries to see if any drives have been removed |
bool removedDriveFound; |
List<DriveEntry> drivesToRemove = new List<DriveEntry>(); |
// Checks each entry in driveList to see if matching drive is found on list |
// of current drives. Removes entry from driveList if drive is not found. |
DriveInfo[] currentDrives = DriveInfo.GetDrives(); |
for (int i = 0; i < driveEntryList.Count; i++) |
{ |
DriveEntry storedDrive = driveEntryList[i]; |
removedDriveFound = false; |
// Loop here checks for non-matching entries in the two lists |
foreach (DriveInfo currentDrive in currentDrives) |
{ |
// If entries match, drive was not removed |
if (storedDrive.drive == currentDrive.Name) |
{ |
removedDriveFound = true; |
break; |
} |
} |
// If list mismatch is detected, remove from driveList |
if (removedDriveFound == false) |
{ |
drivesToRemove.Add(storedDrive); |
} |
} |
// Removes drive from driveList |
foreach (DriveEntry entry in drivesToRemove) |
{ |
// Removes drive from driveList |
foreach (DriveEntry entry2 in driveEntryList) |
{ |
if (entry.drive == entry2.drive) |
{ |
driveEntryList.Remove(entry); |
break; |
} |
} |
} |
paintDriveListbox(); |
} |
} |
} |
/SWAT Office App/trunk/SWAT Office App/DriveLogger_Form.resx |
---|
0,0 → 1,120 |
<?xml version="1.0" encoding="utf-8"?> |
<root> |
<!-- |
Microsoft ResX Schema |
Version 2.0 |
The primary goals of this format is to allow a simple XML format |
that is mostly human readable. The generation and parsing of the |
various data types are done through the TypeConverter classes |
associated with the data types. |
Example: |
... ado.net/XML headers & schema ... |
<resheader name="resmimetype">text/microsoft-resx</resheader> |
<resheader name="version">2.0</resheader> |
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
<value>[base64 mime encoded serialized .NET Framework object]</value> |
</data> |
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
<comment>This is a comment</comment> |
</data> |
There are any number of "resheader" rows that contain simple |
name/value pairs. |
Each data row contains a name, and value. The row also contains a |
type or mimetype. Type corresponds to a .NET class that support |
text/value conversion through the TypeConverter architecture. |
Classes that don't support this are serialized and stored with the |
mimetype set. |
The mimetype is used for serialized objects, and tells the |
ResXResourceReader how to depersist the object. This is currently not |
extensible. For a given mimetype the value must be set accordingly: |
Note - application/x-microsoft.net.object.binary.base64 is the format |
that the ResXResourceWriter will generate, however the reader can |
read any of the formats listed below. |
mimetype: application/x-microsoft.net.object.binary.base64 |
value : The object must be serialized with |
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
: and then encoded with base64 encoding. |
mimetype: application/x-microsoft.net.object.soap.base64 |
value : The object must be serialized with |
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
: and then encoded with base64 encoding. |
mimetype: application/x-microsoft.net.object.bytearray.base64 |
value : The object must be serialized into a byte array |
: using a System.ComponentModel.TypeConverter |
: and then encoded with base64 encoding. |
--> |
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
<xsd:element name="root" msdata:IsDataSet="true"> |
<xsd:complexType> |
<xsd:choice maxOccurs="unbounded"> |
<xsd:element name="metadata"> |
<xsd:complexType> |
<xsd:sequence> |
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
</xsd:sequence> |
<xsd:attribute name="name" use="required" type="xsd:string" /> |
<xsd:attribute name="type" type="xsd:string" /> |
<xsd:attribute name="mimetype" type="xsd:string" /> |
<xsd:attribute ref="xml:space" /> |
</xsd:complexType> |
</xsd:element> |
<xsd:element name="assembly"> |
<xsd:complexType> |
<xsd:attribute name="alias" type="xsd:string" /> |
<xsd:attribute name="name" type="xsd:string" /> |
</xsd:complexType> |
</xsd:element> |
<xsd:element name="data"> |
<xsd:complexType> |
<xsd:sequence> |
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
</xsd:sequence> |
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
<xsd:attribute ref="xml:space" /> |
</xsd:complexType> |
</xsd:element> |
<xsd:element name="resheader"> |
<xsd:complexType> |
<xsd:sequence> |
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
</xsd:sequence> |
<xsd:attribute name="name" type="xsd:string" use="required" /> |
</xsd:complexType> |
</xsd:element> |
</xsd:choice> |
</xsd:complexType> |
</xsd:element> |
</xsd:schema> |
<resheader name="resmimetype"> |
<value>text/microsoft-resx</value> |
</resheader> |
<resheader name="version"> |
<value>2.0</value> |
</resheader> |
<resheader name="reader"> |
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
</resheader> |
<resheader name="writer"> |
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
</resheader> |
</root> |
/SWAT Office App/trunk/SWAT Office App/DriveLogger_LabelPrompt_Form.Designer.cs |
---|
0,0 → 1,92 |
namespace SWAT_Office_App |
{ |
partial class DriveLogger_LabelPrompt_Form |
{ |
/// <summary> |
/// Required designer variable. |
/// </summary> |
private System.ComponentModel.IContainer components = null; |
/// <summary> |
/// Clean up any resources being used. |
/// </summary> |
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
protected override void Dispose(bool disposing) |
{ |
if (disposing && (components != null)) |
{ |
components.Dispose(); |
} |
base.Dispose(disposing); |
} |
#region Windows Form Designer generated code |
/// <summary> |
/// Required method for Designer support - do not modify |
/// the contents of this method with the code editor. |
/// </summary> |
private void InitializeComponent() |
{ |
this.btn_Ok = new System.Windows.Forms.Button(); |
this.txt_Owner = new System.Windows.Forms.TextBox(); |
this.groupBox_Dock = new System.Windows.Forms.GroupBox(); |
this.SuspendLayout(); |
// |
// btn_Ok |
// |
this.btn_Ok.Anchor = System.Windows.Forms.AnchorStyles.Bottom; |
this.btn_Ok.Location = new System.Drawing.Point(34, 63); |
this.btn_Ok.Name = "btn_Ok"; |
this.btn_Ok.Size = new System.Drawing.Size(75, 23); |
this.btn_Ok.TabIndex = 3; |
this.btn_Ok.Text = "Ok"; |
this.btn_Ok.UseVisualStyleBackColor = true; |
this.btn_Ok.Click += new System.EventHandler(this.btn_Ok_Click); |
// |
// txt_Owner |
// |
this.txt_Owner.Anchor = System.Windows.Forms.AnchorStyles.Bottom; |
this.txt_Owner.Location = new System.Drawing.Point(12, 37); |
this.txt_Owner.Name = "txt_Owner"; |
this.txt_Owner.Size = new System.Drawing.Size(118, 20); |
this.txt_Owner.TabIndex = 2; |
// |
// groupBox_Dock |
// |
this.groupBox_Dock.Location = new System.Drawing.Point(12, 12); |
this.groupBox_Dock.Name = "groupBox_Dock"; |
this.groupBox_Dock.Size = new System.Drawing.Size(118, 19); |
this.groupBox_Dock.TabIndex = 1; |
this.groupBox_Dock.TabStop = false; |
this.groupBox_Dock.Text = "Select Dock"; |
// |
// DriveLogger_LabelPrompt_Form |
// |
this.AcceptButton = this.btn_Ok; |
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
this.ClientSize = new System.Drawing.Size(142, 98); |
this.ControlBox = false; |
this.Controls.Add(this.groupBox_Dock); |
this.Controls.Add(this.txt_Owner); |
this.Controls.Add(this.btn_Ok); |
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; |
this.MaximizeBox = false; |
this.Name = "DriveLogger_LabelPrompt_Form"; |
this.ShowInTaskbar = false; |
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; |
this.Text = "Enter Owner\'s Name"; |
this.TopMost = true; |
this.ResumeLayout(false); |
this.PerformLayout(); |
} |
#endregion |
private System.Windows.Forms.Button btn_Ok; |
private System.Windows.Forms.TextBox txt_Owner; |
private System.Windows.Forms.GroupBox groupBox_Dock; |
} |
} |
/SWAT Office App/trunk/SWAT Office App/DriveLogger_LabelPrompt_Form.cs |
---|
0,0 → 1,66 |
using System; |
using System.Collections.Generic; |
using System.ComponentModel; |
using System.Data; |
using System.Drawing; |
using System.Linq; |
using System.Text; |
using System.Windows.Forms; |
namespace SWAT_Office_App |
{ |
public partial class DriveLogger_LabelPrompt_Form : Form |
{ |
// Default values to return on query |
public string driveOwner = "Unknown"; |
public string driveDock = "Unspecified"; |
// RadioButton list for holding list of docks as specified in settings.xml |
private List<RadioButton> rdoBtnList= new List<RadioButton>(); |
public DriveLogger_LabelPrompt_Form() |
{ |
InitializeComponent(); |
this.KeyPreview = true; |
this.btn_Ok.Enabled = false; |
// Location markers for the next radiobutton plcaement |
int nextXLocation = 6, nextYLocation = 19; |
// Sets groupbox and window size depending on number of radiobuttons |
this.groupBox_Dock.Size = new Size(118, 19 + (Settings_Form.driveLoggerDockLabels.Count) * 23); |
this.Size = new Size(148, 126 + (Settings_Form.driveLoggerDockLabels.Count) * 23); |
// Adds a radiobutton for each dock |
foreach (string str in Settings_Form.driveLoggerDockLabels) |
{ |
RadioButton newRdoBtn = new RadioButton(); |
newRdoBtn.Name = "rdo_" + str; |
newRdoBtn.TabStop = true; |
newRdoBtn.AutoSize = true; |
newRdoBtn.Text = str; |
newRdoBtn.Location = new Point(nextXLocation, nextYLocation); |
nextYLocation += 23; |
// Adds the radiobutton to the groupbox and rdoBtnList |
groupBox_Dock.Controls.Add(newRdoBtn); |
rdoBtnList.Add(newRdoBtn); |
} |
this.txt_Owner.TextChanged += new EventHandler(txt_Owner_TextChanged); |
} |
void txt_Owner_TextChanged(object sender, EventArgs e) |
{ |
// Enables the Ok button if text is entered |
if (txt_Owner.TextLength > 0) |
this.btn_Ok.Enabled = true; |
else |
this.btn_Ok.Enabled = false; |
} |
private void btn_Ok_Click(object sender, EventArgs e) |
{ |
// Updates variables and closes form |
driveOwner = txt_Owner.Text; |
foreach (RadioButton btn in rdoBtnList) |
{ |
if (btn.Checked) |
driveDock = btn.Text; |
} |
this.Close(); |
} |
} |
} |
/SWAT Office App/trunk/SWAT Office App/DriveLogger_LabelPrompt_Form.resx |
---|
0,0 → 1,120 |
<?xml version="1.0" encoding="utf-8"?> |
<root> |
<!-- |
Microsoft ResX Schema |
Version 2.0 |
The primary goals of this format is to allow a simple XML format |
that is mostly human readable. The generation and parsing of the |
various data types are done through the TypeConverter classes |
associated with the data types. |
Example: |
... ado.net/XML headers & schema ... |
<resheader name="resmimetype">text/microsoft-resx</resheader> |
<resheader name="version">2.0</resheader> |
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
<value>[base64 mime encoded serialized .NET Framework object]</value> |
</data> |
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
<comment>This is a comment</comment> |
</data> |
There are any number of "resheader" rows that contain simple |
name/value pairs. |
Each data row contains a name, and value. The row also contains a |
type or mimetype. Type corresponds to a .NET class that support |
text/value conversion through the TypeConverter architecture. |
Classes that don't support this are serialized and stored with the |
mimetype set. |
The mimetype is used for serialized objects, and tells the |
ResXResourceReader how to depersist the object. This is currently not |
extensible. For a given mimetype the value must be set accordingly: |
Note - application/x-microsoft.net.object.binary.base64 is the format |
that the ResXResourceWriter will generate, however the reader can |
read any of the formats listed below. |
mimetype: application/x-microsoft.net.object.binary.base64 |
value : The object must be serialized with |
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
: and then encoded with base64 encoding. |
mimetype: application/x-microsoft.net.object.soap.base64 |
value : The object must be serialized with |
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
: and then encoded with base64 encoding. |
mimetype: application/x-microsoft.net.object.bytearray.base64 |
value : The object must be serialized into a byte array |
: using a System.ComponentModel.TypeConverter |
: and then encoded with base64 encoding. |
--> |
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
<xsd:element name="root" msdata:IsDataSet="true"> |
<xsd:complexType> |
<xsd:choice maxOccurs="unbounded"> |
<xsd:element name="metadata"> |
<xsd:complexType> |
<xsd:sequence> |
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
</xsd:sequence> |
<xsd:attribute name="name" use="required" type="xsd:string" /> |
<xsd:attribute name="type" type="xsd:string" /> |
<xsd:attribute name="mimetype" type="xsd:string" /> |
<xsd:attribute ref="xml:space" /> |
</xsd:complexType> |
</xsd:element> |
<xsd:element name="assembly"> |
<xsd:complexType> |
<xsd:attribute name="alias" type="xsd:string" /> |
<xsd:attribute name="name" type="xsd:string" /> |
</xsd:complexType> |
</xsd:element> |
<xsd:element name="data"> |
<xsd:complexType> |
<xsd:sequence> |
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
</xsd:sequence> |
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
<xsd:attribute ref="xml:space" /> |
</xsd:complexType> |
</xsd:element> |
<xsd:element name="resheader"> |
<xsd:complexType> |
<xsd:sequence> |
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
</xsd:sequence> |
<xsd:attribute name="name" type="xsd:string" use="required" /> |
</xsd:complexType> |
</xsd:element> |
</xsd:choice> |
</xsd:complexType> |
</xsd:element> |
</xsd:schema> |
<resheader name="resmimetype"> |
<value>text/microsoft-resx</value> |
</resheader> |
<resheader name="version"> |
<value>2.0</value> |
</resheader> |
<resheader name="reader"> |
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
</resheader> |
<resheader name="writer"> |
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
</resheader> |
</root> |