Beispiel #1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            string   path   = System.IO.Directory.GetParent(Application.ExecutablePath) + "\\ADS7828.dll";
            Assembly guiLib = Assembly.LoadFile(path);
            //Type t = guiLib.GetType("I2CDIO8.MyGUI");
            Type         t   = guiLib.GetType("ADS7828.MyGUI");
            GuiInterface gui = (GuiInterface)Activator.CreateInstance(t);
            CommObj      obj = new CommObj(this);

            gui.Show(obj);
        }
Beispiel #2
0
        private void tvCommands_DoubleClick(object sender, EventArgs e)
        {
            TreeNode nd = tvCommands.SelectedNode;

            if (nd != null)
            {
                if (nd.Tag is DeviceCommand)
                {
                    DeviceCommand cmd = (DeviceCommand)nd.Tag;
                    txtQuickSend.Text   = cmd.GetSendDataString(GetFormat() == emViewFormat.Hex);
                    chkWrite.Checked    = cmd.Write;
                    chkRead.Checked     = cmd.ReadDataLength > 0;
                    numReadLength.Value = cmd.ReadDataLength;
                    Send();
                }
                else if (nd.Tag is DeviceGUICommand)
                {
                    string path = "";
                    try
                    {
                        DeviceGUICommand cmd = (DeviceGUICommand)nd.Tag;
                        path = System.IO.Directory.GetParent(Application.ExecutablePath) + "\\" + cmd.GUIPath;
                        Assembly guiLib = Assembly.LoadFile(path);
                        //Type t = guiLib.GetType("I2CDIO8.MyGUI");
                        Type         t   = guiLib.GetType(cmd.TypeName);
                        GuiInterface gui = (GuiInterface)Activator.CreateInstance(t);
                        CommObj      obj = new CommObj(this);

                        gui.Show(obj);
                    }
                    catch
                    {
                        MessageBox.Show("Fail to load GUI " + path);
                    }
                }
            }
        }
Beispiel #3
0
        private void tvCommands_DoubleClick(object sender, EventArgs e)
        {
            TreeNode nd = tvCommands.SelectedNode;
            if (nd != null)
            {
                if (nd.Tag is DeviceCommand)
                {
                    DeviceCommand cmd = (DeviceCommand)nd.Tag;
                    txtQuickSend.Text = cmd.GetSendDataString(GetFormat() == emViewFormat.Hex);
                    chkWrite.Checked = cmd.Write;
                    chkRead.Checked = cmd.ReadDataLength > 0;
                    numReadLength.Value = cmd.ReadDataLength;
                    Send();
                }
                else if (nd.Tag is DeviceGUICommand)
                {
                    try
                    {
                        DeviceGUICommand cmd = (DeviceGUICommand)nd.Tag;
                        string path = System.IO.Directory.GetParent(Application.ExecutablePath) + "\\" + cmd.GUIPath;
                        Assembly guiLib = Assembly.LoadFile(path);
                        //Type t = guiLib.GetType("I2CDIO8.MyGUI");
                        Type t = guiLib.GetType(cmd.TypeName);
                        GuiInterface gui = (GuiInterface)Activator.CreateInstance(t);
                        CommObj obj = new CommObj(this);

                        gui.Show(obj);
                    }
                    catch
                    {
                        MessageBox.Show("Fail to load GUI ");
                    }


                }
            }
        }
Beispiel #4
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            string path = System.IO.Directory.GetParent(Application.ExecutablePath) + "\\ADS7828.dll";
            Assembly guiLib = Assembly.LoadFile(path);
            //Type t = guiLib.GetType("I2CDIO8.MyGUI");
            Type t = guiLib.GetType("ADS7828.MyGUI");
            GuiInterface gui = (GuiInterface)Activator.CreateInstance(t);
            CommObj obj = new CommObj(this);
            
            gui.Show(obj);

        }