コード例 #1
0
        /// <summary>
        ///     on test to update grid double click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TestToUpdateGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                //open window
                var test = TestToUpdateGrid.SelectedItem as Test;
                var win  = new UpdateTest(test);
                win.ShowDialog();
                var passed = test?.Passed;


                Refresh();

                //get trainee and updated test
                var trainee = FactoryBl.GetObject.AllTrainees.First(x => x.Id == test?.TraineeId);
                test = FactoryBl.GetObject.AllTests.First(x => x.Id == test?.Id);

                //if passed state didn't change
                if (test.Passed == passed)
                {
                    return;
                }

                //if email is empty
                if (string.IsNullOrEmpty(trainee.EmailAddress))
                {
                    return;
                }

                //Send Email
                var thread = new Thread(() =>
                {
                    try
                    {
                        Pdf.CreateLicensePdf(test, trainee);
                        Email.SentEmailToTraineeAfterTest(test, trainee);
                    }
                    catch
                    {
                        // ignored
                    }
                });
                thread.Start();
            }
            catch (Exception ex)
            {
                if (ex.Message != "Object reference not set to an instance of an object.")
                {
                    ExceptionMessage.Show(ex.Message, ex.ToString());
                }
            }
        }
コード例 #2
0
        private void UpdateTestBoutton_Click(object sender, RoutedEventArgs e)
        {
            UpdateTest updateTest = new UpdateTest();

            updateTest.ShowDialog();
        }
コード例 #3
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            var window = new UpdateTest();

            window.ShowDialog();
        }