/** ** ** MinCor-C# -Demo ** CORBA Solution for .Net with C# Language mapping ** Version: 1.0 ** ** Copyright: ** Middsol GmbH, Hamburg ** Germany 2004 ** www.Middsol.com ** info@Middsol.de ** */ using System; using System.Drawing; using System.Collections; using System.Windows.Forms; using System.Data; namespace DotNetClient { public class ClientImpl { private static string[] m_strORBInit = {"-ORBEndpoint iiop://localhost:8545/portspan=100", "-ORBInitRef NameService=corbaloc:iiop:1.2@localhost:10050/NameService"}; public static void runDemo( FrmClt a_oFrmClt, string a_strIpAddr) { Attributes.Greetings oGreetings; Middsol.CORBA.ORB oOrb = null; m_strORBInit[1] = m_strORBInit[1].Replace("localhost", a_strIpAddr); try { oOrb = Middsol.CORBA._ORB.init( m_strORBInit, null); Middsol.CosNaming.NamingContextExt oNsCtx = Middsol.CosNaming.NamingContextExtHelper.narrow( oOrb.resolve_initial_references("NameService")); try { oGreetings = Attributes.GreetingsHelper.narrow( oNsCtx.resolve_str("AttributesJavaServer")); } catch(Middsol.CosNaming.NamingContextPackage.NotFound ex) { a_oFrmClt.writeLog( "NS Manager Error:" + ex.why); throw new System.Exception(); } oGreetings.firstName = "Middsol"; a_oFrmClt.writeLog("Get property FirstName: "+ oGreetings.firstName); oGreetings.bar = false; a_oFrmClt.writeLog("Get property Bar : "+ oGreetings.bar); a_oFrmClt.writeLog("Call function getBar(): "+ oGreetings.getBar()); } catch( Middsol.CORBA.SystemException exSys) { a_oFrmClt.writeLog( "Catch Exception from Server (Middsol.CORBA.SystemException)."); a_oFrmClt.writeLog( "ID:" + exSys.ID); } finally { if( oOrb != null) oOrb.destroy(); } } } }