home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / Remoting / MyPage / MyPage.cs < prev    next >
Encoding:
Text File  |  2000-06-23  |  3.3 KB  |  128 lines

  1. //==========================================================================
  2. //  File:       MyPage.cs
  3. //
  4. //  Summary:    This file implements client side of NGWS Remoting. It 
  5. //              illustrates contexts and remoting library calls for NGWS 
  6. //              Remoting client.
  7. //           
  8. //  Classes:    MyPage
  9. //
  10. //--------------------------------------------------------------------------
  11. //  This file is part of the Microsoft NGWS Samples.
  12. //
  13. //  Copyright (C) 1999 Microsoft Corporation.  All rights reserved.
  14. //==========================================================================
  15.  
  16. using System;
  17. using System.IO;
  18. using System.Net;
  19. using System.Text;
  20. using System.Runtime.Remoting;
  21.  
  22. public class MyPage
  23. {
  24.     public static void Scenario1()  
  25.     {
  26.     }
  27.  
  28.     public static void Scenario2()  
  29.     {
  30.     }
  31.  
  32.     public static void Scenario3()  
  33.     {
  34.     }
  35.  
  36.     public static int Main(string[] args)
  37.     {
  38.         int ret = Initialize(args);
  39.         Console.WriteLine("MyPage Remoting Sample\n");
  40.  
  41.         if (ret != -1)
  42.         {
  43.             switch (scenario)
  44.             {
  45.             case 1: 
  46.                 Scenario1();
  47.                 break;
  48.             case 2:
  49.                 Scenario2();
  50.                 break;
  51.             case 3:
  52.                 Scenario3();
  53.                 break;
  54.             }
  55.         }
  56.  
  57.         Console.WriteLine("\nEnd\n");
  58.  
  59.         return ret;
  60.     }
  61.  
  62.  
  63.     //---------------------------------------------------
  64.     public static int scenario = 1;
  65.  
  66.     public static int Initialize(String[] args)
  67.     {
  68.         if (args.Length == 0)
  69.         {
  70.             RemotingServices.ConfigureRemoting("MyPage.cfg");
  71.             return 0;
  72.         }
  73.  
  74.  
  75.         for (int i=0;i<args.Length;i++)
  76.         {
  77.             if (
  78.                String.Compare(args[i],"HELP", true) == 0 ||
  79.                String.Compare(args[i],"?", true) == 0 ||
  80.                String.Compare(args[i],"/h", true) == 0 ||
  81.                String.Compare(args[i],"-h", true) == 0 ||
  82.                String.Compare(args[i],"-?", true) == 0 ||
  83.                String.Compare(args[i],"/?", true) == 0
  84.                )
  85.             {
  86.                 Usage();
  87.                 return -1;
  88.             }
  89.  
  90.             if (args[i].CompareTo("-s1")==0)
  91.             {
  92.                 scenario = 1;
  93.             }
  94.  
  95.             if (args[i].CompareTo("-i")==0)
  96.             {
  97.                 scenario = 2;
  98.             }
  99.  
  100.             if (args[i].CompareTo("-s3")==0)
  101.             {
  102.                 scenario = 3;
  103.             }
  104.  
  105.             if (args[i].CompareTo("-cfg")==0)
  106.             {
  107.                 RemotingServices.ConfigureRemoting(args[i+1]);
  108.             }
  109.         }
  110.  
  111.         return 0;
  112.     }
  113.  
  114.     public static void Usage()
  115.     {
  116.         Console.WriteLine("Usage: MyPage [-i] [-cfg Configfile.cfg]\n");
  117.         Console.WriteLine("Examples : MyPage");
  118.         Console.WriteLine("Examples : MyPage -s1   ");
  119.         Console.WriteLine("Examples : MyPage -s2   ");
  120.         Console.WriteLine("Examples : MyPage -s3   ");
  121.         Console.WriteLine("Examples : MyPage -s1 -cfg MyPage.cfg");
  122.         Console.WriteLine("Examples : MyPage -s2 -cfg MyPage.cfg");
  123.         Console.WriteLine("Examples : MyPage -s3 -cfg MyPage.cfg");
  124.     }
  125. }
  126.  
  127.  
  128.