zoukankan      html  css  js  c++  java
  • 利用反射调出其他项目的界面

    主要针对问题:解决DLL循环调用的矛盾

    示例:

         private void buttonInsuranceClaims_Click(object sender, System.EventArgs e)
            {
                try
                {
                    Assembly AdvanceAssembly = Assembly.Load("DMS.Insurance.UI");
    
                    Type t = AdvanceAssembly.GetType("DMS.Insurance.UI.InsureMgr.RF_InsuranceClaimsDetailForm");
    
                    object obj = t.InvokeMember(null, 
                        BindingFlags.DeclaredOnly | 
                        BindingFlags.Public | BindingFlags.NonPublic | 
                        BindingFlags.Instance | BindingFlags.CreateInstance, null, null, null);
    
                    t.InvokeMember("m_RepairNo", 
                        BindingFlags.DeclaredOnly | 
                        BindingFlags.Public | BindingFlags.NonPublic | 
                        BindingFlags.Instance | BindingFlags.SetField, null, obj, new Object[] {m_RepairNo});
    
                    t.InvokeMember("m_FrameNo", 
                        BindingFlags.DeclaredOnly | 
                        BindingFlags.Public | BindingFlags.NonPublic | 
                        BindingFlags.Instance | BindingFlags.SetField, null, obj, new Object[] {m_FrameNo});
    
                    t.InvokeMember("InitViewForRepairCard", 
                        BindingFlags.Public | 
                        BindingFlags.Instance | BindingFlags.InvokeMethod, null, obj, null);
                
                    t.InvokeMember("ShowDialog", 
                        BindingFlags.Public | 
                        BindingFlags.Instance | BindingFlags.InvokeMethod, null, obj, null);
                }
                catch(System.Exception ex)
                {
                    MessageBox.Show("加载理赔定损窗体失败。
    
    错误信息:" + ex.Message,"加载窗体失败",MessageBoxButtons.OK,MessageBoxIcon.Error);
                }
            
            }

  • 相关阅读:
    C
    B
    A
    G
    BZOJ_1208_&_Codevs_1258_[HNOI2004]_宠物收养所_(平衡树/set)
    Codevs_1230_元素查找_(set/Hash)
    POJ_2503_Babelfish_(Trie/map)
    POJ_2001_Shortest_Prefixes_(Trie)
    BZOJ_3670_[NOI2014]_动物园_(kmp)
    BZOJ_3196_二逼平衡树_(树套树,线段树+Treap)
  • 原文地址:https://www.cnblogs.com/ShaYeBlog/p/3382161.html
Copyright © 2011-2022 走看看