public static DialogResult showMessageBox(this O2AppDomainFactory o2AppDomainFactory, string message,
                                           string messageBoxTitle, MessageBoxButtons messageBoxButtons)
 {
     return((DialogResult)o2AppDomainFactory.proxyInvokeStatic("O2_Kernel", "O2Proxy", "showMessageBox",
                                                               new object[]
                                                               { message, messageBoxTitle, messageBoxButtons }));
 }
Esempio n. 2
0
 public static Control loadControl(this O2AppDomainFactory o2AppDomainFactory, Type ascxControlToLoad,
                                   bool showAsFloat, String name)
 {
     return((Control)o2AppDomainFactory.proxyInvokeStatic(
                "O2_CoreLib", "O2DockPanel", "loadControl",
                new object[] { ascxControlToLoad, showAsFloat, name }));
 }
Esempio n. 3
0
 public static void springExec(this O2AppDomainFactory o2AppDomainFactory, string springFileToLoad)
 {
     O2Kernel_O2Thread.staThread(() =>
                                 o2AppDomainFactory.proxyInvokeStatic("O2_CoreLib", "SpringExec",
                                                                      "loadConfigAndStartGUI",
                                                                      new object[] { springFileToLoad })
                                 );
     //O2Kernel_Lambda.runLambdaOnNewSTAThread(() =>
     //    );
 }
Esempio n. 4
0
        public void Test_OpenO2CorLibForm()
        {
            Test_CreateAppDomainWithO2CoreLibDll();
            // do a quick dynamic invocation to confirm that all is OK

            //o2AppDomainFactory.proxyInvokeInstance("O2_CoreLib", "Log", "info", new object[] { "test" });

            Assert.That(
                o2AppDomainFactory.appDomain.FriendlyName ==
                (string)o2AppDomainFactory.proxyInvokeInstance("O2_Kernel", "O2Proxy", "nameOfCurrentDomain"),
                "nameOfCurrentDomain  test failed");


            // get proxy for o2GuiForm
            object o2GuiWithDockPanel = o2AppDomainFactory.proxyInvokeInstance("O2_External_WinFormsUI", "O2GuiWithDockPanel", "");

            Assert.That(o2GuiWithDockPanel != null, "o2GuiWithDockPanel was null");
            Assert.That(o2GuiWithDockPanel.GetType().Name == "O2GuiWithDockPanel",
                        "o2GuiWithDockPanel had the wrong type: " + o2GuiWithDockPanel.GetType());

            if (!autoCloseForm)
            {
                o2AppDomainFactory.showMessageBox("Ready to start?");
            }

            //start o2GuiWithDockPanel on a separate STAthread
            O2Thread.staThread(() => ((Form)o2GuiWithDockPanel).ShowDialog());

            o2AppDomainFactory.proxyInvokeStatic("O2_External_WinFormsUI", "O2GuiWithDockPanel", "logDebug",
                                                 new object[] { "Good Morning you have 10 seconds for your tests" });

            if (!autoCloseForm)
            {
                int maxSleeps = 5;
                while (maxSleeps-- > 0)
                {
                    Thread.Sleep(10000);
                    if (DialogResult.No ==
                        (DialogResult)
                        o2AppDomainFactory.proxyInvokeStatic("O2_External_WinFormsUI", "O2GuiWithDockPanel", "showMessageBox",
                                                             new object[]
                    {
                        "your 10 seconds are up, Do you want another 10 Seconds? (you can ask for more " +
                        maxSleeps + " extensions",
                        "Message from O2 AppDomain Central",
                        MessageBoxButtons.YesNo
                    }))
                    {
                        break;
                    }
                }
                // show final message (using a simpler call syntax :) (using extension methods)
                o2AppDomainFactory.showMessageBox("Time's up closing all Forms", "Final Message", MessageBoxButtons.OK);
            }
            // close Form
            Thread.Sleep(1000);
            ((Form)o2GuiWithDockPanel).Close();
            if (autoCloseForm)
            {
                Assert.Ignore(
                    "Success: change value of autoCloseForm to see some dynamic intercation between this unit test and the O2GuiWithDockPanel form");
            }
            Assert.Ignore(
                "Success: remember to put the value of autoCloseForm to false, or you will have those popups all the time ");
        }
 public static void logError(this O2AppDomainFactory o2AppDomainFactory, string errorMessage)
 {
     o2AppDomainFactory.proxyInvokeStatic("O2_Kernel", "O2Proxy", "logError", new object[] { errorMessage });
 }
 public static void logDebug(this O2AppDomainFactory o2AppDomainFactory, string debugMessage)
 {
     o2AppDomainFactory.proxyInvokeStatic("O2_Kernel", "O2Proxy", "logDebug", new object[] { debugMessage });
 }
 public static void logInfo(this O2AppDomainFactory o2AppDomainFactory, string infoMessage)
 {
     o2AppDomainFactory.proxyInvokeStatic("O2_Kernel", "O2Proxy", "logInfo", new object[] { infoMessage });
 }
Esempio n. 8
0
 public static void closeO2Gui(this O2AppDomainFactory o2AppDomainFactory)
 {
     o2AppDomainFactory.proxyInvokeStatic("O2_CoreLib", "O2GuiWithDockPanel", "CloseThisForm");
 }