コード例 #1
0
        public SelectChannelsDialog(SetMultipleChannelsDialogDGV CallingForm)
        {
            InitializeComponent();

            //Set up Variable objects
            CallingFormGlobal     = CallingForm;
            sysDefPath            = CallingFormGlobal.sysDefPath;
            channelNamesList      = CallingFormGlobal.channelNamesList;
            channelValuesArray    = CallingFormGlobal.channelValuesArray;
            channelNamesListOld   = CallingFormGlobal.channelNamesListOld;
            channelValuesArrayOld = CallingFormGlobal.channelValuesArrayOld;
            channelType           = (ChannelType)CallingFormGlobal.channelType;
            baseNodeArray         = CallingFormGlobal.baseNodeArray;
            baseNodeElement       = CallingFormGlobal.baseNodeElement;

            this.loggingChannelSelection.ShowCheckBox = true;

            //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the TreeAliasBrowserWF.
            if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf")
            {
                //File exists with correct extension so try and populate the tree
                InitializeListBox(sysDefPath);
            }
            //If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath.
            else //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)))
            {
                //Do nothing
            }
        }
        public SelectChannelsDialog(SetMultipleChannelsDialogDGV CallingForm)
        {
            InitializeComponent();

            //Set up Variable objects
            CallingFormGlobal     = CallingForm;
            sysDefPath            = CallingFormGlobal.sysDefPath;
            channelNamesList      = CallingFormGlobal.channelNamesList;
            channelValuesArray    = CallingFormGlobal.channelValuesArray;
            channelNamesListOld   = CallingFormGlobal.channelNamesListOld;
            channelValuesArrayOld = CallingFormGlobal.channelValuesArrayOld;
            channelType           = (ChannelType)CallingFormGlobal.channelType;
            baseNodeArray         = CallingFormGlobal.baseNodeArray;

            // These changes are in the 2014 VeriStand trunk so as soon as we start using that assembly we should revert these changes.
            // This is a hack for now to get check boxes on the Windows Form TreeAliasBrowserWF.

            Type      TreeAliasBrowser      = typeof(StorageChannelAndAliasBrowser);
            FieldInfo m_ChanAliasWPFElement = typeof(NationalInstruments.VeriStand.SystemStorageUI.WinFormsWrapper.TreeAliasBrowserWF).GetField(
                "m_ChanAliasWPFElement",
                BindingFlags.NonPublic |
                BindingFlags.Instance);
            FieldInfo aliasBrowserInfo = TreeAliasBrowser.GetField(
                "AliasTab",
                BindingFlags.NonPublic |
                BindingFlags.Instance);
            FieldInfo treeviewInfo = TreeAliasBrowser.GetField(
                "TreeView",
                BindingFlags.NonPublic |
                BindingFlags.Instance);
            var topLevelBrowser = (StorageChannelAndAliasBrowser)m_ChanAliasWPFElement.GetValue(loggingChannelSelection);

            this._aliasBrowser = (SystemDefinitionBrowser)aliasBrowserInfo.GetValue(topLevelBrowser);
            this._treeView     = (SystemDefinitionBrowser)treeviewInfo.GetValue(topLevelBrowser);
            this._aliasBrowser.ShowCheckBox = true;
            this._treeView.ShowCheckBox     = true;

            //If the file at path FileGlobals.Veristand.SystemDefinitionPath exists and the extension is ".nivssdf" use that System Definition file to initialize the TreeAliasBrowserWF.
            if (System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)) && System.IO.Path.GetExtension(StringUtilities.unparseFilePathString(sysDefPath)) == ".nivssdf")
            {
                //File exists with correct extension so try and populate the tree
                InitializeListBox(sysDefPath);
            }
            //If FileGlobals.Veristand.SystemDefinitionPath is empty or the file does not exist at path FileGlobals.Veristand.SystemDefinitionPath.
            else //(sysDefPath == "" || !System.IO.File.Exists(StringUtilities.unparseFilePathString(sysDefPath)))
            {
                //Do nothing
            }
        }