/// <summary>
        /// Start the platform
        /// </summary>
        public void Start()
        {
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(LogUnhandledException);
            AppDomain.MonitoringIsEnabled = true;

            // cache the version
            this.platformVersion = Utils.GetHomeOSUpdateVersion(this.GetType().Assembly.CodeBase + ".config", logger);


            //start the basic services
            infoService = new InfoService(this, logger);
            guiService = new GuiService(this, config, homeStoreInfo, logger);
            discoveryHelperService = new DiscoveryHelper(this, logger);

            if (!guiService.IsConfigNeeded())
            {
                ConfiguredStart();
            }

            if (!Settings.RunningMode.Equals("unittesting", StringComparison.CurrentCultureIgnoreCase))
            {
                if (Environment.UserInteractive)
                {
                    ReadCommandsFromConsole();
                }
                else
                {
                    // wait indefinitely, once we support Stop() on the platform this event
                    // will be signalled, which will be needed for Updating the the Platform itself
                    this.eventPlatformStopped = new AutoResetEvent(false);
                    this.eventPlatformStopped.WaitOne();
                }
        
            }
        }
        private void Shutdown()
        {
            this.StopAllModules();
            this.DisposeAllScouts();
            this.Dispose();
            if(homeService!=null) 
                homeService.Stop();


            this.runningScouts = null;
            this.runningModules = null;
            this.runningModulesStates = null;
            this.registeredPorts = null;
            this.registeredPorts = null;
            this.config = null;
            this.allAddinTokens = null;
            this.policyEngine = null;
            //this.gadgetListener = null;
            this.guiService = null;
            this.homeService = null;
            this.infoService = null;
            this.discoveryHelperService = null;
            this.heartbeatService = null;
            this.random = null;

            GC.Collect();

            //finally close the logger object
            if (logger != null)
                logger.Close();
        }