private void GenerateButton_Click(object sender, RoutedEventArgs e)
        {
            int maxUsers;
            var xDoc = new XDocument(
                new XElement("License",
                             new XElement("MachineKey", MachineKeyTextBox.Text),
                             new XElement("MaxUsers", int.TryParse(MaxTextBox.Text, out maxUsers) ? maxUsers : (int?)null),
                             new XElement("ExpirationDate", (TrialCheckBox.IsChecked ?? false) ? DateTime.Now.AddDays(60).Date : (DateTime?)null)));

            debugTextBox.Text = xDoc.ToString();

            var saveFileDialog = new SaveFileDialog
            {
                Title            = "License File",
                Filter           = "EverBlu license file(*.ebl)|*.ebl",
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            };

            if (saveFileDialog.ShowDialog(this) ?? false)
            {
                if (string.IsNullOrWhiteSpace(this.KeyFileTextBox.Text))
                {
                    LicenseFileGenerator.WriteLicenseFile(new FileInfo(saveFileDialog.FileName), xDoc);
                }
                else
                {
                    LicenseFileGenerator.WriteLicenseFile(new FileInfo(saveFileDialog.FileName), xDoc, new FileInfo(this.KeyFileTextBox.Text));
                }
            }
        }
        private void GenerateKeyFiles_Click(object sender, RoutedEventArgs e)
        {
            var folder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            FileInfo privateKeyFile = new FileInfo(System.IO.Path.Combine(folder, "PrivateKey.prk"));
            FileInfo publicKeyFile  = new FileInfo(System.IO.Path.Combine(folder, "PublicKey.puk"));

            LicenseFileGenerator.GenerateKeyPairFiles(privateKeyFile, publicKeyFile);
        }