| Oracle® Application Server Developer's Guide for Microsoft Office Interoperability 10g Release 3 (10.1.3) B25781-01 |
|
![]() Previous |
![]() Next |
This appendix contains the following sections:
Example A-1 shows the contents of the AutoLoanSmartDocument.cs file. See Section 4.3.3, "Creating a Smart Document Form" for more details.
Example A-1 AutoLoanSmartDocument.cs
using System;
using System.IO;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.Office.Interop.SmartTag;
using Microsoft.Office.Interop.Word;
namespace AutoLoanSmartDocument
{
//BASE CLASS
public class clsActions : Microsoft.Office.Interop.SmartTag.ISmartDocument
{
//CONSTANTS
//You need one constant for the schema namespace, one constant for each
//of the schema elements for which you want to provide smart document controls
//and actions, and one constant for the total number of schema elements
//for which there are associated actions.
//Because XML is case-sensitive, the values
//of these constants must be exact in both spelling and case.
//Namespace constant
const String cNAMESPACE = "http://www.autoloan.com/ns/autoloan";
//Element constants
const String cAutoLoanRootElemName = cNAMESPACE + "#loanApplication";
//Number of types (or element constants)
const Int32 cTYPES = 2;
public void SmartDocInitialize(string ApplicationName, object Document, string SolutionPath, string SolutionRegKeyRoot)
{
}
//SmartDocXMLTypeCount
public int SmartDocXmlTypeCount
{
get
{
String message = "SmartDocXmlTypeName" + cTYPES;
return cTYPES;
}
}
//SmartDocXMLTypeName
public string get_SmartDocXmlTypeName(int XMLTypeID)
{
String strTypeName = "";
String message = "SmartDocXmlTypeName" + XMLTypeID;
switch (XMLTypeID) {
case 1:
strTypeName = cAutoLoanRootElemName;
break;
default:
break;
}
return strTypeName;
}
//SmartDocXMLTypeCaption
public string get_SmartDocXmlTypeCaption(int XMLTypeID, int LocaleID)
{
String strTypeCaption = "";
switch (XMLTypeID) {
case 1:
strTypeCaption = "Please submit loan application";
break;
default:
break;
}
return strTypeCaption;
}
//ControlCount
public int get_ControlCount(string XMLTypeName)
{
Int32 intNumberOfControls = 0;
switch (XMLTypeName) {
case cAutoLoanRootElemName:
intNumberOfControls = 1;
break;
default:
break;
}
return intNumberOfControls;
}
//ControlID
//The ControlID for the first control you add will be 1.
//For more information on specifying the ControlID, see the ControlID reference
//topic in the References section of this SDK.
public int get_ControlID(string XMLTypeName, int ControlIndex)
{
Int32 intControlID = 0;
switch (XMLTypeName) {
case cAutoLoanRootElemName:
intControlID = 1;
break;
default:
break;
}
return intControlID;
}
//ControlNameFromID
public string get_ControlNameFromID(int ControlID)
{
String strControlName = "";
strControlName = cNAMESPACE + ControlID;
return strControlName;
}
//ControlCaptionFromID
public string get_ControlCaptionFromID(int ControlID,
string ApplicationName, int LocaleID, string Text,
string Xml, object Target)
{
String strControlCaption = "";
switch (ControlID){
case 1:
strControlCaption = "Submit for Approval";
break;
default:
break;
}
return strControlCaption;
}
//ControlTypeFromID
public C_TYPE get_ControlTypeFromID(int ControlID,
string ApplicationName, int LocaleID)
{
C_TYPE type = new C_TYPE();
switch (ControlID)
{
case 1:
type = C_TYPE.C_TYPE_BUTTON;
break;
default:
break;
}
return type;
}
public void PopulateHelpContent(int ControlID,
string ApplicationName, int LocaleID, string Text, string Xml,
object Target, Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props, ref string Content)
{
switch (ControlID)
{
case 1:
Content = "This document is an XML smart document that submits an loan application";
break;
default:
break;
}
}
// OnSubmitDocument
public void InvokeControl(int ControlID,
string ApplicationName, object Target, string Text, string Xml, int LocaleID)
{
try {
// Get the xml node
Microsoft.Office.Interop.Word.Range objRange = (Microsoft.Office.Interop.Word.Range)Target;
XMLNode objNode = objRange.XMLNodes[1];
// MessageBox.Show (objNode.BaseName, "Base name", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
// MessageBox.Show (objNode.get_XML(true), "Data xml from objNode", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
// From the xml node, create a AutoLoan object for the web service input
String xmlString = objNode.get_XML(true).ToString();
// MessageBox.Show (xmlString, "xmlString", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlString);
XmlNode root = doc.DocumentElement;
// MessageBox.Show (root.ToString(), "loan application", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
// MessageBox.Show ("Serialization to XML doc success", "My Application", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
XmlReader xmlReader = new XmlNodeReader(doc);
XmlSerializer serializer = new XmlSerializer(typeof(LoanApplicationType));
LoanApplicationType loanApplicationMessage = (LoanApplicationType) serializer.Deserialize(xmlReader);
// MessageBox.Show (loanApplicationMessage.ToString(), "loan application", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
// MessageBox.Show ("Serialization to input message success", "My Application", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
// Invoke the web service
AutoLoanFlowBinding autoLoanFlowBindingProxy = new AutoLoanFlowBinding();
autoLoanFlowBindingProxy.initiate(loanApplicationMessage);
MessageBox.Show ("The loan application was successfully submitted for approval", "Application Submission Status", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
} catch(XmlException xe){
MessageBox.Show (xe.Message, "XML Parse Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
} catch(InvalidOperationException ioe){
MessageBox.Show (ioe.InnerException.Message, "XML Serialization Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
} catch(Exception ioe){
MessageBox.Show (ioe.Message, "XML Serialization Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public void PopulateCheckbox(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props, ref bool Checked)
{
// do nothing
}
public void PopulateTextboxContent(int ControlID, string ApplicationName, int LocaleID,
string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props, ref string Value)
{
// do nothing
}
public void PopulateListOrComboContent(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props, ref System.Array List,
ref int Count, ref int InitialSelected)
{
switch (ControlID)
{
case 101:
Count = 6;
List.SetValue("AirFare", 1);
List.SetValue("Rental", 2);
List.SetValue("Hotel", 3);
List.SetValue("Meals", 4);
List.SetValue("Phone", 5);
List.SetValue("Other", 6);
InitialSelected = -1;
break;
default:
break;
}
}
public void OnCheckboxChange(int ControlID, object Target, bool Checked)
{
// do nothing
}
public void OnTextboxContentChange(int ControlID, object Target, string Value)
{
// do nothing
}
public void OnListOrComboSelectChange(int ControlID, object Target, int Selected, string Value)
{
switch (ControlID)
{
case 101:
Range objRange = (Range) Target;
objRange.XMLNodes[1].Range.Text = Value;
break;
default:
break;
}
}
public void PopulateDocumentFragment(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props,
ref string DocumentFragment)
{
// do nothing
}
public void PopulateActiveXProps(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties ActiveXPropBag)
{
// do nothing
}
public void PopulateImage(int ControlID, string ApplicationName, int LocaleID,
string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props,
ref string ImageSrc)
{
// do nothing
}
public void ImageClick(int ControlID, string ApplicationName, object Target,
string Text, string Xml, int LocaleID, int XCoordinate, int YCoordinate)
{
// do nothing
}
public void PopulateRadioGroup(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props,
ref System.Array List, ref int Count, ref int InitialSelected)
{
// do nothing
}
public void OnRadioGroupSelectChange(int ControlID, object Target, int Selected, string Value)
{
// do nothing
}
public void OnPaneUpdateComplete(object Document)
{
// do nothing
}
public void PopulateOther(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props)
{
// do nothing
}
}
}
Example A-2 shows the contents of the ManagedManifest.xml file. See Section 4.3.3, "Creating a Smart Document Form" for more details.
Example A-2 ManagedManifest.xml for Chapter 4
<SD:manifest xmlns:SD="http://schemas.microsoft.com/office/xmlexpansionpacks/2003">
<SD:version>1.1</SD:version>
<SD:updateFrequency>20160</SD:updateFrequency>
<SD:uri>http://www.autoloan.com/ns/autoloan</SD:uri>
<SD:solution>
<SD:solutionID>AutoLoanSmartDocument.clsActions</SD:solutionID>
<SD:type>smartDocument</SD:type>
<SD:alias lcid="*">Smart Word Document to submit loan application for a car</SD:alias>
<SD:file>
<SD:type>solutionActionHandler</SD:type>
<SD:version>1.0</SD:version>
<SD:filePath>AutoLoanSmartDocument.dll</SD:filePath>
<SD:CLSNAME>AutoLoanSmartDocument.clsActions</SD:CLSNAME>
<SD:runFromServer>True</SD:runFromServer>
<SD:managed/>
</SD:file>
</SD:solution>
<SD:solution>
<SD:solutionID>schema</SD:solutionID>
<SD:type>schema</SD:type>
<SD:alias lcid="*">Sample schema</SD:alias>
<SD:file>
<SD:type>schema</SD:type>
<SD:version>1.0</SD:version>
<SD:filePath>AutoLoanTypes.xsd</SD:filePath>
<SD:runFromServer>True</SD:runFromServer>
</SD:file>
</SD:solution>
</SD:manifest>
Example A-3 shows the contents of the ManagedManifest.xml file. See Section 6.3.4, "Attaching the XML Schema and the Expansion Pack to the Smart Document" for more details.
Example A-3 ManagedManifest.xml for Chapter 6
<SD:manifest xmlns:SD="http://schemas.microsoft.com/office/xmlexpansionpacks/2003">
<SD:version>1.1</SD:version>
<SD:updateFrequency>20160</SD:updateFrequency>
<SD:uri>http://xmlns.oracle.com/SecureSmartDocument</SD:uri>
<SD:solution>
<SD:solutionID>SecureSmartDocument.clsActions</SD:solutionID>
<SD:type>smartDocument</SD:type>
<SD:alias lcid="*">Smart Word Document </SD:alias>
<SD:file>
<SD:type>solutionActionHandler</SD:type>
<SD:version>1.0</SD:version>
<SD:filePath>SecureDoc.dll</SD:filePath>
<SD:CLSNAME>SecureSmartDocument.clsActions</SD:CLSNAME>
<SD:runFromServer>True</SD:runFromServer>
<SD:managed/>
</SD:file>
</SD:solution>
<SD:solution>
<SD:solutionID>schema</SD:solutionID>
<SD:type>schema</SD:type>
<SD:alias lcid="*">Sample schema</SD:alias>
<SD:file>
<SD:type>schema</SD:type>
<SD:version>1.0</SD:version>
<SD:filePath>SecureDocument.xsd</SD:filePath>
<SD:runFromServer>True</SD:runFromServer>
</SD:file>
</SD:solution>
</SD:manifest>
Example A-4 shows the contents of the AutoLoanTypes.xsd file. See Section 4.3.3, "Creating a Smart Document Form" for more details.
Example A-4 AutoLoanTypes.xsd
<?xml version="1.0"?>
<schema attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://www.autoloan.com/ns/autoloan"
xmlns:tns="http://www.autoloan.com/ns/autoloan"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="loanApplication" type="tns:LoanApplicationType"/>
<element name="loanOffer" type="tns:LoanOfferType"/>
<element name="loan" type="tns:LoanType"/>
<complexType name="LoanType">
<sequence>
<element ref="tns:loanApplication"/>
<element ref="tns:loanOffer"/>
</sequence>
</complexType>
<complexType name="LoanOfferType">
<sequence>
<element name="providerName" type="string"/>
<element name="selected" type="boolean"/>
<element name="approved" type="boolean"/>
<element name="APR" type="double"/>
</sequence>
</complexType>
<complexType name="LoanApplicationType">
<sequence>
<element name="SSN" type="string"/>
<element name="email" type="string"/>
<element name="customerName" type="string"/>
<element name="customerAge" type="string"/>
<element name="customerAnnualIncome" type="string"/>
<element name="city" type="string"/>
<element name="state" type="string"/>
<element name="country" type="string"/>
<element name="loanAmount" type="double"/>
<element name="carMake" type="string"/>
<element name="carModel" type="string"/>
<element name="carYear" type="string"/>
<element name="creditRating" type="int"/>
</sequence>
</complexType>
</schema>
Example A-5 shows the contents of the SecureDocument.xsd file. See Section 6.3.4, "Attaching the XML Schema and the Expansion Pack to the Smart Document" for more details.
Example A-5 SecureDocument.xsd
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<schema targetNamespace="http://xmlns.oracle.com/SecureSmartDocument"
xmlns:tns="http://xmlns.oracle.com/SecureSmartDocument"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" blockDefault="#all">
<element name="Report">
<complexType>
<sequence>
<element name="name" type="string" minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
</element>
</schema>
Example A-6 shows the contents of the SecureSmartDocument.cs file. See Section 6.3.3, "Creating the Smart Document DLL" for more details.
|
Note: For information on how to locate the example files, see Accessing the Demonstration Support Files in the Preface. |
Example A-6 SecureSmartDocument.cs
using System;
using System.IO;
using System.Windows.Forms;
using System.Xml;
using System.Xml.Serialization;
using Microsoft.Office.Interop.SmartTag;
using Microsoft.Office.Interop.Word;
using Microsoft.Web.Services2.Security.Tokens;
using Microsoft.Web.Services2.Security.X509;
using Microsoft.Web.Services2.Security;
namespace SecureSmartDocument
{
//BASE CLASS
public class clsActions : Microsoft.Office.Interop.SmartTag.ISmartDocument
{
//CONSTANTS
//You need one constant for the schema namespace, one constant for each
//of the schema elements for which you want to provide smart document controls
//and actions, and one constant for the total number of schema elements
//for which there are associated actions.
//Because XML is case-sensitive, the values
//of these constants must be exact in both spelling and case.
//Namespace constant
const String cNAMESPACE = "http://xmlns.oracle.com/SecureSmartDocument";
//Element constants
const String cElemName = cNAMESPACE + "#name";
//Number of types (or element constants)
const Int32 cTYPES = 1;
public void SmartDocInitialize(string ApplicationName, object Document, string SolutionPath, string SolutionRegKeyRoot)
{
}
//SmartDocXMLTypeCount
public int SmartDocXmlTypeCount
{
get
{
String message = "SmartDocXmlTypeName" + cTYPES;
return cTYPES;
}
}
//SmartDocXMLTypeName
public string get_SmartDocXmlTypeName(int XMLTypeID)
{
String strTypeName = "";
String message = "SmartDocXmlTypeName" + XMLTypeID;
switch (XMLTypeID)
{
case 1:
strTypeName = cElemName;
break;
default:
break;
}
return strTypeName;
}
//SmartDocXMLTypeCaption
public string get_SmartDocXmlTypeCaption(int XMLTypeID, int LocaleID)
{
String strTypeCaption = "";
switch (XMLTypeID)
{
case 1:
strTypeCaption = "Please Enter Name ";
break;
default:
break;
}
return strTypeCaption;
}
//ControlCount
public int get_ControlCount(string XMLTypeName)
{
Int32 intNumberOfControls = 0;
switch (XMLTypeName)
{
case cElemName:
intNumberOfControls = 1;
break;
default:
break;
}
return intNumberOfControls;
}
//ControlID
//The ControlID for the first control you add will be 1.
//For more information on specifying the ControlID, see the ControlID reference
//topic in the References section of this SDK.
public int get_ControlID(string XMLTypeName, int ControlIndex)
{
Int32 intControlID = 0;
switch (XMLTypeName)
{
case cElemName:
intControlID = 1;
break;
default:
break;
}
return intControlID;
}
//ControlNameFromID
public string get_ControlNameFromID(int ControlID)
{
String strControlName = "";
strControlName = cNAMESPACE + ControlID;
return strControlName;
}
//ControlCaptionFromID
public string get_ControlCaptionFromID(int ControlID,
string ApplicationName, int LocaleID, string Text,
string Xml, object Target)
{
String strControlCaption = "";
switch (ControlID)
{
case 1:
strControlCaption = "Name";
break;
default:
break;
}
return strControlCaption;
}
//ControlTypeFromID
public C_TYPE get_ControlTypeFromID(int ControlID,
string ApplicationName, int LocaleID)
{
C_TYPE type = new C_TYPE();
switch (ControlID)
{
case 1:
type = C_TYPE.C_TYPE_TEXTBOX;
break;
default:
break;
}
return type;
}
public void PopulateHelpContent(int ControlID,
string ApplicationName, int LocaleID, string Text, string Xml,
object Target, Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props, ref string Content)
{
switch (ControlID)
{
case 1:
Content = "This document is an XML smart document";
break;
default:
break;
}
}
public void InvokeControl(int ControlID,
string ApplicationName, object Target, string Text, string Xml, int LocaleID)
{
//do nothing
}
public void PopulateCheckbox(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props, ref bool Checked)
{
// do nothing
}
public void PopulateTextboxContent(int ControlID, string ApplicationName, int LocaleID,
string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props, ref string Value)
{
//do nothing
}
public void PopulateListOrComboContent(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props, ref System.Array List,
ref int Count, ref int InitialSelected)
{
//do nothing
}
public void OnCheckboxChange(int ControlID, object Target, bool Checked)
{
// do nothing
}
public void OnTextboxContentChange(int ControlID, object Target, string Value)
{
// Add code later ….
}
public void OnListOrComboSelectChange(int ControlID, object Target, int Selected, string Value)
{
}
public void PopulateDocumentFragment(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props,
ref string DocumentFragment)
{
// do nothing
}
public void PopulateActiveXProps(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties ActiveXPropBag)
{
// do nothing
}
public void PopulateImage(int ControlID, string ApplicationName, int LocaleID,
string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props,
ref string ImageSrc)
{
// do nothing
}
public void ImageClick(int ControlID, string ApplicationName, object Target,
string Text, string Xml, int LocaleID, int XCoordinate, int YCoordinate)
{
// do nothing
}
public void PopulateRadioGroup(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props,
ref System.Array List, ref int Count, ref int InitialSelected)
{
// do nothing
}
public void OnRadioGroupSelectChange(int ControlID, object Target, int Selected, string Value)
{
// do nothing
}
public void OnPaneUpdateComplete(object Document)
{
// do nothing
}
public void PopulateOther(int ControlID, string ApplicationName,
int LocaleID, string Text, string Xml, object Target,
Microsoft.Office.Interop.SmartTag.ISmartDocProperties Props)
{
// do nothing
}
}
}
Example A-7 shows the contents of UsernameTokenDialog.cs. See Section 6.3.5.1.1, "Securing the Client Side" for more details.
|
Note: For information on how to locate the example files, see Accessing the Demonstration Support Files in the Preface. |
Example A-7 UsernameTokenDialog.cs
using System;
using System.Windows.Forms;
namespace SecureSmartDocument
{
/// <summary>
/// Dialog.
/// </summary>
class UsernameTokenDialog : System.Windows.Forms.Form
{
private String uname;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private String pwd;
public UsernameTokenDialog():base()
{
InitializeComponent();
}
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(120, 104);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 0;
this.textBox1.Text = "";
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(408, 104);
this.textBox2.Name = "textBox2";
this.textBox2.PasswordChar = '*';
this.textBox2.TabIndex = 1;
this.textBox2.Text = "";
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
//
// button1
//
this.button1.Location = new System.Drawing.Point(96, 192);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 32);
this.button1.TabIndex = 2;
this.button1.Text = "Ok";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(320, 192);
this.button2.Name = "button2";
this.button2.TabIndex = 3;
this.button2.Text = "Cancel";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label1
//
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label1.Location = new System.Drawing.Point(176, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(216, 48);
this.label1.TabIndex = 4;
this.label1.Text = "User Credentials";
//
// label2
//
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label2.Location = new System.Drawing.Point(16, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 16);
this.label2.TabIndex = 5;
this.label2.Text = "Username : ";
//
// label3
//
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.label3.Location = new System.Drawing.Point(296, 104);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(88, 32);
this.label3.TabIndex = 6;
this.label3.Text = "Password :";
//
// UsernameTokenDialog
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(576, 266);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Name = "UsernameTokenDialog";
this.ResumeLayout(false);
}
private void button1_Click(object sender, System.EventArgs e)
{
Console.WriteLine(" Ok button clicked ");
uname = textBox1.Text;
pwd = textBox2.Text;
Console.WriteLine(" Username : "+ uname + " pwd : " + pwd);
this.Close();
this.DialogResult = DialogResult.OK;
}
private void button2_Click(object sender, System.EventArgs e)
{
uname = null;
pwd = null;
this.DialogResult = DialogResult.Cancel;
}
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
}
private void textBox2_TextChanged(object sender, System.EventArgs e)
{
}
public void setDefaultUsername (String uname)
{
textBox1.Text = uname;
}
public String getUsername()
{
return uname;
}
public String getPassword()
{
return pwd;
}
}
}