//-----------------------------------------------------------------------------------------------
    //
    // Form Event Handlers
    //
    //-----------------------------------------------------------------------------------------------

    protected virtual void ExecutorTemplateForm_Load(object sender, EventArgs e)
    {
        //normally this should not cause any problems,
        //but during design-time, it is needed to avoid exceptions due to things that dont mean anything during design time.
        try
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(DefaultErrorHandler);

            //for windows forms apps unhandled exceptions on the main thread
            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);

            // avoid multiple instances

            /*
             * bool isOnlyInstance = false;
             * Mutex mtx = new Mutex(true, "AlchemiExecutor_Mutex", out isOnlyInstance);
             * if(!isOnlyInstance)
             * {
             *      MessageBox.Show("An instance of this application is already running. The program will now exit.", "Alchemi Executor", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             *      Application.Exit();
             * }
             */

            ucOwnEndPoint.RemoveRemotingMechanism(RemotingMechanism.WCFCustom);
            ucOwnEndPoint.AddressPart      = "Executor";
            ucOwnEndPoint.FixedAddressPart = true;
        }
        catch {}
    }