//Creates a connection with the desired server //For the use of connect function public void EstablishConnection(string ServAddr) { try { MMOFactory = new ChannelFactory <IMMOBizController>(ntb, ServAddr); biz = MMOFactory.CreateChannel(); } //If URI is invalid or uri Cannot be parsed or empty uri catch (UriFormatException ex) { Console.WriteLine("Error : " + ex.Message); } //If endpoint is null catch (InvalidOperationException ex) { Console.WriteLine("Error : " + ex.Message); } //If address is null catch (ArgumentNullException ex) { Console.WriteLine("Error : " + ex.Message); } //If address is null catch (EndpointNotFoundException) { MessageBox.Show("Error : Could not connect with the server. Please try again later!"); } }
public void EstablishConnSec(string url) { NetTcpBinding ntb = new NetTcpBinding(); try { ChannelFactory <IMMOBizController> MMOFactory = new ChannelFactory <IMMOBizController>(ntb, url); game = MMOFactory.CreateChannel(); } //If URI is invalid or uri Cannot be parsed or empty uri catch (UriFormatException) { Console.WriteLine("Error : Uri format is not valid"); } //If endpoint is null catch (InvalidOperationException) { Console.WriteLine("Error : Null endpoint detected"); } //If address is null catch (ArgumentNullException) { Console.WriteLine("Error : Uri is not available"); } //If address is null catch (EndpointNotFoundException) { Console.WriteLine("Error : Coulld not connect with the server. Please try again later!"); } }
public HeroSelection(IMMOBizController biz_obj, int uid, string uname, List <string> FriendList, string ServerAddressCon, SortedList <string, string> ServersAndNames) { mmobiz = biz_obj; BossId = mmobiz.GetBossId(); BossName = mmobiz.GetBossName(); UserId = uid; UserName = uname; Friends = FriendList; ServerUrl = ServerAddressCon; ServerNames = ServersAndNames; InitializeComponent(); try { listHeros.ItemsSource = mmobiz.GetHeroNames(); } catch { } }