示例#1
0
        // при нажатии кнопки выбора теста
        private void OnChooseTest(object sender, RoutedEventArgs e)
        {
            var headerTest = Header.Content != null ? Header.Content : "\\_(^_^)_/";
            var result     = MessageBox.Show($"{(string)Application.Current.Resources["questSelect"]} \"{headerTest}\"?",
                                             (string)Application.Current.Resources["sure"], MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                if ((string)Header.Content != null)
                {
                    ChooseTest chooseTest = new ChooseTest();
                    chooseTest.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show((string)Application.Current.Resources["noTest"]);
                    e.Handled = true;
                }
            }
            else
            {
                Author.Content = null;
                Header.Content = null;
                Topic.Content  = null;
                testList.Clear();
                for (int i = Tabs.Items.Count - 1; i > -1; i--)
                {
                    var tabIndex = Tabs.Items[i] as TabItem;
                    tabIndex.IsSelected = true;
                }
            }
        }
示例#2
0
 private void Test_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if ((sender as DataGrid).SelectedItem is Test selectedItem) // сопоставление шаблонов
     {
         var result = MessageBox.Show($"Do you want to select \"{selectedItem.Header}\"", "Responsible choice", MessageBoxButton.YesNo);
         if (result == MessageBoxResult.Yes)
         {
             CurrentTest.test = selectedItem;
             ChooseTest chooseTest = new ChooseTest();
             chooseTest.Show();
             Close();
         }
     }
 }