399 lines
41 KiB
HTML
399 lines
41 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>Add File Example (C#)</title>
|
|
<meta http-equiv="Content-Language" content="en-us">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
|
<link rel="stylesheet" type="text/css" href="ApiHelp.css">
|
|
</head>
|
|
<meta name=MS-HKWD content="C# examples,files">
|
|
|
|
<body>
|
|
<h1><span style="font-weight: normal; font-size: 7.5pt;">SOLIDWORKS PDM Professional API Help</span></h1>
|
|
<h1>Add File Example (C#)</h1>
|
|
<p>This example shows how to add a file outside the vault to the vault root.</p>
|
|
<p><b>NOTE</b>: If using the primary interop assembly
|
|
provided with SOLIDWORKS PDM Professional, see
|
|
<a href="Using_NET_Framework_in_Applications.htm">Using .NET Framework 4.0 in
|
|
Stand-alone Applications</a>.</p>
|
|
<p><img border="0" src="AddFile.gif" width="333" height="253"></p>
|
|
<pre style="font-family: Courier New; font-size: 13; color: black; background: white"><span style="color: green">//----------------------------------------------------------------------------</span>
|
|
<span style="color: green">// Preconditions:</span>
|
|
<span style="color: green">// 1. Start Microsoft Visual Studio.</span>
|
|
<span style="color: green">// a. Click <b>File > New > Project > Visual C# > Windows Forms Application</b>.</span>
|
|
<span style="color: green">// b. Type <b>AddFiles</b> in <b>Name</b>.</span>
|
|
<span style="color: green">// c. Click <b>Browse</b> and navigate to the folder where to create </span>
|
|
<span style="color: green">// the project.</span>
|
|
<span style="color: green">// d. Click <b>OK</b>. </span>
|
|
<span style="color: green">// e. Click <b>Show All Files</b> in the Solution Explorer toolbar and expand </span>
|
|
<span style="color: green">// <b>Form1.cs</b> in the Solution Explorer.</span>
|
|
<span style="color: green">// f. Replace the code in <b>Form1.cs</b> with <a href="#Form1">this code</a>.</span>
|
|
<span style="color: green">// g. To create the form, replace the code in <b>Form1.Designer.cs</b> with <a href="#Form1Designer">this code</a>.</span>
|
|
<span style="color: green">// 2. Add <b>EPDM.Interop.epdm.dll</b> as a reference (right-click the project</span>
|
|
<span style="color: green">// name in the Solution Explorer, click <b>Add Reference</b>, click </span>
|
|
<span style="color: green">// <b>Assemblies > Framework </b>in the left-side panel, browse to the top folder of </span>
|
|
<span style="color: green">// your SOLIDWORKS PDM Professional installation, locate and click </span>
|
|
<span style="color: green">// <b>EPDM.Interop.epdm.dll</b>, click <b>Open</b>, and click <b>Add</b>).</span>
|
|
<span style="color: green">// 3. Add <b>EPDM.Interop.EPDMResultCode.dll</b> as a reference (click <b>Browse</b>, locate and </span>
|
|
<span style="color: green">// click E<b>PDM.Interop.EPDMResultCode.dll</b>, click <b>Open</b>, click <b>Add</b>, and click <b>Close</b>).</span>
|
|
<span style="color: green">// 4. Right-click <b>EPDM.Interop.epdm </b>in References, click <b>Properties</b>, and set </span>
|
|
<span style="color: green">// <b>Embed Interop Types</b> to <b>False</b> to handle methods that pass arrays of </span>
|
|
<span style="color: green">// structures.</span>
|
|
<span style="color: green">// 5. Run the Administration tool, log in as admin, expand the vault, </span>
|
|
<span style="color: green">// right-click <b>File Types</b>, click <b>Duplicate file name settings</b>, and </span>
|
|
<span style="color: green">// click <b>Do not allow duplicate files names in this file vault</b>.
|
|
// 6 Ensure that at least one file exists in a subfolder in the vault and
|
|
// the same-named file exists outside the vault. </span>
|
|
<span style="color: green">// 7. Click <b>Debug > Start Debugging</b> or press F5.</span>
|
|
<span style="color: green">//</span>
|
|
<span style="color: green">// Postconditions: </span>
|
|
<span style="color: green">// 1. Displays the Add file to vault root dialog box.</span>
|
|
<span style="color: green">// a. Select a vault view.</span>
|
|
<span style="color: green">// b. Click <b>Browse to a file outside the vault</b>. </span>
|
|
<span style="color: green">// 1. Locate a file outside the vault that exists in </span>
|
|
<span style="color: green">// a subfolder in the vault.</span>
|
|
<span style="color: green">// 2. Click <b>Open</b>.</span>
|
|
<span style="color: green">// c. Click <b>Add file to vault root</b> to add the selected file to the </span>
|
|
<span style="color: green">// root folder of the vault.</span>
|
|
<span style="color: green">// d. Displays a message box warning you that the selected file is not </span>
|
|
<span style="color: green">// unique in the vault, but that the file will be added to the vault root.
|
|
// e. Click <b>OK</b>.</span>
|
|
<span style="color: green">// 2. Close the Add file to vault root dialog box. </span>
|
|
<span style="color: green">// 3. Examine the vault root.</span>
|
|
<span style="color: green">//----------------------------------------------------------------------------</span></pre>
|
|
<pre style="font-family: Courier New; font-size: 13; color: black; background: white"><span style="color: #008000"><a name="Form1"></a>//Form1.cs</span>
|
|
<span style="color: blue">using</span> System;
|
|
<span style="color: blue">using</span> System.Collections.Generic;
|
|
<span style="color: blue">using</span> System.ComponentModel;
|
|
<span style="color: blue">using</span> System.Data;
|
|
<span style="color: blue">using</span> System.Drawing;
|
|
<span style="color: blue">using</span> System.Linq;
|
|
<span style="color: blue">using</span> System.Text;
|
|
<span style="color: blue">using</span> System.Windows.Forms;
|
|
<span style="color: blue">using</span> EPDM.Interop.epdm;
|
|
<span style="color: blue">using</span> EPDM.Interop.EPDMResultCode;
|
|
|
|
|
|
|
|
<span style="color: blue">namespace</span> AddFiles_CSharp
|
|
{
|
|
<span style="color: blue">public</span> <span style="color: blue">partial</span> <span style="color: blue">class</span> <span style="color: #2b91af">Form1</span> : <span style="color: #2b91af">Form</span>, <span style="color: #2b91af">IEdmCallback6</span>
|
|
{
|
|
<span style="color: blue">public</span> Form1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
<span style="color: blue">private</span> <span style="color: #2b91af">IEdmVault5</span> vault1 = <span style="color: blue">null</span>;
|
|
|
|
<span style="color: blue">public</span> <span style="color: blue">void</span> Form1_Load(System.<span style="color: #2b91af">Object</span> sender, System.<span style="color: #2b91af">EventArgs</span> e)
|
|
{
|
|
<span style="color: blue">try</span>
|
|
{
|
|
<span style="color: #2b91af">IEdmVault5</span> vault1 = <span style="color: blue">new</span> <span style="color: #2b91af">EdmVault5</span>();
|
|
<span style="color: #2b91af">IEdmVault8</span> vault = (<span style="color: #2b91af">IEdmVault8</span>)vault1;
|
|
<span style="color: #2b91af">EdmViewInfo</span>[] Views = <span style="color: blue">null</span>;
|
|
|
|
vault.<b>GetVaultViews</b>(<span style="color: blue">out</span> Views, <span style="color: blue">false</span>);
|
|
VaultsComboBox.Items.Clear();
|
|
<span style="color: blue">foreach</span> (<span style="color: #2b91af">EdmViewInfo</span> View <span style="color: blue">in</span> Views)
|
|
{
|
|
VaultsComboBox.Items.Add(View.<b>mbsVaultName</b>);
|
|
}
|
|
<span style="color: blue">if</span> (VaultsComboBox.Items.Count > 0)
|
|
{
|
|
VaultsComboBox.Text = (<span style="color: blue">string</span>)VaultsComboBox.Items[0];
|
|
}
|
|
}
|
|
<span style="color: blue">catch</span> (System.Runtime.InteropServices.<span style="color: #2b91af">COMException</span> ex)
|
|
{
|
|
<span style="color: #2b91af">MessageBox</span>.Show(<span style="color: #a31515">"HRESULT = 0x"</span> + ex.ErrorCode.ToString(<span style="color: #a31515">"X"</span>) + <span style="color: #a31515">"\n"</span> + ex.Message);
|
|
}
|
|
<span style="color: blue">catch</span> (<span style="color: #2b91af">Exception</span> ex)
|
|
{
|
|
<span style="color: #2b91af">MessageBox</span>.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
<span style="color: blue">public</span> <span style="color: blue">void</span> BrowseButton_Click(System.<span style="color: #2b91af">Object</span> sender, System.<span style="color: #2b91af">EventArgs</span> e)
|
|
{
|
|
<span style="color: blue">try</span>
|
|
{
|
|
ListBox.Items.Clear();
|
|
|
|
<span style="color: blue">if</span> (vault1 == <span style="color: blue">null</span>)
|
|
{
|
|
vault1 = <span style="color: blue">new</span> <span style="color: #2b91af">EdmVault5</span>();
|
|
}
|
|
<span style="color: blue">if</span> (!vault1.<b>IsLoggedIn</b>)
|
|
{
|
|
<span style="color: green">//Log into selected vault as the current user</span>
|
|
vault1.<b>LoginAuto</b>(VaultsComboBox.Text, <span style="color: blue">this</span>.Handle.ToInt32());
|
|
}
|
|
|
|
<span style="color: green">//Set the initial directory in the Open dialog</span>
|
|
OpenFileDialog.InitialDirectory = vault1.<b>RootFolderPath</b>;
|
|
<span style="color: green">//Show the Open dialog</span>
|
|
System.Windows.Forms.<span style="color: #2b91af">DialogResult</span> DialogResult;
|
|
DialogResult = OpenFileDialog.ShowDialog();
|
|
<span style="color: green">//If the user didn't click Open, exit</span>
|
|
<span style="color: blue">if</span> (!(DialogResult == System.Windows.Forms.<span style="color: #2b91af">DialogResult</span>.OK))
|
|
{
|
|
<span style="color: blue">return</span>;
|
|
}
|
|
|
|
<span style="color: blue">foreach</span> (<span style="color: blue">string</span> FileName <span style="color: blue">in</span> OpenFileDialog.FileNames)
|
|
{
|
|
ListBox.Items.Add(FileName);
|
|
}
|
|
}
|
|
<span style="color: blue">catch</span> (System.Runtime.InteropServices.<span style="color: #2b91af">COMException</span> ex)
|
|
{
|
|
<span style="color: #2b91af">MessageBox</span>.Show(<span style="color: #a31515">"HRESULT = 0x"</span> + ex.ErrorCode.ToString(<span style="color: #a31515">"X"</span>) + <span style="color: #a31515">" "</span> + ex.Message);
|
|
}
|
|
<span style="color: blue">catch</span> (<span style="color: #2b91af">Exception</span> ex)
|
|
{
|
|
<span style="color: #2b91af">MessageBox</span>.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
<span style="color: blue">public</span> <span style="color: blue">void</span> AddFiles_Click(System.<span style="color: #2b91af">Object</span> sender, System.<span style="color: #2b91af">EventArgs</span> e)
|
|
{
|
|
|
|
<span style="color: blue">try</span> {
|
|
<span style="color: #2b91af">IEdmVault7</span> vault2 = <span style="color: blue">null</span>;
|
|
<span style="color: blue">if</span> (vault1 == <span style="color: blue">null</span>) {
|
|
vault1 = <span style="color: blue">new</span> <span style="color: #2b91af">EdmVault5</span>();
|
|
}
|
|
vault2 = (<span style="color: #2b91af">IEdmVault7</span>)vault1;
|
|
<span style="color: blue">if</span> (!vault1.<b>IsLoggedIn</b>) {
|
|
<span style="color: green">//Log into selected vault as the current user</span>
|
|
vault1.<b>LoginAuto</b>(VaultsComboBox.Text, <span style="color: blue">this</span>.Handle.ToInt32());
|
|
}
|
|
|
|
<span style="color: blue">if</span> (!(ListBox.Items.Count == 1)) {
|
|
<span style="color: #2b91af">MessageBox</span>.Show(<span style="color: #a31515">"Please browse to a file outside the vault."</span>);
|
|
<span style="color: blue">return</span>;
|
|
}
|
|
|
|
|
|
<span style="color: green">// Add selected file to the root folder of the vault</span>
|
|
<span style="color: #2b91af">IEdmFolder8</span> Folder = <span style="color: blue">default</span>(<span style="color: #2b91af">IEdmFolder8</span>);
|
|
Folder = (<span style="color: #2b91af">IEdmFolder8</span>)vault2.RootFolder;
|
|
|
|
<span style="color: #2b91af">EdmAddFileInfo</span>[] Files = <span style="color: blue">new</span> <span style="color: #2b91af">EdmAddFileInfo</span>[1];
|
|
|
|
<span style="color: blue">string</span>[] FileNames = <span style="color: blue">new</span> <span style="color: blue">string</span>[1];
|
|
<span style="color: blue">int</span> Index = 0;
|
|
<span style="color: blue">string</span> fileStr = <span style="color: #a31515">""</span>;
|
|
<span style="color: blue">foreach</span> ( <span style="color: #2b91af">Object</span> FileName_loopVariable <span style="color: blue">in</span> ListBox.Items) {
|
|
fileStr = FileName_loopVariable.ToString();
|
|
FileNames[Index] = fileStr.Substring(fileStr.LastIndexOf(<span style="color: #a31515">"\\"</span>));
|
|
Index = Index + 1;
|
|
}
|
|
|
|
<span style="color: blue">string</span> Path = <span style="color: #a31515">""</span>;
|
|
<span style="color: blue">int</span> addFileStatus;
|
|
Index = 0;
|
|
<span style="color: blue">foreach</span> (<span style="color: #2b91af">Object</span> FileName_loopVariable <span style="color: blue">in</span> ListBox.Items) {
|
|
Path = FileName_loopVariable.ToString();
|
|
Files[Index].<b>mbsPath</b> = Path;
|
|
Files[Index].<b>mlEdmAddFlags</b> = (<span style="color: blue">int</span>)<span style="color: #2b91af">EdmAddFlag</span>.EdmAdd_Simple;
|
|
Files[Index].<b>mlFileID</b> = 0;
|
|
Files[Index].<b>mlSrcDocumentID</b> = 0;
|
|
Files[Index].<b>mlSrcProjectID</b> = 0;
|
|
Files[Index].<b>mbsNewName</b> = <span style="color: #a31515">""</span>;
|
|
Folder.<b>AddFile2</b>(<span style="color: blue">this</span>.Handle.ToInt32(), Files[Index].<b>mbsPath</b>, <span style="color: blue">out</span> addFileStatus, <span style="color: #a31515">""</span>, Files[Index].<b>mlEdmAddFlags</b>);
|
|
<span style="color: blue">switch</span> (addFileStatus)
|
|
{
|
|
<span style="color: blue">case</span> (<span style="color: blue">int</span>)<span style="color: #2b91af">EdmResultSuccessCodes_e</span>.S_EDM_FILES_NOT_UNIQUE_GLOBALLY:
|
|
<span style="color: #2b91af">MessageBox</span>.Show(<span style="color: #a31515">"WARNING: File is not unique in the vault, but the file will be added to the vault root."</span>);
|
|
<span style="color: blue">break</span>;
|
|
<span style="color: blue">case</span> 0:
|
|
<span style="color: #2b91af">MessageBox</span>.Show(<span style="color: #a31515">"SUCCESS: File will be added to the vault root."</span>);
|
|
<span style="color: blue">break</span>;
|
|
}
|
|
Index = Index + 1;
|
|
}
|
|
|
|
|
|
|
|
} <span style="color: blue">catch</span> (System.Runtime.InteropServices.<span style="color: #2b91af">COMException</span> ex) {
|
|
<span style="color: #2b91af">MessageBox</span>.Show(<span style="color: #a31515">"HRESULT = 0x"</span> + ex.ErrorCode.ToString(<span style="color: #a31515">"X"</span>) + <span style="color: #a31515">"\n"</span> + ex.Message);
|
|
} <span style="color: blue">catch</span> (<span style="color: #2b91af">Exception</span> ex) {
|
|
<span style="color: #2b91af">MessageBox</span>.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
<span style="color: blue">private</span> <span style="color: #2b91af">EdmMBoxResult</span> IEdmCallback6_MsgBox(<span style="color: blue">int</span> lParentWnd, <span style="color: blue">int</span> lMsgID, <span style="color: blue">string</span> bsMsg, <span style="color: #2b91af">EdmMBoxType</span> eType = 0L)
|
|
{
|
|
<span style="color: #2b91af">MessageBox</span>.Show(bsMsg);
|
|
<span style="color: blue">return</span> <span style="color: #2b91af">EdmMBoxResult</span>.EdmMbr_OK;
|
|
}
|
|
<span style="color: #2b91af">EdmMBoxResult</span> <span style="color: #2b91af">IEdmCallback6</span>.<b>MsgBox</b>(<span style="color: blue">int</span> lParentWnd, <span style="color: blue">int</span> lMsgID, <span style="color: blue">string</span> bsMsg, <span style="color: #2b91af">EdmMBoxType</span> eType )
|
|
{
|
|
<span style="color: blue">return</span> IEdmCallback6_MsgBox(lParentWnd, lMsgID, bsMsg, eType);
|
|
}
|
|
|
|
<span style="color: blue">private</span> <span style="color: blue">void</span> IEdmCallback6_Resolve(<span style="color: blue">int</span> lParentWnd, <span style="color: blue">ref</span> <span style="color: #2b91af">EdmCmdData</span>[] ppoItems)
|
|
{
|
|
}
|
|
<span style="color: blue">void</span> <span style="color: #2b91af">IEdmCallback6</span>.<b>Resolve</b>(<span style="color: blue">int</span> lParentWnd, <span style="color: blue">ref</span> <span style="color: #2b91af">EdmCmdData</span>[] ppoItems)
|
|
{
|
|
IEdmCallback6_Resolve(lParentWnd, <span style="color: blue">ref</span> ppoItems);
|
|
}
|
|
|
|
<span style="color: blue">private</span> <span style="color: blue">bool</span> IEdmCallback6_SetProgress(<span style="color: blue">int</span> lBarIndex, <span style="color: blue">int</span> lPos, <span style="color: blue">string</span> bsMsg)
|
|
{
|
|
<span style="color: blue">return</span> <span style="color: blue">true</span>;
|
|
}
|
|
<span style="color: blue">bool</span> <span style="color: #2b91af">IEdmCallback6</span>.<b>SetProgress</b>(<span style="color: blue">int</span> lBarIndex, <span style="color: blue">int</span> lPos, <span style="color: blue">string</span> bsMsg)
|
|
{
|
|
<span style="color: blue">return</span> IEdmCallback6_SetProgress(lBarIndex, lPos, bsMsg);
|
|
}
|
|
|
|
<span style="color: blue">private</span> <span style="color: blue">void</span> IEdmCallback6_SetProgressRange(<span style="color: blue">int</span> lBarIndex, <span style="color: blue">int</span> lMax)
|
|
{
|
|
}
|
|
<span style="color: blue">void</span> <span style="color: #2b91af">IEdmCallback6</span>.<b>SetProgressRange</b>(<span style="color: blue">int</span> lBarIndex, <span style="color: blue">int</span> lMax)
|
|
{
|
|
IEdmCallback6_SetProgressRange(lBarIndex, lMax);
|
|
}
|
|
|
|
<span style="color: blue">private</span> <span style="color: blue">void</span> IEdmCallback6_SetStatusMessage(<span style="color: blue">int</span> lBarIndex, <span style="color: blue">string</span> bsMessage)
|
|
{
|
|
}
|
|
<span style="color: blue">void</span> <span style="color: #2b91af">IEdmCallback6</span>.<b>SetStatusMessage</b>(<span style="color: blue">int</span> lBarIndex, <span style="color: blue">string</span> bsMessage)
|
|
{
|
|
IEdmCallback6_SetStatusMessage(lBarIndex, bsMessage);
|
|
}
|
|
}
|
|
}</pre>
|
|
<pre style="font-family: Courier New; font-size: 13; color: black; background: white"><font color="#008000"><a name="Form1Designer"></a>//Form1.Designer.cs</font>
|
|
</pre>
|
|
<pre style="font-family: Courier New; font-size: 13; color: black; background: white"><span style="color:blue;">namespace</span> AddFiles_CSharp
|
|
{
|
|
<span style="color:blue;">partial</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">Form1</span>
|
|
{
|
|
<span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;"><summary></span>
|
|
<span style="color:gray;">///</span><span style="color:green;"> Required designer variable.</span>
|
|
<span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;"></summary></span>
|
|
<span style="color:blue;">private</span> System.ComponentModel.<span style="color:#2b91af;">IContainer</span> components = <span style="color:blue;">null</span>;
|
|
|
|
<span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;"><summary></span>
|
|
<span style="color:gray;">///</span><span style="color:green;"> Clean up any resources being used.</span>
|
|
<span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;"></summary></span>
|
|
<span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;"><param name="disposing"></span><span style="color:green;">true if managed resources should be disposed; otherwise, false.</span><span style="color:gray;"></param></span>
|
|
<span style="color:blue;">protected</span> <span style="color:blue;">override</span> <span style="color:blue;">void</span> Dispose(<span style="color:blue;">bool</span> disposing)
|
|
{
|
|
<span style="color:blue;">if</span> (disposing && (components != <span style="color:blue;">null</span>))
|
|
{
|
|
components.Dispose();
|
|
}
|
|
<span style="color:blue;">base</span>.Dispose(disposing);
|
|
}
|
|
|
|
<span style="color:blue;"> #region</span> Windows Form Designer generated code
|
|
|
|
<span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;"><summary></span>
|
|
<span style="color:gray;">///</span><span style="color:green;"> Required method for Designer support - do not modify</span>
|
|
<span style="color:gray;">///</span><span style="color:green;"> the contents of this method with the code editor.</span>
|
|
<span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;"></summary></span>
|
|
<span style="color:blue;">private</span> <span style="color:blue;">void</span> InitializeComponent()
|
|
{
|
|
<span style="color:blue;">this</span>.VaultsLabel = <span style="color:blue;">new</span> System.Windows.Forms.<span style="color:#2b91af;">Label</span>();
|
|
<span style="color:blue;">this</span>.VaultsComboBox = <span style="color:blue;">new</span> System.Windows.Forms.<span style="color:#2b91af;">ComboBox</span>();
|
|
<span style="color:blue;">this</span>.BrowseButton = <span style="color:blue;">new</span> System.Windows.Forms.<span style="color:#2b91af;">Button</span>();
|
|
<span style="color:blue;">this</span>.ListBox = <span style="color:blue;">new</span> System.Windows.Forms.<span style="color:#2b91af;">ListBox</span>();
|
|
<span style="color:blue;">this</span>.AddFiles = <span style="color:blue;">new</span> System.Windows.Forms.<span style="color:#2b91af;">Button</span>();
|
|
<span style="color:blue;">this</span>.OpenFileDialog = <span style="color:blue;">new</span> System.Windows.Forms.<span style="color:#2b91af;">OpenFileDialog</span>();
|
|
<span style="color:blue;">this</span>.SuspendLayout();
|
|
<span style="color:green;">// </span>
|
|
<span style="color:green;">// VaultsLabel</span>
|
|
<span style="color:green;">// </span>
|
|
<span style="color:blue;">this</span>.VaultsLabel.AutoSize = <span style="color:blue;">true</span>;
|
|
<span style="color:blue;">this</span>.VaultsLabel.Location = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Point</span>(13, 26);
|
|
<span style="color:blue;">this</span>.VaultsLabel.Name = <span style="color:#a31515;">"VaultsLabel"</span>;
|
|
<span style="color:blue;">this</span>.VaultsLabel.Size = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Size</span>(94, 13);
|
|
<span style="color:blue;">this</span>.VaultsLabel.TabIndex = 0;
|
|
<span style="color:blue;">this</span>.VaultsLabel.Text = <span style="color:#a31515;">" Select vault view:"</span>;
|
|
<span style="color:green;">// </span>
|
|
<span style="color:green;">// VaultsComboBox</span>
|
|
<span style="color:green;">// </span>
|
|
<span style="color:blue;">this</span>.VaultsComboBox.FormattingEnabled = <span style="color:blue;">true</span>;
|
|
<span style="color:blue;">this</span>.VaultsComboBox.Location = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Point</span>(16, 42);
|
|
<span style="color:blue;">this</span>.VaultsComboBox.Name = <span style="color:#a31515;">"VaultsComboBox"</span>;
|
|
<span style="color:blue;">this</span>.VaultsComboBox.Size = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Size</span>(121, 21);
|
|
<span style="color:blue;">this</span>.VaultsComboBox.TabIndex = 1;
|
|
<span style="color:green;">// </span>
|
|
<span style="color:green;">// BrowseButton</span>
|
|
<span style="color:green;">// </span>
|
|
<span style="color:blue;">this</span>.BrowseButton.ImageAlign = System.Drawing.<span style="color:#2b91af;">ContentAlignment</span>.MiddleLeft;
|
|
<span style="color:blue;">this</span>.BrowseButton.Location = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Point</span>(16, 69);
|
|
<span style="color:blue;">this</span>.BrowseButton.Name = <span style="color:#a31515;">"BrowseButton"</span>;
|
|
<span style="color:blue;">this</span>.BrowseButton.Size = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Size</span>(259, 39);
|
|
<span style="color:blue;">this</span>.BrowseButton.TabIndex = 3;
|
|
<span style="color:blue;">this</span>.BrowseButton.Text = <span style="color:#a31515;">"Browse to a file outside the vault:"</span>;
|
|
<span style="color:blue;">this</span>.BrowseButton.TextAlign = System.Drawing.<span style="color:#2b91af;">ContentAlignment</span>.MiddleLeft;
|
|
<span style="color:blue;">this</span>.BrowseButton.UseVisualStyleBackColor = <span style="color:blue;">true</span>;
|
|
<span style="color:blue;">this</span>.BrowseButton.Click += <span style="color:blue;">new</span> System.<span style="color:#2b91af;">EventHandler</span>(<span style="color:blue;">this</span>.BrowseButton_Click);
|
|
<span style="color:green;">// </span>
|
|
<span style="color:green;">// ListBox</span>
|
|
<span style="color:green;">// </span>
|
|
<span style="color:blue;">this</span>.ListBox.FormattingEnabled = <span style="color:blue;">true</span>;
|
|
<span style="color:blue;">this</span>.ListBox.HorizontalScrollbar = <span style="color:blue;">true</span>;
|
|
<span style="color:blue;">this</span>.ListBox.Location = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Point</span>(16, 114);
|
|
<span style="color:blue;">this</span>.ListBox.Name = <span style="color:#a31515;">"ListBox"</span>;
|
|
<span style="color:blue;">this</span>.ListBox.SelectionMode = System.Windows.Forms.<span style="color:#2b91af;">SelectionMode</span>.MultiExtended;
|
|
<span style="color:blue;">this</span>.ListBox.Size = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Size</span>(259, 43);
|
|
<span style="color:blue;">this</span>.ListBox.TabIndex = 4;
|
|
<span style="color:green;">// </span>
|
|
<span style="color:green;">// AddFiles</span>
|
|
<span style="color:green;">// </span>
|
|
<span style="color:blue;">this</span>.AddFiles.Location = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Point</span>(16, 163);
|
|
<span style="color:blue;">this</span>.AddFiles.Name = <span style="color:#a31515;">"AddFiles"</span>;
|
|
<span style="color:blue;">this</span>.AddFiles.Size = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Size</span>(121, 23);
|
|
<span style="color:blue;">this</span>.AddFiles.TabIndex = 5;
|
|
<span style="color:blue;">this</span>.AddFiles.Text = <span style="color:#a31515;">"Add file to vault root"</span>;
|
|
<span style="color:blue;">this</span>.AddFiles.TextAlign = System.Drawing.<span style="color:#2b91af;">ContentAlignment</span>.MiddleLeft;
|
|
<span style="color:blue;">this</span>.AddFiles.UseVisualStyleBackColor = <span style="color:blue;">true</span>;
|
|
<span style="color:blue;">this</span>.AddFiles.Click += <span style="color:blue;">new</span> System.<span style="color:#2b91af;">EventHandler</span>(<span style="color:blue;">this</span>.AddFiles_Click);
|
|
<span style="color:green;">// </span>
|
|
<span style="color:green;">// OpenFileDialog</span>
|
|
<span style="color:green;">// </span>
|
|
<span style="color:blue;">this</span>.OpenFileDialog.Multiselect = <span style="color:blue;">true</span>;
|
|
<span style="color:blue;">this</span>.OpenFileDialog.Title = <span style="color:#a31515;">"Open"</span>;
|
|
<span style="color:green;">// </span>
|
|
<span style="color:green;">// Form1</span>
|
|
<span style="color:green;">// </span>
|
|
<span style="color:blue;">this</span>.AutoScaleDimensions = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">SizeF</span>(6F, 13F);
|
|
<span style="color:blue;">this</span>.AutoScaleMode = System.Windows.Forms.<span style="color:#2b91af;">AutoScaleMode</span>.Font;
|
|
<span style="color:blue;">this</span>.ClientSize = <span style="color:blue;">new</span> System.Drawing.<span style="color:#2b91af;">Size</span>(317, 215);
|
|
<span style="color:blue;">this</span>.Controls.Add(<span style="color:blue;">this</span>.AddFiles);
|
|
<span style="color:blue;">this</span>.Controls.Add(<span style="color:blue;">this</span>.ListBox);
|
|
<span style="color:blue;">this</span>.Controls.Add(<span style="color:blue;">this</span>.BrowseButton);
|
|
<span style="color:blue;">this</span>.Controls.Add(<span style="color:blue;">this</span>.VaultsComboBox);
|
|
<span style="color:blue;">this</span>.Controls.Add(<span style="color:blue;">this</span>.VaultsLabel);
|
|
<span style="color:blue;">this</span>.Name = <span style="color:#a31515;">"Form1"</span>;
|
|
<span style="color:blue;">this</span>.Text = <span style="color:#a31515;">"Add file to vault root"</span>;
|
|
<span style="color:blue;">this</span>.Load += <span style="color:blue;">new</span> System.<span style="color:#2b91af;">EventHandler</span>(<span style="color:blue;">this</span>.Form1_Load);
|
|
<span style="color:blue;">this</span>.ResumeLayout(<span style="color:blue;">false</span>);
|
|
<span style="color:blue;">this</span>.PerformLayout();
|
|
|
|
}
|
|
|
|
<span style="color:blue;"> #endregion</span>
|
|
|
|
<span style="color:blue;">internal</span> System.Windows.Forms.<span style="color:#2b91af;">Label</span> VaultsLabel;
|
|
<span style="color:blue;">internal</span> System.Windows.Forms.<span style="color:#2b91af;">ComboBox</span> VaultsComboBox;
|
|
<span style="color:blue;">internal</span> System.Windows.Forms.<span style="color:#2b91af;">Button</span> BrowseButton;
|
|
<span style="color:blue;">internal</span> System.Windows.Forms.<span style="color:#2b91af;">ListBox</span> ListBox;
|
|
<span style="color:blue;">internal</span> System.Windows.Forms.<span style="color:#2b91af;">Button</span> AddFiles;
|
|
<span style="color:blue;">internal</span> System.Windows.Forms.<span style="color:#2b91af;">OpenFileDialog</span> OpenFileDialog;
|
|
}
|
|
}</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|