private void Window_Loaded(object sender, RoutedEventArgs e) { NetTcpBinding ntb = new NetTcpBinding(); try { ChannelFactory <IMMOPortalController> MMOFactory = new ChannelFactory <IMMOPortalController>(ntb, "net.tcp://localhost:50002/MMOPortal"); Portal = MMOFactory.CreateChannel(); } //If URI is invalid or uri Cannot be parsed or empty uri catch (UriFormatException ex) { MessageBox.Show("Error : Cannot connet with the portal "); } //If endpoint is null catch (InvalidOperationException ex) { MessageBox.Show("Error : Cannot connet with the portal "); } //If address is null catch (ArgumentNullException ex) { MessageBox.Show("Error : Cannot connet with the portal "); } //If address is null catch (EndpointNotFoundException) { MessageBox.Show("Error : Could not connect with the server. Please try again later!"); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { try { ChannelFactory <IMMOPortalController> IMMOFactory; var netTcpBinding = new NetTcpBinding(); string URL = "net.tcp://localhost:50002/MMOPortal"; netTcpBinding.MaxReceivedMessageSize = Int32.MaxValue; netTcpBinding.ReaderQuotas.MaxArrayLength = Int32.MaxValue; IMMOFactory = new ChannelFactory <IMMOPortalController>(netTcpBinding, URL); m_Portal = IMMOFactory.CreateChannel(); m_Portal.InitDB(); //MessageBox.Show(m_Portal.GetNumBosses().ToString()); listServer.Items.Add("50002"); } catch (EndpointNotFoundException) { MessageBox.Show("Check wether server is running"); } catch (ChannelTerminatedException) { MessageBox.Show("Please Re-run the application"); } catch (CommunicationException) { MessageBox.Show("Check wether server is running"); } catch (TimeoutException) { MessageBox.Show("Timeout! Re-run the application"); } }
public ServerList(int uid, List <string> sl, string uname, IMMOPortalController obj, List <string> UserFriends) { portal = obj; //getting user id, User name and server list from the login window and storing in here UserId = uid; UserName = uname; Servers = sl; FriendList = UserFriends; //Assigning names to servers in the server list AssignNamesToServers(); InitializeComponent(); //Setting the user name in the label SetUserName(); }
public Login() { try { InitializeComponent(); ChannelFactory <IMMOPortalController> IMMOFactory; var netTcpBinding = new NetTcpBinding(); string URL = "net.tcp://localhost:50002/MMOPortal"; netTcpBinding.MaxReceivedMessageSize = Int32.MaxValue; netTcpBinding.ReaderQuotas.MaxArrayLength = Int32.MaxValue; IMMOFactory = new ChannelFactory <IMMOPortalController>(netTcpBinding, URL); m_Portal = IMMOFactory.CreateChannel(); m_Portal.InitDB(); } //catch(Exception LoginFualt) //{ // Close(); // MessageBox.Show("Check wether server is running"); //} catch (EndpointNotFoundException) { //Close(); MessageBox.Show("Check wether server is running"); } catch (ChannelTerminatedException) { Close(); MessageBox.Show("Please Re-run the application"); } catch (CommunicationException) { //Close(); MessageBox.Show("Check wether server is running"); } catch (TimeoutException) { Close(); MessageBox.Show("Timeout! Re-run the application"); } }