示例#1
0
        private void btnEmbedPersistedObject_Click(object sender, EventArgs e)
        {
            PeriodType      type     = PeriodType.DAYS;
            CWSteganography cwStegan = new CWSteganography();


            switch (cbPeriodType.SelectedItem.ToString())
            {
            case "HOURS":
                type = PeriodType.HOURS;
                break;

            case "DAYS":
                type = PeriodType.DAYS;
                break;

            case "MONTHS":
                type = PeriodType.MONTHS;
                break;

            case "ACTIVATIONS":
                type = PeriodType.ACTIVATIONS;
                break;

            default:
                type = PeriodType.DAYS;
                break;
            }
            //Initilize The Object With Basic Information.
            CWProductProtection.Initilize(@".\Temp.po", 0, txtPackageName.Text, DateTime.Now, Convert.ToInt32(txtTrialPeriod.Text), type);
            cwStegan.AppendBinaryFileToBinaryFile(@".\Temp.po", findLogoFileDialog.FileName);
            File.Delete(@".\Temp.po");
        }
        static void Main()
        {
            CWProductProtection.Initilize();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmCWProtectionTestMain());
        }
        private void button3_Click(object sender, EventArgs e)
        {
            AUXMethods tAux = new AUXMethods();

            if (CWProductProtection.Activate(tAux.CodifyData(txtFName.Text, txtLName.Text, txtPhone.Text, txtEmail.Text), txtActivation.Text))
            {
                MessageBox.Show("Activation Successful!", "Activation Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("Activation Failed!", "Activation Failes!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public frmCWProtectionTestMain()
        {
            InitializeComponent();
            CWProductProtection.AddControlledObject("ControlledForm");
            //CWProductProtection.AddControlledObject("controlledFormToolStripMenuItem");
            CWProductProtection.AddControlledObject("controlledItem2ToolStripMenuItem");
            //CWProductProtection.AddControlledObject("controlledDD1ToolStripMenuItem");
            CWProductProtection.AddControlledObject("controlledSubItemToolStripMenuItem");
            CWProductProtection.AddControlledObject("cmdButton1");

            this.Text += "Activation Count:" + CWProductProtection.GetNumberOfActivations().ToString();
            if (CWProductProtection.IsProductActivated == false && CWProductProtection.HasEvaluationPeriodExpired)
            {
                CWProductProtection.IntelligentSecureControls(this);

                MessageBox.Show("Your product trial period has expired!  Please register and activate your product to continue use.", "Trial Period Expired.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            String mFileName = @".\Persist.fl";

            //First Type To Load The Persisted Object
            //If That Fails, Create A New One With Default Values.
            CWProductProtection.Initilize();             //(mFileName,0,"TestPackage",DateTime.Now,5,PeriodType.ACTIVATIONS);



            if (CWProductProtection.HasEvaluationPeriodExpired && !CWProductProtection.IsProductActivated)
            {
                MessageBox.Show("Your Trial Period Has Ended.  Please Register Your Product.To Continue Use.");
            }

            Application.Run(new Form1());
        }
        private void cmdGenKey_Click(object sender, EventArgs e)
        {
            if (!CWProductProtection.IsProductActivated)
            {
                AUXMethods tAux = new AUXMethods();

                String data = tAux.CodifyData(txtFName.Text, txtLName.Text, txtPhone.Text, txtEmail.Text);
                CWProductProtection.Activate(data, txtKey.Text);
                if (CWProductProtection.IsProductActivated)
                {
                    MessageBox.Show(CWProductProtection.ACTIVATION_SUCCESS, "Activation Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(CWProductProtection.ACTIVATION_FAILURE, "Activation Failure", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                CWProductProtection.IntelligentSecureControls(this.MdiParent);
            }
        }
 private void ControlledForm_Load(object sender, EventArgs e)
 {
     CWProductProtection.IntelligentSecureControls(this);
 }