示例#1
0
        public static void Write(LicenceExpiry obj)
        {
            var           fname      = string.Format("{0}\\{1}", Application.StartupPath, "SERIAL.DAT");
            XmlSerializer serializer = new XmlSerializer(typeof(LicenceExpiry));

            using (TextWriter writer = new StreamWriter(fname))
            {
                serializer.Serialize(writer, obj);
            }
        }
示例#2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (_Pass == sebPassword.Text)
            {
                MessageBox.Show("Serial Accepted", "Password",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                var licx = new LicenceExpiry();
                licx.Serial     = sebPassword.Text;
                licx.ExpiryDate = DateTime.Now.AddYears(1);
                LicenceExpiry.Write(licx);

                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("The Serial Number is Incorrect", "Password",
                                MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }