Example #1
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;
        }
Example #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;
        }
Example #3
0
        public FrmRuntime()
        {
            FrmLoging   frmLogin = null;
            bool        flag     = true;
            ThreadStart t        = delegate
            {
                frmLogin = new FrmLoging();
                flag     = false;
                frmLogin.ShowDialog();
            };
            Thread thread = new Thread(t);

            thread.Start();

            while (flag)
            {
                Thread.Sleep(10);
            }

            frmLogin.SetMessage("正在加载框架界面方案...");

            InitializeComponent();

            frmLogin.SetMessage("正在创建三维控件对象...");
            this.Text = ConfigManager.AppName;
            splitControlMain.PanelVisibility = SplitPanelVisibility.Panel1;


            TerraExplorerX.SGWorld61 sgwTopLeft;
            TerraExplorerX.SGWorld61 sgwTopRight;
            TerraExplorerX.SGWorld61 sgwBottomLeft;
            TerraExplorerX.SGWorld61 sgwBottomRight;
            this.uC3DWindow1.CreateHooker(out sgwTopLeft, out sgwTopRight, out sgwBottomLeft, out sgwBottomRight);

            frmLogin.SetMessage("正在创建绑定对象...");
            FrameHook hook = new FrameHook(this, new TerraExplorerX.TerraExplorerClass(), sgwTopLeft, this.axMapControl1.Object as ESRI.ArcGIS.Controls.IMapControl4, this.dockPanelRight);

            // 测试
            // // Dictionary<string, Utility.enumCommandType> d = Utility.CommandFactory.GetCommandClasses(@"C:\Program Files (x86)\ArcGIS\DeveloperKit10.0\DotNet\ESRI.ArcGIS.Controls.dll");
            //  Dictionary<string, enumResourceType> dic = Utility.ResourceFactory.GetResources(@"C:\Program Files (x86)\ArcGIS\DeveloperKit10.0\DotNet\ESRI.ArcGIS.Controls.dll");
            // int count = dic.Count;
            //// List<Utility.RibbonCommandInfo>
            //     infoList = new List<RibbonCommandInfo>();
            // for (int i = 0; i < count; i++)
            // {
            //     RibbonCommandInfo info = new RibbonCommandInfo();

            //     ClassInfo cInfo = new ClassInfo();
            //     cInfo.DllName = "ESRI.ArcGIS.Controls.dll";
            //     cInfo.ClassName = dic.Keys.ElementAt(i);// +", ESRI.ArcGIS.Controls";

            //     info.CommandClass = cInfo;
            //     info.Page = "ESRI";
            //     info.PageGroup = "ESRI命令测试";

            //     infoList.Add(info);
            // }
            IList listPlugin = Environment.NHibernateHelper.GetObjectByCondition("from ClassInfo cInfo where cInfo.Type=1");

            foreach (object cInfo in listPlugin)
            {
                IPlugin plugin = Utility.ResourceFactory.CreatePlugin(cInfo as ClassInfo);
                if (plugin != null)
                {
                    plugin.Logger           = Environment.Logger;
                    plugin.NhibernateHelper = Environment.NHibernateHelper;
                    plugin.SysConnection    = Environment.SysDbConnection;
                    plugin.GisWorkspace     = Environment.Workspace;
                }
            }

            frmLogin.SetMessage("正在读取界面配置...");
            IList listCommand = Environment.NHibernateHelper.GetObjectByCondition("from RibbonCommandInfo rcInfo order by Order asc");;

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

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


            frmLogin.SetMessage("正在创建资源...");
            cmdEngine = new RibbonEngine();
            cmdEngine.CommandInfoList   = infoList;
            cmdEngine.Ribbon            = this.ribbon;
            cmdEngine.OnMessageChanged += delegate(string strMsg)
            {
                Utility.Log.AppendMessage(enumLogType.Operate, strMsg);
                frmLogin.SetMessage(strMsg);
            };

            //List<ICommand>
            cmdList = 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);

            cmdEngine.Load(ref cmdList);


            frmLogin.SetMessage("正在绑定资源...");
            //RibbonCommandAdapter
            cmdAdapter = new RibbonCommandAdapter(hook);
            cmdAdapter.OnMessageChanged += delegate(string strMsg)
            {
                //this.statusBarMessage.Caption = strMsg;
                frmLogin.SetMessage(strMsg);
            };
            cmdAdapter.Adapter(this.ribbon);
            cmdAdapter.AddCommands(cmdList.ToArray());


            axTOCControl1.SetBuddyControl(this.axMapControl1);

            frmLogin.SetMessage("正在绘制界面...");
            Thread.Sleep(1000);

            thread.Abort();
        }
