Exemplo n.º 1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            engine = new GarosuEngineWrapper.EngineWrapper();

            engine.RegisterHandler(HandleEngineCallback);
            engine.InitializeEngine();

            // message test
            {
                var testMsg = new BaseMessage(EngineMessageId.TestMessage);
                testMsg.SetParam("bool", true);
                testMsg.SetParam("voidptr", IntPtr.Zero);
                testMsg.SetParam("integer", 1234567891234567);
                testMsg.SetParam("double", 3.1415926535897);
                testMsg.SetParam("string", "Hello, I am c# program. 혹시 한글도 읽을 수 있나요?");

                engine.SendMessage(testMsg);

                bool   boolVal    = false;
                IntPtr ptrVal     = IntPtr.Zero;
                Int64  integerVal = 0;
                double doubleVal  = 0.0;
                String strVal     = "";

                if (testMsg.GetParam("bool", ref boolVal))
                {
                    Console.Out.WriteLineAsync("bool " + boolVal);
                }
                if (testMsg.GetParam("voidptr", ref ptrVal))
                {
                    Console.Out.WriteLineAsync("voidptr " + (UInt64)ptrVal);
                }
                if (testMsg.GetParam("integer", ref integerVal))
                {
                    Console.Out.WriteLineAsync("integer " + integerVal);
                }
                if (testMsg.GetParam("double", ref doubleVal))
                {
                    Console.Out.WriteLineAsync("double " + doubleVal);
                }
                if (testMsg.GetParam("string", ref strVal))
                {
                    Console.Out.WriteLineAsync("string " + strVal);
                }
            }
        }