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

  1. //==========================================================================
  2. //  File:       MyNews.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:    MyNews
  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. using NewsWire;
  22.  
  23. public class MyNews
  24. {
  25.     public static void Scenario1()  
  26.     {
  27.     }
  28.  
  29.     public static void Scenario2()  
  30.     {
  31.     }
  32.  
  33.     public static void Scenario3()  
  34.     {
  35.     }
  36.  
  37.     public static int Main(string[] args)
  38.     {
  39.         int ret = Initialize(args);
  40.         Console.WriteLine("MyNews Remoting Sample\n");
  41.  
  42.         if (ret != -1)
  43.         {
  44.             switch (scenario)
  45.             {
  46.             case 1: 
  47.                 Scenario1();
  48.                 break;
  49.             case 2:
  50.                 Scenario2();
  51.                 break;
  52.             case 3:
  53.                 Scenario3();
  54.                 break;
  55.             }
  56.         }
  57.  
  58.         Console.WriteLine("\nEnd\n");
  59.  
  60.         return ret;
  61.     }
  62.  
  63.  
  64.     //---------------------------------------------------
  65.     public static int scenario = 1;
  66.  
  67.     public static int Initialize(String[] args)
  68.     {
  69.         if (args.Length == 0)
  70.         {
  71.             RemotingServices.ConfigureRemoting("MyNews.cfg");
  72.             return 0;
  73.         }
  74.  
  75.  
  76.         for (int i=0;i<args.Length;i++)
  77.         {
  78.             if (
  79.                String.Compare(args[i],"HELP", true) == 0 ||
  80.                String.Compare(args[i],"?", true) == 0 ||
  81.                String.Compare(args[i],"/h", true) == 0 ||
  82.                String.Compare(args[i],"-h", true) == 0 ||
  83.                String.Compare(args[i],"-?", true) == 0 ||
  84.                String.Compare(args[i],"/?", true) == 0
  85.                )
  86.             {
  87.                 Usage();
  88.                 return -1;
  89.             }
  90.  
  91.             if (args[i].CompareTo("-s1")==0)
  92.             {
  93.                 scenario = 1;
  94.             }
  95.  
  96.             if (args[i].CompareTo("-i")==0)
  97.             {
  98.                 scenario = 2;
  99.             }
  100.  
  101.             if (args[i].CompareTo("-s3")==0)
  102.             {
  103.                 scenario = 3;
  104.             }
  105.  
  106.             if (args[i].CompareTo("-cfg")==0)
  107.             {
  108.                 RemotingServices.ConfigureRemoting(args[i+1]);
  109.             }
  110.         }
  111.  
  112.         return 0;
  113.     }
  114.  
  115.     public static void Usage()
  116.     {
  117.         Console.WriteLine("Usage: MyNews [-i] [-cfg Configfile.cfg]\n");
  118.         Console.WriteLine("Examples : MyNews");
  119.         Console.WriteLine("Examples : MyNews -s1   ");
  120.         Console.WriteLine("Examples : MyNews -s2   ");
  121.         Console.WriteLine("Examples : MyNews -s3   ");
  122.         Console.WriteLine("Examples : MyNews -s1 -cfg MyNews.cfg");
  123.         Console.WriteLine("Examples : MyNews -s2 -cfg MyNews.cfg");
  124.         Console.WriteLine("Examples : MyNews -s3 -cfg MyNews.cfg");
  125.     }
  126. }
  127.  
  128.  
  129.