Thursday, February 27, 2014

Regular Expressions for Validation.

This is regular expression using for validation the website , Ip address , Frist level Domain, Second level Domain, Email validaiton expression and phone number expression validation.

bool isEmail = Regex.IsMatch(emailString, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z");


$regexp = "^(https?://)"; // http://
$regexp .= "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?"; //
usernamePassword
$regexp .= "(([0-9]{1,3}\.){3}[0-9]{1,3}"; // IP- 199.194.52.184
$regexp .= "|"; // allows either IP or domain
$regexp .= "([0-9a-z_!~*'()-]+\.)*"; // tertiary domain(s)- www.
$regexp .= "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\."; // second level domain
$regexp .= "[a-z]{2,6})"; // first level domain- .com or .museum
$regexp .= "(:[0-9]{1,4})?"; // port number- :80
$regexp .= "((/?)|"; // a slash isn't required if there is no file name
$regexp .= "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
$regexp .= @"^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$"; //Phone number
$regexp .= @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z"; // email validation

Monday, February 24, 2014

Xml file Validation class using Xsd file C# application

This is the validation method for xml file format and missing xml tags and missing xml values using xsd file.

When i want to import the xml config file in my application that time i want to validate my xml file format and

I just simple class use it. call the IsValidXml method and pass the xml file value and xsd file value.

If you don't need to xsd file source in your application my last post i have created the xsd file method just use it.


class Validations
    {
        private int nErrors = 0;
        private string strErrorMsg = string.Empty;
        public string Errors { get { return strErrorMsg; } }

        public bool IsValidXml(string xmlPath, string xsdPath)
        {
            bool bStatus = false;
            try
            {
                // Declare local objects
                XmlReaderSettings rs = new XmlReaderSettings();
                rs.ValidationType = ValidationType.Schema;
                rs.ValidationFlags |= XmlSchemaValidationFlags.ProcessSchemaLocation |
                XmlSchemaValidationFlags.ReportValidationWarnings;
                //  Event Handler for handling exception & 
                //  this will be called whenever any mismatch between XML & XSD
                rs.ValidationEventHandler +=
            new ValidationEventHandler(ValidationEventHandler);
                rs.Schemas.Add(null, XmlReader.Create(xsdPath));
                //rs.Schemas.Add(CreateXSDSchemaValidationFormate());


                // reading xml
                using (XmlReader xmlValidatingReader = XmlReader.Create(xmlPath, rs))
                { while (xmlValidatingReader.Read()) { } }

                //Exception if error.
                if (nErrors > 0) { throw new Exception(strErrorMsg); }
                else { bStatus = true; }//Success
            }
            catch (Exception error) { bStatus = false; }

            return bStatus;
        }

        private void ValidationEventHandler(object sender, ValidationEventArgs e)
        {
            if (e.Severity == XmlSeverityType.Warning) strErrorMsg += "WARNING: ";
            else strErrorMsg += "ERROR: ";
            nErrors++;

            if (e.Exception.Message.Contains("'Email' element is invalid"))
            {
                strErrorMsg = strErrorMsg + getErrorString
            ("Provided Email data is Invalid", "CAPIEMAIL007") + "\r\n";
            }
            if (e.Exception.Message.Contains
            ("The element 'Person' has invalid child element"))
            {
                strErrorMsg = strErrorMsg + getErrorString
            ("Provided XML contains invalid child element",
            "CAPINVALID005") + "\r\n";
            }
            else
            {
                strErrorMsg = strErrorMsg + e.Exception.Message + "\r\n";
            }
        }

        private string getErrorString(string erroString, string errorCode)
        {
            StringBuilder errXMl = new StringBuilder();
            errXMl.Append("<MyError> <errorString> ERROR_STRING </errorString> <errorCode> ERROR_CODE </errorCode> </MyError>");
            errXMl.Replace("ERROR_STRING", erroString);
            errXMl.Replace("ERROR_CODE", errorCode);
            return errXMl.ToString();
        }
}

Create Xsd file Schema using C# code behind

I am working in .net platform wpf technology. I have task in Create new xsd file using Csharp. When i created this xsd file i have so much troble for create this file.

after that i had same idea to create this xsd file. Its working file for the parporse i created this method, my xml file format validation only i have just return the value XmlSchema.

If you want to Create new file just use the four line Start the "FileStream" object till the "writer.Close()" close object.

If you don't need to save the xsd file just remove this four lines.

Now this is the method to create xsd file for xml validation schema format file.


public XmlSchema CreateXSDSchemaValidationFormate()
        {
            try
            {
                XmlSchemaSimpleType attriLeSimpleType = new XmlSchemaSimpleType();
                XmlSchemaSimpleTypeRestriction attriLeRestriction = new XmlSchemaSimpleTypeRestriction();
                attriLeRestriction.BaseTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
                XmlSchemaMinLengthFacet attriLeFacet = new XmlSchemaMinLengthFacet();
                attriLeFacet.Value = "1";
                attriLeRestriction.Facets.Add(attriLeFacet);
                attriLeSimpleType.Content = attriLeRestriction;

                XmlSchemaSimpleType attriIntLeSimpleType = new XmlSchemaSimpleType();
                XmlSchemaSimpleTypeRestriction attriIntLeRestriction = new XmlSchemaSimpleTypeRestriction();
                attriIntLeRestriction.BaseTypeName = new XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema");
                XmlSchemaMinInclusiveFacet attriInclusiveFacet = new XmlSchemaMinInclusiveFacet();
                attriInclusiveFacet.Value = "0";
                attriIntLeRestriction.Facets.Add(attriInclusiveFacet);
                attriIntLeSimpleType.Content = attriIntLeRestriction;

                XmlSchemaComplexType proComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute proAttribut = new XmlSchemaAttribute();
                proAttribut.Name = "value";
                proAttribut.Use = XmlSchemaUse.Required;
                proAttribut.SchemaType = attriLeSimpleType;
                proComplex.Attributes.Add(proAttribut);

                XmlSchemaComplexType faComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute faAttribut = new XmlSchemaAttribute();
                faAttribut.Name = "value";
                faAttribut.Use = XmlSchemaUse.Required;
                faComplex.Attributes.Add(faAttribut);
                faAttribut.SchemaType = attriLeSimpleType;

                XmlSchemaComplexType lComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute lAttribut = new XmlSchemaAttribute();
                lAttribut.Name = "value";
                lAttribut.Use = XmlSchemaUse.Required;
                lAttribut.SchemaType = attriLeSimpleType;
                lComplex.Attributes.Add(lAttribut);

                XmlSchemaComplexType sComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute sAttribut = new XmlSchemaAttribute();
                sAttribut.Name = "value";
                sAttribut.Use = XmlSchemaUse.Required;
                sAttribut.SchemaType = attriLeSimpleType;
                sComplex.Attributes.Add(sAttribut);

                XmlSchemaComplexType stationIDElementComplex = new XmlSchemaComplexType();
                XmlSchemaSequence stationIDElementSequence = new XmlSchemaSequence();

                XmlSchemaElement producer = new XmlSchemaElement();
                producer.Name = "producer";
                producer.SchemaType = proComplex;

                XmlSchemaElement facility = new XmlSchemaElement();
                facility.Name = "facility";
                facility.SchemaType = faComplex;

                XmlSchemaElement line = new XmlSchemaElement();
                line.Name = "Line";
                line.SchemaType = lComplex;

                XmlSchemaElement station = new XmlSchemaElement();
                station.Name = "Station";
                station.SchemaType = sComplex;

                stationIDElementSequence.Items.Add(producer);
                stationIDElementSequence.Items.Add(facility);
                stationIDElementSequence.Items.Add(line);
                stationIDElementSequence.Items.Add(station);

                XmlSchemaComplexType senderConfigElementComplex = new XmlSchemaComplexType();
                XmlSchemaSequence senderConfigElementSequence = new XmlSchemaSequence();

                XmlSchemaComplexType eventIncomingRootAttributeComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute eventIncomingRootAttribute = new XmlSchemaAttribute();
                eventIncomingRootAttribute.Name = "value";
                eventIncomingRootAttribute.Use = XmlSchemaUse.Required;
                eventIncomingRootAttribute.FixedValue = @"C:\Document\Incoming\";
                eventIncomingRootAttribute.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
                eventIncomingRootAttributeComplex.Attributes.Add(eventIncomingRootAttribute);

                XmlSchemaElement eventIncomingRoot = new XmlSchemaElement();
                eventIncomingRoot.Name = "EventIncomingRoot";
                eventIncomingRoot.SchemaType = eventIncomingRootAttributeComplex;

                XmlSchemaComplexType eventErrorRootAttributeComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute eventErrorRootAttribute = new XmlSchemaAttribute();
                eventErrorRootAttribute.Name = "value";
                eventErrorRootAttribute.Use = XmlSchemaUse.Required;
                eventErrorRootAttribute.FixedValue = @"C:\Document\Errors\";
                eventErrorRootAttribute.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
                eventErrorRootAttributeComplex.Attributes.Add(eventErrorRootAttribute);

                XmlSchemaElement eventErrorRoot = new XmlSchemaElement();
                eventErrorRoot.Name = "EventErrorRoot";
                eventErrorRoot.SchemaType = eventErrorRootAttributeComplex;

                XmlSchemaComplexType eventInProcessRootAttributeComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute eventInProcessRootAttribute = new XmlSchemaAttribute();
                eventInProcessRootAttribute.Name = "value";
                eventInProcessRootAttribute.Use = XmlSchemaUse.Required;
                eventInProcessRootAttribute.FixedValue = @"C:\Document\InProcess\";
                eventInProcessRootAttribute.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
                eventInProcessRootAttributeComplex.Attributes.Add(eventInProcessRootAttribute);

                XmlSchemaElement eventInProcessRoot = new XmlSchemaElement();
                eventInProcessRoot.Name = "EventInProcessRoot";
                eventInProcessRoot.SchemaType = eventInProcessRootAttributeComplex;

                XmlSchemaComplexType eventToBeDeletedRootAttributeComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute eventToBeDeletedRootAttribute = new XmlSchemaAttribute();
                eventToBeDeletedRootAttribute.Name = "value";
                eventToBeDeletedRootAttribute.Use = XmlSchemaUse.Required;
                eventToBeDeletedRootAttribute.FixedValue = @"C:\Document\ToBeDeleted\";
                eventToBeDeletedRootAttribute.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
                eventToBeDeletedRootAttributeComplex.Attributes.Add(eventToBeDeletedRootAttribute);

                XmlSchemaElement eventToBeDeletedRoot = new XmlSchemaElement();
                eventToBeDeletedRoot.Name = "EventToBeDeletedRoot";
                eventToBeDeletedRoot.SchemaType = eventToBeDeletedRootAttributeComplex;

                XmlSchemaComplexType eventXmitRetryRootAttributeComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute eventXmitRetryRootAttribute = new XmlSchemaAttribute();
                eventXmitRetryRootAttribute.Name = "value";
                eventXmitRetryRootAttribute.Use = XmlSchemaUse.Required;
                eventXmitRetryRootAttribute.FixedValue = @"C:\Document\XmitRetry\";
                eventXmitRetryRootAttribute.SchemaTypeName = new XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema");
                eventXmitRetryRootAttributeComplex.Attributes.Add(eventXmitRetryRootAttribute);

                XmlSchemaElement eventXmitRetryRoot = new XmlSchemaElement();
                eventXmitRetryRoot.Name = "EventXmitRetryRoot";
                eventXmitRetryRoot.SchemaType = eventXmitRetryRootAttributeComplex;

                XmlSchemaComplexType userIDAttributeComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute userIDAttribute = new XmlSchemaAttribute();
                userIDAttribute.Name = "value";
                userIDAttribute.Use = XmlSchemaUse.Required;
                userIDAttribute.SchemaType = attriLeSimpleType;
                userIDAttributeComplex.Attributes.Add(userIDAttribute);

                XmlSchemaComplexType accessKeyAttributeComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute accessKeyAttribute = new XmlSchemaAttribute();
                accessKeyAttribute.Name = "value";
                accessKeyAttribute.Use = XmlSchemaUse.Required;
                accessKeyAttribute.SchemaType = attriLeSimpleType;
                accessKeyAttributeComplex.Attributes.Add(accessKeyAttribute);

                XmlSchemaComplexType eeceiverServiceElementComplex = new XmlSchemaComplexType();
                XmlSchemaSequence eeceiverServiceElementSequence = new XmlSchemaSequence();

                XmlSchemaElement userID = new XmlSchemaElement();
                userID.Name = "UserID";
                userID.SchemaType = userIDAttributeComplex;

                XmlSchemaElement accessKey = new XmlSchemaElement();
                accessKey.Name = "AccessKey";
                accessKey.SchemaType = accessKeyAttributeComplex;

                eeceiverServiceElementSequence.Items.Add(userID);
                eeceiverServiceElementSequence.Items.Add(accessKey);

                eeceiverServiceElementComplex.Particle = eeceiverServiceElementSequence;

                XmlSchemaElement eeceiverService = new XmlSchemaElement();
                eeceiverService.Name = "ReceiverService";
                eeceiverService.SchemaType = eeceiverServiceElementComplex;

                XmlSchemaComplexType eventPollingIntervalAttributesComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute eventPollingIntervalAttributes = new XmlSchemaAttribute();
                eventPollingIntervalAttributes.Name = "value";
                eventPollingIntervalAttributes.Use = XmlSchemaUse.Required;
                eventPollingIntervalAttributes.SchemaType = attriIntLeSimpleType;
                eventPollingIntervalAttributesComplex.Attributes.Add(eventPollingIntervalAttributes);

                XmlSchemaElement eventPollingInterval = new XmlSchemaElement();
                eventPollingInterval.Name = "EventPollInterval";
                eventPollingInterval.SchemaType = eventPollingIntervalAttributesComplex;

                XmlSchemaComplexType transmissionIntervalsElementComplex = new XmlSchemaComplexType();
                XmlSchemaSequence transmissionIntervalsElementSequence = new XmlSchemaSequence();

                XmlSchemaElement transmissionIntervals = new XmlSchemaElement();
                transmissionIntervals.Name = "TransIntervals";
                transmissionIntervals.SchemaType = transmissionIntervalsElementComplex;

                XmlSchemaComplexType intervalAttributesComplex = new XmlSchemaComplexType();
                XmlSchemaSequence emp_seq5 = new XmlSchemaSequence();

                XmlSchemaElement interval = new XmlSchemaElement();
                interval.Name = "Interval";
                interval.MaxOccurs = 0;
                interval.MaxOccursString = "unbounded";
                interval.SchemaType = intervalAttributesComplex;

                XmlSchemaAttribute intervalAttributes = new XmlSchemaAttribute();
                intervalAttributes.Name = "AfterFailures";
                intervalAttributes.Use = XmlSchemaUse.Required;
                intervalAttributes.SchemaType = attriIntLeSimpleType;
                intervalAttributesComplex.Attributes.Add(intervalAttributes);

                XmlSchemaAttribute intervalAttributes2 = new XmlSchemaAttribute();
                intervalAttributes2.Name = "value";
                intervalAttributes2.Use = XmlSchemaUse.Required;
                intervalAttributes2.SchemaType = attriIntLeSimpleType;
                intervalAttributesComplex.Attributes.Add(intervalAttributes2);

                transmissionIntervalsElementSequence.Items.Add(interval);
                transmissionIntervalsElementComplex.Particle = transmissionIntervalsElementSequence;

                XmlSchemaComplexType batchSizeLimitKBAttributesComplex = new XmlSchemaComplexType();

                XmlSchemaAttribute batchSizeLimitKBAttributes = new XmlSchemaAttribute();
                batchSizeLimitKBAttributes.Name = "value";
                batchSizeLimitKBAttributes.Use = XmlSchemaUse.Required;
                batchSizeLimitKBAttributes.SchemaType = attriIntLeSimpleType;
                batchSizeLimitKBAttributesComplex.Attributes.Add(batchSizeLimitKBAttributes);

                XmlSchemaElement batchSizeLimitKB = new XmlSchemaElement();
                batchSizeLimitKB.Name = "BatchSizeLimit";
                batchSizeLimitKB.SchemaType = batchSizeLimitKBAttributesComplex;

                senderConfigElementSequence.Items.Add(eventIncomingRoot);
                senderConfigElementSequence.Items.Add(eventErrorRoot);
                senderConfigElementSequence.Items.Add(eventInProcessRoot);
                senderConfigElementSequence.Items.Add(eventToBeDeletedRoot);
                senderConfigElementSequence.Items.Add(eventXmitRetryRoot);
                senderConfigElementSequence.Items.Add(eeceiverService);
                senderConfigElementSequence.Items.Add(eventPollingInterval);
                senderConfigElementSequence.Items.Add(transmissionIntervals);
                senderConfigElementSequence.Items.Add(batchSizeLimitKB);

                XmlSchemaElement senderConfig = new XmlSchemaElement();
                senderConfig.Name = "SenderConfig";
                senderConfig.SchemaType = senderConfigElementComplex;


                XmlSchemaComplexType stationConfigComplex = new XmlSchemaComplexType();
                XmlSchemaSequence stationConfigElementSquence = new XmlSchemaSequence();

                XmlSchemaElement stationID = new XmlSchemaElement();
                stationID.Name = "StationID";
                stationID.SchemaType = stationIDElementComplex;

                stationConfigElementSquence.Items.Add(stationID);
                stationConfigElementSquence.Items.Add(senderConfig);

                senderConfigElementComplex.Particle = senderConfigElementSequence;
                stationIDElementComplex.Particle = stationIDElementSequence;
                stationConfigComplex.Particle = stationConfigElementSquence;

                XmlSchemaElement stationConfig = new XmlSchemaElement();
                stationConfig.Name = "Config";
                stationConfig.SchemaType = stationConfigComplex;
                //employee.MinOccurs = 0;
                //employee.MaxOccursString = "unbounded";
                XmlSchemaSequence stationConfigSequence = new XmlSchemaSequence();

                stationConfigSequence.Items.Add(stationConfig);

                //employee.Particle = emps_seq;
                XmlSchema schema = new XmlSchema();
                schema.ElementFormDefault = XmlSchemaForm.Qualified;
                schema.AttributeFormDefault = XmlSchemaForm.Unqualified;
                schema.Items.Add(stationConfig);


                XmlSchemaSet set = new XmlSchemaSet();
                set.Add(schema);

                //if you want to create a new xsd file just pass the url;
                FileStream stream = new FileStream("c:\\NewSchema.xsd", FileMode.Open);

                XmlTextWriter writer = new XmlTextWriter(stream, null);
                schema.Write(writer);
                writer.Close();

                //if you want to use it for the xml validation just return this schema.
                return schema;
            }

            catch (XmlException XMLExp)
            {
                Console.WriteLine(XMLExp.Message);
            }
            catch (XmlSchemaException XmlSchemaExp)
            {
                Console.WriteLine(XmlSchemaExp.Message);
            }
            catch (Exception GenExp)
            {
                Console.WriteLine(GenExp.Message);
            }
            finally
            {
                Console.Read();
            }

            return null;
        }

Thursday, February 20, 2014

Browser History clear After the Application Logout

I am working in .net web application. I have one big issue. when i Logout my application after that i clicked the Browser back button the browser history not clear. I have the Simple Javascript code. Its very easy to just call this javaScript method in the Logout page tag. This is my JavaScript method:
<script type="text/javascript">
window.history.forward();
function noBack() {
window.history.forward();
}
</script>
This is the HTML just call the javascript method like this:
<body class="layout-body" onload="noBack();" >

Edit xsd file and Update using C# code behind

I am working in Windows destop application .net blatform in wpf advance technology. i want to update my xsd validation schema file using Csharp code behaind. I want to update my xsd file simpleType ("XmlSchemaSimpleType") tag inside Add new enumeration ("XmlSchemaEnumerationFacet"). If there is no tag I want to add one new tag. If there is already more then one tag I want to add additional tag. If already exist the same value tag I will try to add that can be retrun; Its very simple to this sample code. This is my book1.xsd file:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="urn:bookstore-schema" targetNamespace="urn:bookstore-schema" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:simpleType name="NameType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Actor" />
      <xs:enumeration value="Producer" />
      <xs:enumeration value="Senthil" />
      <xs:enumeration value="Kumar" />
      <xs:enumeration value="navamani1" />
    </xs:restriction>
  </xs:simpleType>
  <xs:simpleType name="EmployeeType">
    <xs:restriction base="xs:string">
      <xs:enumeration value="Worker" />
      <xs:enumeration value="Manager" />
      <xs:enumeration value="Admin" />
      <xs:enumeration value="Sales" />
    </xs:restriction>
  </xs:simpleType>
</xs:schema>
this is the method update the xsd file.
[STAThread]
static void Main(string[] args)
{
 UpdateValidationSchema("book1.xsd", "navamani1");
}

 public static void UpdateValidationSchema(string validationSchemaPath, string stationName)
        {
            XmlSchema schema;

            using (var reader = new StreamReader(validationSchemaPath))
            {
                schema = XmlSchema.Read(reader, null);
            }

            // Compile so that post-compilation information is available
            XmlSchemaSet schemaSet = new XmlSchemaSet();
            schemaSet.Add(schema);
            schemaSet.Compile();

            // Update schema reference
            schema = schemaSet.Schemas().Cast<XmlSchema>().First();

            var simpleTypes = schema.SchemaTypes.Values.OfType<XmlSchemaSimpleType>()
                                               .Where(t => t.Content is XmlSchemaSimpleTypeRestriction);

            foreach (var simpleType in simpleTypes)
            {
                var restriction = (XmlSchemaSimpleTypeRestriction)simpleType.Content;
                var enumFacets = restriction.Facets.OfType<XmlSchemaEnumerationFacet>();

                if (enumFacets.Any())
                {
                    foreach (var facet in enumFacets)
                    {
                        string exitStationName = facet.Value;

                        if (exitStationName == stationName)
                        {
                            return;
                        }
                    }
                }

                string validStationType = simpleType.Name;

                if (validStationType == "NameType")
                {
                    XmlSchemaEnumerationFacet staionEnum =
                            new XmlSchemaEnumerationFacet();

                    staionEnum.Value = stationName;
                    restriction.Facets.Add(staionEnum);
                }
            }

            StreamWriter streamWriter = new StreamWriter(validationSchemaPath, false);
            schema.Write(streamWriter);
        }

Tuesday, February 11, 2014

TouchScreen Keyboard using c# in wpf Application

I am working in wpf application in .net platform. this application working in like ATM machine so we want to touch screen keyboard that time i got this sample. Its very simple to use this code. there is one Alphakeyboard.cs class download just add your application and call the touch screen method.
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
 xmlns:pti="clr-namespace:samplecode">


<TextBox Local:TouchScreenKeyboard.TouchScreenKeyboard="True" FontSize="30" Name="lot" TextChanged="{Local:DelegateCreator lot_Changed}" Style="{StaticResource RequiredTextBox}" Local:Ui.ClearAfterPrint="False" />

<Window/>