Example #4
0
        public FrmRuntime()
        {
            FrmLoging frmLogin = null;
            bool flag = true;
            ThreadStart t = delegate
            {
                frmLogin= new FrmLoging();
                flag = false;
                frmLogin.ShowDialog();
            };
            Thread thread = new Thread(t);
            thread.Start();

            while (flag)
            {
                Thread.Sleep(10);
            }

            frmLogin.SetMessage("正在加载框架界面方案...");

            InitializeComponent();

            frmLogin.SetMessage("正在创建三维控件对象...");
            this.Text = ConfigManager.AppName;
            splitControlMain.PanelVisibility = SplitPanelVisibility.Panel1;

            TerraExplorerX.SGWorld61 sgwTopLeft;
            TerraExplorerX.SGWorld61 sgwTopRight;
            TerraExplorerX.SGWorld61 sgwBottomLeft;
            TerraExplorerX.SGWorld61 sgwBottomRight;
            this.uC3DWindow1.CreateHooker(out sgwTopLeft, out sgwTopRight, out sgwBottomLeft, out sgwBottomRight);

            frmLogin.SetMessage("正在创建绑定对象...");
            FrameHook hook = new FrameHook(this, new TerraExplorerX.TerraExplorerClass(), sgwTopLeft, this.axMapControl1.Object as ESRI.ArcGIS.Controls.IMapControl4, this.dockPanelRight);

            // 测试
               // // Dictionary<string, Utility.enumCommandType> d = Utility.CommandFactory.GetCommandClasses(@"C:\Program Files (x86)\ArcGIS\DeveloperKit10.0\DotNet\ESRI.ArcGIS.Controls.dll");
               //  Dictionary<string, enumResourceType> dic = Utility.ResourceFactory.GetResources(@"C:\Program Files (x86)\ArcGIS\DeveloperKit10.0\DotNet\ESRI.ArcGIS.Controls.dll");
               // int count = dic.Count;
               //// List<Utility.RibbonCommandInfo>
               //     infoList = new List<RibbonCommandInfo>();
               // for (int i = 0; i < count; i++)
               // {
               //     RibbonCommandInfo info = new RibbonCommandInfo();

               //     ClassInfo cInfo = new ClassInfo();
               //     cInfo.DllName = "ESRI.ArcGIS.Controls.dll";
               //     cInfo.ClassName = dic.Keys.ElementAt(i);// +", ESRI.ArcGIS.Controls";

               //     info.CommandClass = cInfo;
               //     info.Page = "ESRI";
               //     info.PageGroup = "ESRI命令测试";

               //     infoList.Add(info);
               // }
            IList listPlugin = Environment.NHibernateHelper.GetObjectByCondition("from ClassInfo cInfo where cInfo.Type=1");
            foreach (object cInfo in listPlugin)
            {
                IPlugin plugin= Utility.ResourceFactory.CreatePlugin(cInfo as ClassInfo);
                if (plugin != null)
                {
                    plugin.Logger = Environment.Logger;
                    plugin.NhibernateHelper = Environment.NHibernateHelper;
                    plugin.SysConnection = Environment.SysDbConnection;
                    plugin.GisWorkspace = Environment.Workspace;
                }
            }

            frmLogin.SetMessage("正在读取界面配置...");
            IList listCommand = Environment.NHibernateHelper. GetObjectByCondition("from RibbonCommandInfo rcInfo order by Order asc"); ;

            infoList = new List<RibbonCommandInfo>();
            int count = listCommand.Count;
            for (int i = 0; i < count; i++)
            {
                infoList.Add(listCommand[i] as RibbonCommandInfo);
            }

            frmLogin.SetMessage("正在创建资源...");
            cmdEngine = new RibbonEngine();
            cmdEngine.CommandInfoList = infoList;
            cmdEngine.Ribbon = this.ribbon;
            cmdEngine.OnMessageChanged += delegate(string strMsg)
            {
                Utility.Log.AppendMessage(enumLogType.Operate, strMsg);
                frmLogin.SetMessage(strMsg);
            };

            //List<ICommand>
                cmdList=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);

            cmdEngine.Load(ref cmdList);

            frmLogin.SetMessage("正在绑定资源...");
            //RibbonCommandAdapter
                cmdAdapter = new RibbonCommandAdapter(hook);
            cmdAdapter.OnMessageChanged += delegate(string strMsg)
            {
                //this.statusBarMessage.Caption = strMsg;
                frmLogin.SetMessage(strMsg);
            };
            cmdAdapter.Adapter(this.ribbon);
            cmdAdapter.AddCommands(cmdList.ToArray());

            axTOCControl1.SetBuddyControl(this.axMapControl1);

            frmLogin.SetMessage("正在绘制界面...");
            Thread.Sleep(1000);

            thread.Abort();
        }