コード例 #1
0
ファイル: frmMain.cs プロジェクト: taylor-an/AnyI2C
        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);
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: taylor-an/AnyI2C
        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);
                    }
                }
            }
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: gurvindrasingh/AnyI2C
        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 ");
                    }


                }
            }
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: gurvindrasingh/AnyI2C
        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);

        }