NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

C# WPF UI Creation

I'm attempting to create a WPF application that contains various TestStand UI Elements. I've got the elements displaying however I can't get the sequence file to load in. I can select a file, press open and then a debug message will tell me the file path (which is correct) however axSequenceFileViewMgr doesn't seem to want to update with the contents of the sequence.

 

Here's my code for reference:

 

        private AxApplicationMgr mAppMgr;
        private AxSequenceView axSequenceView;
        private AxSequenceFileViewMgr axSequenceFileViewMgr;
        private AxButton axButton;

        private void WindowLoaded( object sender, RoutedEventArgs e )
        {
            WindowsFormsHost host = new WindowsFormsHost();
            mAppMgr = new AxApplicationMgr();
            host.Child = mAppMgr;
            main_layout.Children.Add(host);
            mAppMgr.Start();

            WindowsFormsHost seq_mgr = new WindowsFormsHost();
            axSequenceFileViewMgr = new AxSequenceFileViewMgr();
            seq_mgr.Child = axSequenceFileViewMgr;
            main_layout.Children.Add( seq_mgr );

            WindowsFormsHost button = new WindowsFormsHost();
            axButton = new AxButton();
            button.Child = axButton;
            main_layout.Children.Add( button );

            WindowsFormsHost seq_view = new WindowsFormsHost();
            axSequenceView = new AxSequenceView();
            seq_view.Child = axSequenceView;
            main_layout.Children.Add( seq_view );

            // Link the button to opening sequence file dlg
            axSequenceFileViewMgr.ConnectCommand(axButton, CommandKinds.CommandKind_OpenSequenceFiles, 0, CommandConnectionOptions.CommandConnection_NoOptions);

            // Event handler to detect when a file is opened
            mAppMgr.DisplaySequenceFile += new NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_DisplaySequenceFileEventHandler(this.axApplicationMgr_DisplaySequenceFile);
        }

        private void axApplicationMgr_DisplaySequenceFile( object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_DisplaySequenceFileEvent e )
        {
            MessageBox.Show(e.file.Path);
            axSequenceFileViewMgr.SequenceFile = e.file;
        }

So how do I go about linking axSequenceFileViewMgr and axSequenceView so that when the file is changed, the contents are displayed? 

0 Kudos
Message 1 of 2
(3,804 Views)
        private AxApplicationMgr mAppMgr;
        private AxSequenceView axSequenceView;
        private AxSequenceFileViewMgr axSequenceFileViewMgr;
        private AxButton axButton;

        private void WindowLoaded( object sender, RoutedEventArgs e )
        {
            WindowsFormsHost host = new WindowsFormsHost();
            mAppMgr = new AxApplicationMgr();
            host.Child = mAppMgr;
            main_layout.Children.Add(host);

            WindowsFormsHost seq_mgr = new WindowsFormsHost();
            axSequenceFileViewMgr = new AxSequenceFileViewMgr();
            seq_mgr.Child = axSequenceFileViewMgr;
            main_layout.Children.Add( seq_mgr );

            WindowsFormsHost button = new WindowsFormsHost();
            axButton = new AxButton();
            button.Child = axButton;
            main_layout.Children.Add( button );

            WindowsFormsHost seq_view = new WindowsFormsHost();
            axSequenceView = new AxSequenceView();
            seq_view.Child = axSequenceView;
            main_layout.Children.Add( seq_view );

            // Link the button to opening sequence file dlg
            axSequenceFileViewMgr.ConnectCommand(axButton, CommandKinds.CommandKind_OpenSequenceFiles, 0, CommandConnectionOptions.CommandConnection_NoOptions);

	    // connect sequence view to sequence file view manager
	    axSequenceFileViewMgr.ConnectSequenceView(axSequenceView);

            // Event handler to detect when a file is opened
            mAppMgr.DisplaySequenceFile += new NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_DisplaySequenceFileEventHandler(this.axApplicationMgr_DisplaySequenceFile);

	    mAppMgr.Start();
        }

        private void axApplicationMgr_DisplaySequenceFile( object sender, NationalInstruments.TestStand.Interop.UI.Ax._ApplicationMgrEvents_DisplaySequenceFileEvent e )
        {
            MessageBox.Show(e.file.Path);
            axSequenceFileViewMgr.SequenceFile = e.file;
        }

It looks like you did not connect the SequenceView to the SequenceFileViewMgr (see the added code above). I also recommend that you configure all of the manager controls before starting the ApplicationMgr (see the moved code above).

 

-Jeff

Message 2 of 2
(3,764 Views)