コード例 #1
0
#pragma warning disable CC0091 // Use static method
#pragma warning disable CC0038 // You should use expression bodied members whenever possible.
        bool CheckWindowsService()
#pragma warning restore CC0091 // Use static method
        {
#if DEBUG
            return(true);
#else
            IWindowsServiceManager     windowsServiceManager = CustomContainer.Get <IWindowsServiceManager>();
            IPopupController           popup = CustomContainer.Get <IPopupController>();
            ServerServiceConfiguration ssc   = new ServerServiceConfiguration(windowsServiceManager, popup);

            if (ssc.DoesServiceExist())
            {
                if (ssc.IsServiceRunning())
                {
                    return(true);
                }

                if (ssc.PromptUserToStartService())
                {
                    if (ssc.StartService())
                    {
                        _serverServiceStartedFromStudio = true;
                        return(true);
                    }
                }
            }

            return(false);
#endif
        }
コード例 #2
0
ファイル: Bootstrapper.cs プロジェクト: won21kr/Warewolf
        /*
         * DELETE THIS METHOD AND LOOSE A VERY IMPORTANT PART OF YOU ;)
         *
         * IT IS REQUIRED FOR UPDATES IN RELEASE MODE ;)
         * REMOVING IT MEANS IT IS NOT POSSIBLE TO BUILD AN INSTALLER ;)
         */
        // ReSharper disable once UnusedMember.Local
        private bool CheckWindowsService()
        {
            IWindowsServiceManager     windowsServiceManager = CustomContainer.Get <IWindowsServiceManager>();
            IPopupController           popup = CustomContainer.Get <IPopupController>();
            ServerServiceConfiguration ssc   = new ServerServiceConfiguration(windowsServiceManager, popup);

            if (ssc.DoesServiceExist())
            {
                if (ssc.IsServiceRunning())
                {
                    return(true);
                }

                if (ssc.PromptUserToStartService())
                {
                    if (ssc.StartService())
                    {
                        _serverServiceStartedFromStudio = true;
                        return(true);
                    }
                }
            }

            return(false);
        }