Exemplo n.º 1
0
		// 登录
		void menu_login(object sender, System.EventArgs e)
		{
			if (this.SelectedNode == null) 
			{
				MessageBox.Show(this, "尚未选择节点");
				return;
			}

			ResPath respath = new ResPath(this.SelectedNode);

			this.channel = Channels.GetChannel(respath.Url);

			Debug.Assert(channel != null, "Channels.GetChannel() 异常");

			string strError;
			// return:
			//		-1	error
			//		0	login failed
			//		1	login succeed
			int nRet = channel.UiLogin(
				null,
				respath.Path,
				LoginStyle.FillDefaultInfo,
				out strError);


			this.channel = null;

			if (nRet == -1 || nRet == 0) 
			{
				MessageBox.Show(this, strError);
				return;
			}

			// 刷新
			ResPath OldPath = new ResPath(this.SelectedNode);

			respath.Path = "";
			ExpandPath(respath);	// 选中服务器,以下节点清除
			SetLoading(this.SelectedNode);

			ExpandPath(OldPath);

		}