summaryrefslogtreecommitdiff
path: root/cs/demo/IceGrid/icebox/HelloI.cs
blob: bd636ad4e1e2e2e7437a7c9ba630c6d11ed04c0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// **********************************************************************
//
// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

using Demo;

public class HelloI : HelloDisp_
{
    public HelloI(string serviceName)
    {
        _serviceName = serviceName;
    }

    public override void sayHello(Ice.Current current)
    {
#if COMPACT || SILVERLIGHT
        string lang = "en";
#else
        string lang = System.Environment.GetEnvironmentVariable("LANG") != null ? 
                                                            System.Environment.GetEnvironmentVariable("LANG") : "en";
#endif
        string greeting = "Hello, ";
        if(lang.Equals("fr"))
        {
            greeting = "Bonjour, ";
        }
        else if(lang.Equals("de"))
        {
            greeting = "Hallo, ";
        }
        else if(lang.Equals("es"))
        {
            greeting = "Hola, ";
        }
        else if(lang.Equals("it"))
        {
            greeting = "Ciao, ";
        }
        System.Console.Out.WriteLine(greeting + _serviceName);
    }

    private string _serviceName;
}