alielie
2026-06-15 f08871fe7d148d667f2f11f80f64de71a0d9504c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using CommunityToolkit.Mvvm.ComponentModel;
using NationalInstruments.TestStand.Interop.API;
using NationalInstruments.TestStand.Interop.UI.Ax;
using System.Windows;
using System.Windows.Forms.Integration;
 
namespace StationGlobalsReader;
 
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
[ObservableObject]
public partial class MainWindow : Window
{
    public MainWindow()
    {
        axApplicationMgr = new AxApplicationMgr();
        InitializeComponent();
 
        this.engine = axApplicationMgr.GetEngine();
        this.engine.PersistBreakpoints = false;
        this.axApplicationMgr.IsEditor = true;
        this.axApplicationMgr.LoginOnStart = false;
        this.axApplicationMgr.Start();
        ((System.ComponentModel.ISupportInitialize)(axApplicationMgr)).BeginInit();
        host.Child = axApplicationMgr;
        ((System.ComponentModel.ISupportInitialize)(axApplicationMgr)).EndInit();
    }
    private AxApplicationMgr axApplicationMgr;
 
    private Engine engine = null;
 
    [ObservableProperty]
    private string propertyName;
 
    [ObservableProperty]
    private string target;
 
    private void Button_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            Target = engine.Globals.GetValString($"StationGlobals.{PropertyName}", 0);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }
    }
}