Process file32; // 用来和tftpd32相关联的引用 #endregion //Declarations public CSTK_demonstration(CSimulationManager parent) : base() { // Create and Attach Som to federate Som = new STK_demonstration.Som.FederateSom(); this.SetSom(Som); simManager = parent; clear_flag = 0; // Create regions manually }
private void 加入联邦ToolStripMenuItem_Click(object sender, EventArgs e) { if (simulation == null) { simulation = new CSimulationManager(this); simulation.federation.FederateName = "STKDEMO"; } if (this.simulation.federate.FederateState == FederateStates.JOINED) { return; } //下面开始算是开始发功了,耗时 this.Cursor = Cursors.WaitCursor; bool result = true; for (int i = 0; i < 3; i++) { try { result = this.simulation.federate.InitializeFederation(simulation.federation); } catch { } if (!result) { Thread.Sleep(100); continue; } else { break; } } if (!result) { MessageBox.Show("加入联邦失败"); simulation = null; return; } //清理标志位 this.加入联邦ToolStripMenuItem.Enabled = false; this.退出联邦ToolStripMenuItem.Enabled = true; stFed.Text = "已加入联邦"; this.Cursor = Cursors.Default; display("已加入联邦"); }