summaryrefslogtreecommitdiff
path: root/cs/demo/Ice/async/Client.cs
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2008-02-08 16:57:37 -0800
committerMark Spruiell <mes@zeroc.com>2008-02-08 16:57:37 -0800
commite754cd9f687138f7d58b477718bf061801f68d95 (patch)
tree1ee35e6203ca8538bb30311d8e987eec56b205d3 /cs/demo/Ice/async/Client.cs
parentcleaning up enum mapping (diff)
downloadice-e754cd9f687138f7d58b477718bf061801f68d95.tar.bz2
ice-e754cd9f687138f7d58b477718bf061801f68d95.tar.xz
ice-e754cd9f687138f7d58b477718bf061801f68d95.zip
bug 1960 - empty application name in Windows Firewall list
Diffstat (limited to 'cs/demo/Ice/async/Client.cs')
-rw-r--r--cs/demo/Ice/async/Client.cs162
1 files changed, 86 insertions, 76 deletions
diff --git a/cs/demo/Ice/async/Client.cs b/cs/demo/Ice/async/Client.cs
index 61857ff1197..1a575c779c8 100644
--- a/cs/demo/Ice/async/Client.cs
+++ b/cs/demo/Ice/async/Client.cs
@@ -7,110 +7,120 @@
//
// **********************************************************************
-using System;
using Demo;
+using System;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
-public class Client : Ice.Application
+[assembly: AssemblyTitle("IceAsyncClient")]
+[assembly: AssemblyDescription("Ice async demo client")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Client
{
- public class AMI_Hello_sayHelloI : AMI_Hello_sayHello
+ public class App : Ice.Application
{
- public override void ice_response()
- {
- }
-
- public override void ice_exception(Ice.Exception ex)
+ public class AMI_Hello_sayHelloI : AMI_Hello_sayHello
{
- if(ex is RequestCanceledException)
+ public override void ice_response()
{
- Console.Error.WriteLine("RequestCanceledException");
}
- else
+
+ public override void ice_exception(Ice.Exception ex)
{
- Console.Error.WriteLine("sayHello AMI call failed:");
- Console.Error.WriteLine(ex);
+ if(ex is RequestCanceledException)
+ {
+ Console.Error.WriteLine("RequestCanceledException");
+ }
+ else
+ {
+ Console.Error.WriteLine("sayHello AMI call failed:");
+ Console.Error.WriteLine(ex);
+ }
}
}
- }
-
- private static void menu()
- {
- Console.Out.WriteLine(
- "usage:\n" +
- "i: send immediate greeting\n" +
- "d: send delayed greeting\n" +
- "s: shutdown server\n" +
- "x: exit\n" +
- "?: help\n");
- }
- public override int run(string[] args)
- {
- if(args.Length > 0)
+ private static void menu()
{
- Console.Error.WriteLine(appName() + ": too many arguments");
- return 1;
+ Console.Out.WriteLine(
+ "usage:\n" +
+ "i: send immediate greeting\n" +
+ "d: send delayed greeting\n" +
+ "s: shutdown server\n" +
+ "x: exit\n" +
+ "?: help\n");
}
- HelloPrx hello = HelloPrxHelper.checkedCast(communicator().propertyToProxy("Hello.Proxy"));
- if(hello == null)
+ public override int run(string[] args)
{
- Console.Error.WriteLine("invalid proxy");
- return 1;
- }
+ if(args.Length > 0)
+ {
+ Console.Error.WriteLine(appName() + ": too many arguments");
+ return 1;
+ }
- menu();
+ HelloPrx hello = HelloPrxHelper.checkedCast(communicator().propertyToProxy("Hello.Proxy"));
+ if(hello == null)
+ {
+ Console.Error.WriteLine("invalid proxy");
+ return 1;
+ }
- string line = null;
- do
- {
- try
+ menu();
+
+ string line = null;
+ do
{
- Console.Out.Write("==> ");
- Console.Out.Flush();
- line = Console.In.ReadLine();
- if(line == null)
- {
- break;
- }
- if(line.Equals("i"))
- {
- hello.sayHello(0);
- }
- else if(line.Equals("d"))
- {
- hello.sayHello_async(new AMI_Hello_sayHelloI(), 5000);
- }
- else if(line.Equals("s"))
- {
- hello.shutdown();
- }
- else if(line.Equals("x"))
- {
- // Nothing to do
- }
- else if(line.Equals("?"))
+ try
{
- menu();
+ Console.Out.Write("==> ");
+ Console.Out.Flush();
+ line = Console.In.ReadLine();
+ if(line == null)
+ {
+ break;
+ }
+ if(line.Equals("i"))
+ {
+ hello.sayHello(0);
+ }
+ else if(line.Equals("d"))
+ {
+ hello.sayHello_async(new AMI_Hello_sayHelloI(), 5000);
+ }
+ else if(line.Equals("s"))
+ {
+ hello.shutdown();
+ }
+ else if(line.Equals("x"))
+ {
+ // Nothing to do
+ }
+ else if(line.Equals("?"))
+ {
+ menu();
+ }
+ else
+ {
+ Console.Out.WriteLine("unknown command `" + line + "'");
+ menu();
+ }
}
- else
+ catch(Ice.Exception ex)
{
- Console.Out.WriteLine("unknown command `" + line + "'");
- menu();
+ Console.Error.WriteLine(ex);
}
}
- catch(Ice.Exception ex)
- {
- Console.Error.WriteLine(ex);
- }
- }
- while(!line.Equals("x"));
+ while(!line.Equals("x"));
- return 0;
+ return 0;
+ }
}
public static void Main(string[] args)
{
- Client app = new Client();
+ App app = new App();
int status = app.main(args, "config.client");
if(status != 0)
{