Esempio n. 1
0
        private static void CreateInstance(Type FormType)
        {
            object obj = FormType.InvokeMember(null,
                                               BindingFlags.DeclaredOnly |
                                               BindingFlags.Public |
                                               BindingFlags.NonPublic |
                                               BindingFlags.Instance |
                                               BindingFlags.CreateInstance, null, null, null);

            m_SplashForm      = obj as Form;
            m_SplashInterface = obj as ISplashForm;
            if (m_SplashForm == null)
            {
                throw (new Exception("Splash Screen must inherit from System.Windows.Forms.Form"));
            }
            if (m_SplashInterface == null)
            {
                throw (new Exception("must implement interface ISplashForm"));
            }

            if (!string.IsNullOrEmpty(m_TempStatus))
            {
                m_SplashInterface.SetStatusInfo(m_TempStatus);
            }
        }
Esempio n. 2
0
        private static void CreateInstance(Type FormType)
        {
            object obj = Activator.CreateInstance(FormType);

            m_SplashForm      = obj as Form;
            m_SplashInterface = obj as ISplashForm;
            if (m_SplashForm == null)
            {
                throw new Exception("Splash Screen must inherit from System.Windows.Forms.Form");
            }
            if (m_SplashInterface == null)
            {
                throw new Exception("must implement interface ISplashForm");
            }
            if (!string.IsNullOrEmpty(m_TempStatus))
            {
                m_SplashInterface.SetStatusInfo(m_TempStatus);
            }
        }
Esempio n. 3
0
        private static void CreateInstance(Type FormType)
        {
            //利用反射创建对象
            object obj = Activator.CreateInstance(FormType);

            m_SplashForm      = obj as Form;
            m_SplashInterface = obj as ISplashForm;
            if (m_SplashForm == null)
            {
                throw (new Exception("Splash必须继承自System.Windows.Forms.Form"));
            }
            if (m_SplashInterface == null)
            {
                throw (new Exception("must implement interface ISplashForm/必须实现界面异构"));
            }

            if (!string.IsNullOrEmpty(m_TempStatus))
            {
                m_SplashInterface.SetStatusInfo(m_TempStatus);
            }
        }
Esempio n. 4
0
        private static void CreateInstance(Type FormType)
        {
            object obj = FormType.InvokeMember(null,
                                BindingFlags.DeclaredOnly |
                                BindingFlags.Public | BindingFlags.NonPublic |
                                BindingFlags.Instance | BindingFlags.CreateInstance, null, null, null);
            m_SplashForm = obj as Form;
            m_SplashInterface = obj as ISplashForm;
            if (m_SplashForm == null)
            {
                throw (new Exception("Splash Screen must inherit from System.Windows.Forms.Form"));
            }
            if (m_SplashInterface == null)
            {
                throw (new Exception("must implement interface ISplashForm"));
            }

            if (!string.IsNullOrEmpty(m_TempStatus))
                m_SplashInterface.SetStatusInfo(m_TempStatus);
        }
Esempio n. 5
0
 private static void createInstance(Type FormType)
 {
     object obj = FormType.InvokeMember(null, System.Reflection.BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.CreateInstance, null, null, null);
     splashForm = obj as Form;
     splashInterface = obj as ISplashForm;
     if (splashForm == null)
     {
         throw new Exception("启动窗体类型必须是System.Windows.Forms.Form的子类");
     }
     if (splashInterface == null)
     {
         throw new Exception("启动窗体必须实现ISplashForm接口");
     }
     if (!string.IsNullOrEmpty(tempStatus))
     {
         splashInterface.SetStatusInfo(tempStatus);
     }
 }