本文整理汇总了C#中Springie.Client.TasClient.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# TasClient.Connect方法的具体用法?C# TasClient.Connect怎么用?C# TasClient.Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Springie.Client.TasClient
的用法示例。
在下文中一共展示了TasClient.Connect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
public bool Start()
{
if (config.AttemptToRecconnect) {
recon = new Timer(config.AttemptReconnectInterval*1000);
recon.Elapsed += new ElapsedEventHandler(recon_Elapsed);
}
recon.Enabled = false;
try {
spring = new Spring(config.SpringPath);
} catch {
MessageBox.Show("Spring not found in " + config.SpringPath, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
OpenFileDialog od = new OpenFileDialog();
od.FileName = Spring.ExecutableName;
od.DefaultExt = Path.GetExtension(Spring.ExecutableName);
od.InitialDirectory = config.SpringPath;
od.Title = "Please select your spring installation";
od.RestoreDirectory = true;
od.CheckFileExists = true;
od.CheckPathExists = true;
od.AddExtension = true;
od.Filter = "Executable (*.exe)|*.exe";
DialogResult dr = od.ShowDialog();
if (dr == DialogResult.OK) {
config.SpringPath = Path.GetDirectoryName(od.FileName);
SaveConfig();
try {
spring = new Spring(config.SpringPath);
} catch (Exception e) {
MessageBox.Show(e.ToString(), "Error while checking spring, exiting");
Application.Exit();
return false;
}
} else {
MessageBox.Show("Spring not found, exiting");
Application.Exit();
return false;
}
}
tas = new TasClient();
tas.ConnectionLost += new EventHandler<TasEventArgs>(tas_ConnectionLost);
tas.Connected += new EventHandler<TasEventArgs>(tas_Connected);
tas.LoginDenied += new EventHandler<TasEventArgs>(tas_LoginDenied);
tas.LoginAccepted += new EventHandler<TasEventArgs>(tas_LoginAccepted);
tas.Said += new EventHandler<TasSayEventArgs>(tas_Said);
tas.MyStatusChangedToInGame += new EventHandler<TasEventArgs>(tas_MyStatusChangedToInGame);
spring.SpringExited += new EventHandler(spring_SpringExited);
spring.SpringStarted += new EventHandler(spring_SpringStarted);
spring.PlayerSaid += new EventHandler<SpringLogEventArgs>(spring_PlayerSaid);
autoHost = new AutoHost(tas, spring, null);
autoUpdater = new AutoUpdater(spring, tas);
if (config.StatsEnabled) stats = new Stats(tas, spring);
try {
tas.Connect(config.ServerHost, config.ServerPort);
} catch {
recon.Start();
}
return true;
}
示例2: Start
public bool Start()
{
if (config.AttemptToRecconnect) {
recon = new Timer(config.AttemptReconnectInterval*1000);
recon.Elapsed += recon_Elapsed;
}
recon.Enabled = false;
spring = new Spring();
tas = new TasClient();
tas.ConnectionLost += tas_ConnectionLost;
tas.Connected += tas_Connected;
tas.LoginDenied += tas_LoginDenied;
tas.LoginAccepted += tas_LoginAccepted;
tas.Said += tas_Said;
tas.MyStatusChangedToInGame += tas_MyStatusChangedToInGame;
tas.ChannelUserAdded += tas_ChannelUserAdded;
spring.SpringExited += spring_SpringExited;
spring.SpringStarted += spring_SpringStarted;
spring.PlayerSaid += spring_PlayerSaid;
autoHost = new AutoHost(tas, spring, null);
if (config.PlanetWarsEnabled) InitializePlanetWarsServer();
autoUpdater = new AutoUpdater(spring, tas);
if (config.StatsEnabledReal) stats = new Stats(tas, spring);
try {
tas.Connect(config.ServerHost, config.ServerPort);
} catch {
recon.Start();
}
return true;
}