コード例 #1
0
        private async void AgeCalcImpl(object o)
        {
            _showLoaderAction.Invoke(true);
            CanExecute = false;
            try
            {
                await Task.Run(() =>
                {
                    StationManager.CurrentPerson = AgeCalcAdapter.CreateUser(_firstName, _lastName, _email, _date);
                    Thread.Sleep(500);
                });

                if (DateTime.Today.Day == _date.Day && DateTime.Today.Month == _date.Month)
                {
                    MessageBox.Show($"Happy Birthday, {FirstName}!");
                }
                _closeAction.Invoke();
                CanExecute = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            ClearInputValues();
            _showLoaderAction.Invoke(false);
        }
コード例 #2
0
 protected override void OnClosing(CancelEventArgs e)
 {
     AgeCalcAdapter.SaveData();
     base.OnClosing(e);
 }