home *** CD-ROM | disk | FTP | other *** search
- //==========================================================================
- // File: MyPage.cs
- //
- // Summary: This file implements client side of NGWS Remoting. It
- // illustrates contexts and remoting library calls for NGWS
- // Remoting client.
- //
- // Classes: MyPage
- //
- //--------------------------------------------------------------------------
- // This file is part of the Microsoft NGWS Samples.
- //
- // Copyright (C) 1999 Microsoft Corporation. All rights reserved.
- //==========================================================================
-
- using System;
- using System.IO;
- using System.Net;
- using System.Text;
- using System.Runtime.Remoting;
-
- public class MyPage
- {
- public static void Scenario1()
- {
- }
-
- public static void Scenario2()
- {
- }
-
- public static void Scenario3()
- {
- }
-
- public static int Main(string[] args)
- {
- int ret = Initialize(args);
- Console.WriteLine("MyPage Remoting Sample\n");
-
- if (ret != -1)
- {
- switch (scenario)
- {
- case 1:
- Scenario1();
- break;
- case 2:
- Scenario2();
- break;
- case 3:
- Scenario3();
- break;
- }
- }
-
- Console.WriteLine("\nEnd\n");
-
- return ret;
- }
-
-
- //---------------------------------------------------
- public static int scenario = 1;
-
- public static int Initialize(String[] args)
- {
- if (args.Length == 0)
- {
- RemotingServices.ConfigureRemoting("MyPage.cfg");
- return 0;
- }
-
-
- for (int i=0;i<args.Length;i++)
- {
- if (
- String.Compare(args[i],"HELP", true) == 0 ||
- String.Compare(args[i],"?", true) == 0 ||
- String.Compare(args[i],"/h", true) == 0 ||
- String.Compare(args[i],"-h", true) == 0 ||
- String.Compare(args[i],"-?", true) == 0 ||
- String.Compare(args[i],"/?", true) == 0
- )
- {
- Usage();
- return -1;
- }
-
- if (args[i].CompareTo("-s1")==0)
- {
- scenario = 1;
- }
-
- if (args[i].CompareTo("-i")==0)
- {
- scenario = 2;
- }
-
- if (args[i].CompareTo("-s3")==0)
- {
- scenario = 3;
- }
-
- if (args[i].CompareTo("-cfg")==0)
- {
- RemotingServices.ConfigureRemoting(args[i+1]);
- }
- }
-
- return 0;
- }
-
- public static void Usage()
- {
- Console.WriteLine("Usage: MyPage [-i] [-cfg Configfile.cfg]\n");
- Console.WriteLine("Examples : MyPage");
- Console.WriteLine("Examples : MyPage -s1 ");
- Console.WriteLine("Examples : MyPage -s2 ");
- Console.WriteLine("Examples : MyPage -s3 ");
- Console.WriteLine("Examples : MyPage -s1 -cfg MyPage.cfg");
- Console.WriteLine("Examples : MyPage -s2 -cfg MyPage.cfg");
- Console.WriteLine("Examples : MyPage -s3 -cfg MyPage.cfg");
- }
- }
-
-
-