Ejemplo n.º 1
0
        /// <summary>
        /// 绑定UMP服务器所配置的数据库
        /// </summary>
        /// <param name="selectedItem"></param>
        void BindDBInUMPServer(TreeViewItem root)
        {
            ServerInfomation server = root.Tag as ServerInfomation;
            List <DBInfo>    lstDBs = ServerConfigOperationInServer.GetAllDBs(server.Host, server.Port);
            TreeViewItem     dbItem;
            string           strDBType = string.Empty;

            for (int i = 0; i < lstDBs.Count; i++)
            {
                dbItem = new TreeViewItem();
                switch (lstDBs[i].DbType)
                {
                case (int)Enums.DBType.MSSQL:
                    strDBType = "MSSQL";
                    break;

                case (int)Enums.DBType.MySql:
                    strDBType = "MySql";
                    break;

                case (int)Enums.DBType.Oracle:
                    strDBType = "Oracle";
                    break;
                }
                dbItem.Header      = lstDBs[i].Host + " (" + strDBType + ")";
                dbItem.DataContext = "DB-" + lstDBs[i].Host;
                dbItem.Tag         = lstDBs[i];
                TreeViewItemProps.SetItemImageName(dbItem, System.IO.Path.Combine(App.GStrApplicationDirectory, @"Images\00000015.ico"));
                dbItem.SetResourceReference(TreeViewItem.StyleProperty, "TreeViewItemWithImg");
                root.Items.Add(dbItem);
            }
        }
        void LoginWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            List <string> lstArgs = e.Argument as List <string>;

            //获得该UMP服务器上配置的数据库信息
            lstDBsInUmp = ServerConfigOperationInServer.GetAllDBs(lstArgs[1], lstArgs[2]);

            string strHostName = System.Net.Dns.GetHostName();

            LoginResult = ServerConfigOperationInServer.UserLogin(lstArgs[1], lstArgs[2], lstArgs[3], lstArgs[4], lstArgs[0], strHostName);
        }