96 lines
3.3 KiB
C#
96 lines
3.3 KiB
C#
/*-------------------------------------------------------------------------
|
|
// UNCLASSIFIED
|
|
/*-------------------------------------------------------------------------
|
|
RAYTHEON PROPRIETARY: THIS DOCUMENT CONTAINS DATA OR INFORMATION
|
|
PROPRIETARY TO RAYTHEON COMPANY AND IS RESTRICTED TO USE ONLY BY PERSONS
|
|
AUTHORIZED BY RAYTHEON COMPANY IN WRITING TO USE IT. DISCLOSURE TO
|
|
UNAUTHORIZED PERSONS WOULD LIKELY CAUSE SUBSTANTIAL COMPETITIVE HARM TO
|
|
RAYTHEON COMPANY'S BUSINESS POSITION. NEITHER SAID DOCUMENT NOR ITS
|
|
CONTENTS SHALL BE FURNISHED OR DISCLOSED TO OR COPIED OR USED BY PERSONS
|
|
OUTSIDE RAYTHEON COMPANY WITHOUT THE EXPRESS WRITTEN APPROVAL OF RAYTHEON
|
|
COMPANY.
|
|
|
|
THIS PROPRIETARY NOTICE IS NOT APPLICABLE IF DELIVERED TO THE U.S.
|
|
GOVERNMENT.
|
|
|
|
UNPUBLISHED WORK - COPYRIGHT RAYTHEON COMPANY.
|
|
-------------------------------------------------------------------------*/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text.RegularExpressions;
|
|
using System.Windows;
|
|
using System.Windows.Media.Imaging;
|
|
using NLog;
|
|
|
|
namespace ProgramLib.GUI.View
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for MsfrTestCasesWindow.xaml
|
|
/// </summary>
|
|
internal partial class MsfrTestCasesWindow : Window
|
|
{
|
|
private ILogger _logger;
|
|
public GUI.Util.StandardButtons ClickedButton { get; private set; }
|
|
|
|
public MsfrTestCasesWindow()
|
|
{
|
|
InitializeComponent();
|
|
|
|
_logger = LogManager.GetCurrentClassLogger();
|
|
|
|
Uri iconUri = new Uri($"pack://application:,,,/{GetType().Assembly.GetName().Name};component/Resources/Icons/app.ico");
|
|
this.Icon = BitmapFrame.Create(iconUri);
|
|
|
|
ClickedButton = Util.StandardButtons.NOT_SET;
|
|
|
|
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
|
}
|
|
|
|
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
|
{
|
|
DragMove();
|
|
}
|
|
|
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
PopulateTestCaseComboBox();
|
|
}
|
|
|
|
private void btnOK_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (cbMsfrTestCases.SelectedItem == null)
|
|
{
|
|
MessageBox.Show("Please select a test case", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
}
|
|
else
|
|
{
|
|
ClickedButton = Util.StandardButtons.OK_YES;
|
|
_logger.Info($"Selected MSFR test case: {cbMsfrTestCases.SelectedValue.ToString()}");
|
|
this.Hide();
|
|
}
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
ClickedButton = Util.StandardButtons.CANCEL_NO;
|
|
|
|
this.Hide();
|
|
|
|
}
|
|
|
|
private void PopulateTestCaseComboBox()
|
|
{
|
|
const string MSFR_TEST_CASE_SECTION_NAME = "MSFRParameterMsg";
|
|
List<string> keys = Program.Instance().ProgramSpecificConfig.ReadAllKeys(MSFR_TEST_CASE_SECTION_NAME);
|
|
foreach (string key in keys)
|
|
{
|
|
string val = Program.Instance().ProgramSpecificConfig.ReadValue(MSFR_TEST_CASE_SECTION_NAME, key);
|
|
int index = val.IndexOf(',');
|
|
string testCaseId = Regex.Replace(key, @"test_case_", @"", RegexOptions.IgnoreCase);
|
|
string testCaseDescription = $"{testCaseId}. {val.Substring(0, index)}";
|
|
cbMsfrTestCases.Items.Add(testCaseDescription);
|
|
}
|
|
}
|
|
}
|
|
}
|