Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var          xM           = new XmlMiddleware <NotiferModel>(NotifierFileInfo.FilePath, NotifierFileInfo.FileName, NotifierFileInfo.RootNodeName);
            NotiferModel currentModel = xM.Read();

            dtpExpiration.Value = currentModel.GetExpirationDate();
            tbxMessage.Text     = currentModel.Message;
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            DateTime triggerDate = DateTime.Parse(System.Configuration.ConfigurationManager.AppSettings["TriggerDateTime"]);

            IMiddleware <NotiferModel> xM = new XmlMiddleware <NotiferModel>(NotifierFileInfo.FilePath, NotifierFileInfo.FileName, NotifierFileInfo.RootNodeName);

            NotiferModel readData     = xM.Read();
            NotiferModel currentModel = readData == null ? new NotiferModel() : readData;

            if (currentModel.GetExpirationDate() < triggerDate)
            {
                MessageBox.Show(currentModel.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                NotiferModel newModel = currentModel;
                newModel.Expiration = DateTime.Now.AddDays(1).ToShortDateString();
                xM.Write(newModel);
            }
        }