Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compact Framework Licensing - input panel disappeared

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support
View previous topic :: View next topic  
Author Message
stevebsc



Joined: 21 Dec 2005
Posts: 1

PostPosted: Wed Dec 21, 2005 9:03 pm    Post subject: Compact Framework Licensing - input panel disappeared Reply with quote

Using the sample VB .NET code I have incorporated the licensing software into a PDA app I have written. Unfortunately when the licensing form appears on the PDA I do not have the means to open up the on screen keyboard (or any other input method) - this is normally available with an icon in the bottom right hand corner. How do I achieve this ?
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Dec 21, 2005 9:53 pm    Post subject: Reply with quote

This sounds like a peculiarity of .NET on your particular PDA. The License Install Form is just a standard .NET form and so should have no unusual impact on the input mechanism. You could try deriving a new form class from LicenseInstallForm and modifying the form parameters to see whether you can work around the issue. Alternatively I've included the source code for the form below so that you can create your own form directly. If you need this in VB let us know.

Code:
#region File Header
//
//      FILE:   LicenseInstallForm.cs.
//
// COPYRIGHT:   Copyright 2004
//              Infralution
//              6 Bruce St
//              Mitcham Australia
//
#endregion
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Infralution.Licensing.CF
{
   /// <summary>
   /// Provides a basic form for installing Infralution Encrypted Licenses that can be extended or modified using
   /// visual inheritance
   /// </summary>
   /// <seealso cref="EncryptedLicenseProvider"/>
public class LicenseInstallForm : System.Windows.Forms.Form
   {
        /// <summary>
        /// The text box to enter the key in
        /// </summary>
      protected System.Windows.Forms.TextBox _keyText;

        /// <summary>
        /// The label for the key text box
        /// </summary>
      protected System.Windows.Forms.Label _keyLabel;

        /// <summary>
        /// The OK Button
        /// </summary>
      protected System.Windows.Forms.Button _okButton;

        /// <summary>
        /// The label displaying the licensing message
        /// </summary>
      protected System.Windows.Forms.Label _msgLabel;
      
      /// <summary>
      /// The license installed by the form (if any)
      /// </summary>
      private EncryptedLicense _license;
      private System.ComponentModel.Container components = null;
      private System.Type _licenseType;
      
        /// <summary>
        /// Create a new instance of the LicenseInstallForm
        /// </summary>
      public LicenseInstallForm()
      {
         //
         // Required for Windows Form Designer support
         //
         InitializeComponent();
      }

      /// <summary>
      /// The type of the component/control being licensed
      /// </summary>
      public Type TypeToLicense
      {
         get { return _licenseType; }
         set { _licenseType = value; }
      }

      /// <summary>
      /// The license installed by this form (if any)
      /// </summary>
      public EncryptedLicense InstalledLicense
      {
         get { return _license; }
      }

      /// <summary>
      /// Display the InstallLicense Dialog
      /// </summary>
      /// <param name="productName">The name of the product being licensed</param>
      /// <param name="typeToLicense">The type of the component being licensed</param>
      /// <returns>The newly installed license (if any)</returns>
      public EncryptedLicense ShowDialog(string productName, Type typeToLicense)
      {
         this.Text = string.Format(Text, productName);
         _msgLabel.Text = string.Format(_msgLabel.Text, productName);
         _licenseType = typeToLicense;
         this.ShowDialog();
         return _license;
      }
      
      /// <summary>
      /// Clean up any resources being used.
      /// </summary>
      protected override void Dispose( bool disposing )
      {
         if( disposing )
         {
            if(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()
      {
            System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(LicenseInstallForm));
            this._keyText = new System.Windows.Forms.TextBox();
            this._keyLabel = new System.Windows.Forms.Label();
            this._msgLabel = new System.Windows.Forms.Label();
            this._okButton = new System.Windows.Forms.Button();
            //
            // _keyText
            //
            this._keyText.Location = new System.Drawing.Point(8, 152);
            this._keyText.Size = new System.Drawing.Size(224, 20);
            this._keyText.Text = "";
            //
            // _keyLabel
            //
            this._keyLabel.Location = new System.Drawing.Point(8, 136);
            this._keyLabel.Size = new System.Drawing.Size(104, 16);
            this._keyLabel.Text = "License Key:";
            //
            // _msgLabel
            //
            this._msgLabel.Location = new System.Drawing.Point(8, 8);
            this._msgLabel.Size = new System.Drawing.Size(224, 128);
            this._msgLabel.Text = "{0} is currently not licensed.  To install a license, enter the key you received " +
                "on purchasing the product and click OK.    You may continue to evaluate the prod" +
                "uct under the terms of the evaluation license by leaving the License Key blank. " +
                "";
            //
            // _okButton
            //
            this._okButton.Location = new System.Drawing.Point(152, 184);
            this._okButton.Size = new System.Drawing.Size(80, 24);
            this._okButton.Text = "OK";
            this._okButton.Click += new System.EventHandler(this._okButton_Click);
            //
            // LicenseInstallForm
            //
            this.ClientSize = new System.Drawing.Size(240, 216);
            this.Controls.Add(this._okButton);
            this.Controls.Add(this._keyText);
            this.Controls.Add(this._keyLabel);
            this.Controls.Add(this._msgLabel);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Text = "Install {0} License";

        }
      #endregion

        /// <summary>
        /// Return the license provider to use
        /// </summary>
        /// <returns>The license provider to use for installing licensing</returns>
        protected virtual EncryptedLicenseProvider GetLicenseProvider()
        {
            return new EncryptedLicenseProvider();
        }

      /// <summary>
      /// Install the license key entered by the user
      /// </summary>
      /// <param name="key">The key to install</param>
      /// <returns>True if the license was installed successfully</returns>
      protected virtual bool InstallLicenseKey(string key)
      {
         try
         {
            _license = GetLicenseProvider().InstallLicense(_licenseType, key);
            if (_license == null)
            {
               MessageBox.Show("Invalid Key!", "Invalid Key", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }
            return (_license != null);
         }
         catch
         {
            MessageBox.Show("An Error Has Occurred!", "Error",
               MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         }
         return false;
      }

      /// <summary>
      /// Handle Click event for the OK button
      /// </summary>
      /// <param name="sender"></param>
      /// <param name="e"></param>
      private void _okButton_Click(object sender, System.EventArgs e)
      {      
         if (_keyText.Text == null || _keyText.Text.Trim().Length == 0)
         {
            this.Close();
         }
         else
         {
                if (InstallLicenseKey(_keyText.Text))
                {
                    this.Close();
                }
         }
      }
      
   }
}

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Licensing Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group