// 登出 void menu_logout(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() 异常"); #if NO DigitalPlatform.Stop stop = null; if (stopManager != null) { stop = new DigitalPlatform.Stop(); stop.Register(this.stopManager, true); // 和容器关联 stop.OnStop += new StopEventHandler(this.DoStop); stop.Initial("正在登出: " + respath.FullPath); stop.BeginLoop(); } #endif DigitalPlatform.Stop stop = PrepareStop("正在登出: " + respath.FullPath); string strError; // return: // -1 error // 0 login failed // 1 login succeed long nRet = channel.DoLogout( out strError); EndStop(stop); #if NO if (stopManager != null) { stop.EndLoop(); stop.OnStop -= new StopEventHandler(this.DoStop); stop.Initial(""); stop.Unregister(); // 和容器关联 } #endif this.channel = null; if (nRet == -1) { MessageBox.Show(this, strError); return; } // 刷新 //ResPath OldPath = new ResPath(this.SelectedNode); respath.Path = ""; ExpandPath(respath); // 选中服务器,以下节点清除 SetLoading(this.SelectedNode); if (this.SelectedNode != null) this.SelectedNode.Collapse(); //ExpandPath(OldPath); }