Ejemplo n.º 1
1
		public Form1(Inventor.Application oApp)
		{
			
			// This call is required by the Windows Form Designer.
			InitializeComponent();
			
			// Add any initialization after the InitializeComponent() call.
			_macros = new Macros(oApp);
			
			MemberInfo[] methods = _macros.GetType().GetMembers();
			
			foreach (MemberInfo member in methods)
			{
				if (member.DeclaringType.Name == "Macros" && member.MemberType == MemberTypes.Method)
				{
					ComboBoxMacros.Items.Add(member.Name);
				}
			}
			
			if (ComboBoxMacros.Items.Count > 0)
			{
				ComboBoxMacros.SelectedIndex = 0;
				Button1.Enabled = true;
			}
			
		}
Ejemplo n.º 2
0
        public void Button1_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                string memberName = ComboBoxMacros.SelectedItem.ToString();

                object[] @params = null;
                _macros.GetType().InvokeMember(memberName, BindingFlags.InvokeMethod, null, _macros, @params, null, null, null);
            }
            catch (Exception ex)
            {
                string            Caption = ex.Message;
                MessageBoxButtons Buttons = MessageBoxButtons.OK;
                DialogResult      Result  = MessageBox.Show(ex.StackTrace, Caption, Buttons, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                _InvApplication = (Inventor.Application)Marshal.GetActiveObject("Inventor.Application");
            }
            catch(Exception ex)
            {
                MessageBox.Show("make sure an Inventor instance is launched!");
                return;
            }

            // Add any initialization after the InitializeComponent() call.
            _macros = new Macros(_InvApplication);

            MemberInfo[] methods = _macros.GetType().GetMembers();

            foreach (MemberInfo member in methods)
            {
                if ((member.DeclaringType.Name == "Macros" & member.MemberType == MemberTypes.Method))
                {
                    ComboBoxMacros.Items.Add(member.Name);
                }
            }

            if (ComboBoxMacros.Items.Count > 0)
            {
                ComboBoxMacros.SelectedIndex = 0;
                button1.Enabled = true;
            }


            //=======================================================
            //Service provided by Telerik (www.telerik.com)
            //Conversion powered by NRefactory.
            //Built and maintained by Todd Anglin and Telerik
            //=======================================================

        }
Ejemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                _InvApplication = (Inventor.Application)Marshal.GetActiveObject("Inventor.Application");
            }
            catch (Exception ex)
            {
                MessageBox.Show("make sure an Inventor instance is launched!");
                return;
            }

            // Add any initialization after the InitializeComponent() call.
            _macros = new Macros(_InvApplication);

            MemberInfo[] methods = _macros.GetType().GetMembers();

            foreach (MemberInfo member in methods)
            {
                if ((member.DeclaringType.Name == "Macros" & member.MemberType == MemberTypes.Method))
                {
                    ComboBoxMacros.Items.Add(member.Name);
                }
            }

            if (ComboBoxMacros.Items.Count > 0)
            {
                ComboBoxMacros.SelectedIndex = 0;
                button1.Enabled = true;
            }


            //=======================================================
            //Service provided by Telerik (www.telerik.com)
            //Conversion powered by NRefactory.
            //Built and maintained by Todd Anglin and Telerik
            //=======================================================
        }
Ejemplo n.º 5
0
        public Form1(Inventor.Application oApp)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            // Add any initialization after the InitializeComponent() call.
            _macros = new Macros(oApp);

            MemberInfo[] methods = _macros.GetType().GetMembers();

            foreach (MemberInfo member in methods)
            {
                if (member.DeclaringType.Name == "Macros" && member.MemberType == MemberTypes.Method)
                {
                    ComboBoxMacros.Items.Add(member.Name);
                }
            }

            if (ComboBoxMacros.Items.Count > 0)
            {
                ComboBoxMacros.SelectedIndex = 0;
                Button1.Enabled = true;
            }
        }