Exemple #1
0
        private void Update_Click(object sender, RoutedEventArgs e)
        {
            bool success = Updater.UpdateInformation();

            if (success)
            {
                Updater.Update();
                if (RecourceHandler.updateRecords.Count > 1)
                {
                    SuccessUpdate successUpdate = new SuccessUpdate();
                    successUpdate.Show();
                    this.Close();
                }
                else
                {
                    NoNewInformationUpdate noNewInformationUpdate = new NoNewInformationUpdate();
                    noNewInformationUpdate.Show();
                    this.Close();
                }
            }
            else
            {
                UnSuccessUpdate unSuccessUpdate = new UnSuccessUpdate();
                unSuccessUpdate.Show();
                this.Close();
            }
        }
Exemple #2
0
        public static void AutoUpdate()
        {
            bool waiter = false;

            DateTime dateTime = DateTime.Now;

            while (true)
            {
                dateTime = DateTime.Now;
                if (dateTime.Hour == 10 && !waiter)
                {
                    bool success = Updater.UpdateInformation();

                    if (success)
                    {
                        Updater.Update();
                        if (RecourceHandler.updateRecords.Count > 1)
                        {
                            SuccessUpdate successUpdate = new SuccessUpdate();
                            successUpdate.Show();
                        }
                        else
                        {
                            NoNewInformationUpdate noNewInformationUpdate = new NoNewInformationUpdate();
                            noNewInformationUpdate.Show();
                        }
                    }
                    else
                    {
                        UnSuccessUpdate unSuccessUpdate = new UnSuccessUpdate();
                        unSuccessUpdate.Show();
                    }

                    waiter = true;
                }
                if (dateTime.Hour == 8)
                {
                    waiter = false;
                }
            }
        }