Ejemplo n.º 1
0
        public bool Login(ref global::Define.IApplication application)
        {
            ThreadStart d = delegate { this.ShowDialog(); };
            Thread      t = new Thread(d);

            t.Start();
            return(true);
        }
Ejemplo n.º 2
0
        public FrmRuntime()
        {
            // 加载登陆
            string[] strSplit   = { "," };
            string[] strLoginor = ConfigManager.Loginor.Split(strSplit, StringSplitOptions.RemoveEmptyEntries);
            ILogin   loginor    = ResourceFactory.CreateInstance(strLoginor[0], strLoginor[1]) as Frame.Define.ILogin;

            if (loginor == null)
            {
                loginor = new FrmLogin();
            }

            loginor.Logger           = Environment.LogWriter;
            loginor.NhibernateHelper = Environment.NHibernateHelper;
            loginor.AdodbHelper      = Environment.AdodbHelper;
            global::Define.IApplication app = Environment.Application;
            if (!loginor.Login(ref app))
            {
                Application.Exit();
                return;
            }
            Environment.Application = app;

            loginor.ShowMessage("正在验证GIS控件权限...");
            string errMsg = null;

            if (!Environment.ResourceManager.LicenseVerify(ref errMsg))
            {
                MessageBox.Show(errMsg);
                Application.Exit();
                return;
            }


            loginor.ShowMessage("正在加载框架界面方案...");
            InitializeComponent();
            this.Text = ConfigManager.AppName;
            this.Icon = ConfigManager.Logo;
            //splitControlMain.PanelVisibility = SplitPanelVisibility.Panel1;


            loginor.ShowMessage("正在创建GIS控件对象...");
            IHooker hooker = Environment.ResourceManager.GetHooker();

            this.m_MainHookPage = this.AddHooker(hooker, enumDockPosition.Center) as XtraTabPage;
            this.Hook           = hooker.Hook;
            //Control hookControl = hooker.Control;
            //if (hookControl != null)
            //{
            //    if (hookControl is System.ComponentModel.ISupportInitialize) ((System.ComponentModel.ISupportInitialize)(hookControl)).BeginInit();
            //    //this.splitControlMain.Panel1.Controls.Add(hookControl);
            //    this.tpDefalut.Controls.Add(hookControl);
            //    this.tpDefalut.Text = hooker.Caption;
            //    hookControl.Dock = DockStyle.Fill;
            //    if (hookControl is System.ComponentModel.ISupportInitialize) ((System.ComponentModel.ISupportInitialize)(hookControl)).EndInit();
            //}
            //this.Hook = hooker.Hook;
            //this.m_DictHooker[hooker.ID] = this.tpDefalut;

            loginor.ShowMessage("正在加载插件...");
            IList <Define.ClassInfo> listPlugin = Environment.NHibernateHelper.GetObjectsByCondition <Define.ClassInfo>("from ClassInfo cInfo where cInfo.Type=1");

            foreach (Define.ClassInfo cInfo in listPlugin)
            {
                IPlugin plugin = Utility.ResourceFactory.CreatePlugin(cInfo);
                if (plugin != null)
                {
                    plugin.Logger           = Environment.LogWriter;
                    plugin.NhibernateHelper = Environment.NHibernateHelper;
                    plugin.AdodbHelper      = Environment.AdodbHelper;
                    plugin.GisWorkspace     = Environment.Workspace;
                    plugin.Application      = Environment.Application;
                }
            }

            loginor.ShowMessage("正在读取界面配置...");
            IList <RibbonCommandInfo> listCommand = Environment.NHibernateHelper.GetObjectsByCondition <RibbonCommandInfo>("from RibbonCommandInfo rcInfo order by Order asc");;

            m_CommandInfoList = new List <RibbonCommandInfo>();
            int count = listCommand.Count;

            for (int i = 0; i < count; i++)
            {
                m_CommandInfoList.Add(listCommand[i]);
            }


            loginor.ShowMessage("正在创建资源...");
            ribbonEngine = new RibbonEngine();
            ribbonEngine.CommandInfoList   = m_CommandInfoList;
            ribbonEngine.Ribbon            = this.ribbon;
            ribbonEngine.MainMenu          = this.mainMenu;
            ribbonEngine.CommandInfoFinder = delegate(string resourceID)
            {
                return(m_CommandInfoList.Find(delegate(RibbonCommandInfo cmdInfo) { return cmdInfo.ID == resourceID; }));
            };
            ribbonEngine.OnMessage += delegate(string strMsg)
            {
                Utility.Log.AppendMessage(enumLogType.Operate, strMsg);
                loginor.ShowMessage(strMsg);
            };

            //List<ICommand>
            m_CommandList = new List <ICommand>();
            //cmdList.Add(new Commands.CommandLinkage());
            //cmdList.Add(new Utility.EsriCommandProxy(new ESRI.ArcGIS.Controls.ControlsAddDataCommandClass()));
            //cmdEngine.LoadFromCommand(new Commands.CommandLinkage(), "ESRI", "ESRI命令In Frame",null,null);
            //cmdEngine.LoadFromCommand(new Utility.EsriCommandProxy(new ESRI.ArcGIS.Controls.ControlsAddDataCommandClass()), "ESRI", "ESRI命令In Frame",null,null);

            ribbonEngine.Load(ref m_CommandList);


            loginor.ShowMessage("正在绑定资源...");
            //RibbonCommandAdapter
            m_Adapter            = new RibbonCommandAdapter(this);
            m_Adapter.OnMessage += delegate(string strMsg)
            {
                this.statusBarMessage.Caption = strMsg;
                Application.DoEvents();
                //frmLogin.SetMessage(strMsg);
            };
            m_Adapter.Adapter(this.ribbon);
            m_Adapter.AddCommands(m_CommandList.ToArray());

            loginor.ShowMessage("正在绘制界面...");
            Thread.Sleep(1000);

            loginor.Dispose();

            //this.dockPanelBottom.Visibility = DockVisibility.Hidden;
            //this.dockPanelLeft.Visibility = DockVisibility.Hidden;
            //this.dockPanelRight.Visibility = DockVisibility.Hidden;
            this.defaultLookAndFeel1.LookAndFeel.SkinName = Properties.Settings.Default.SkinName;
        }