Advertisement
Guest User

client

a guest
Apr 30th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.80 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.Remoting.Channels;
  5. using System.Runtime.Remoting.Channels.Tcp;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace ConsoleClient
  10. {
  11.     class MyClient
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             TcpChannel tcpChannel = new TcpChannel();
  16.             ChannelServices.RegisterChannel(tcpChannel, true);
  17.             Type requiredType = typeof(gradeCalculate);
  18.  
  19.             gradeCalculate remoteObject = (gradeCalculate)Activator.GetObject(requiredType, "tcp://localhost:9998/DrivingLesson");
  20.  
  21.  
  22.             string username, password;
  23.  
  24.             System.Console.WriteLine("please enter your Username");
  25.             username = Console.ReadLine();
  26.             System.Console.WriteLine("Please enter your password");
  27.             password = Console.ReadLine();
  28.             bool authenticated = remoteObject.authenticate(username,password);
  29.             Console.Clear();
  30.  
  31.             while (authenticated)
  32.             {
  33.                 System.Console.WriteLine("Menu");
  34.                 System.Console.WriteLine("1) Enter Marks");
  35.                 System.Console.WriteLine("2) Show results");
  36.                 System.Console.WriteLine("0) Exit");
  37.                 int mainMenuOption = Console.Read();
  38.  
  39.                 switch (mainMenuOption)
  40.                 {
  41.                     case 1:
  42.  
  43.  
  44.                         break;
  45.                     case 2:
  46.                         break;
  47.                     case 3:
  48.                         break;
  49.                     default:
  50.                         authenticated = false;
  51.                         break;
  52.  
  53.                 }
  54.                
  55.  
  56.             }
  57.  
  58.  
  59.             System.Console.WriteLine(authenticated );
  60.  
  61.         }
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement