Пример #1
0
        public static void ShowWarning(string message)
        {
#if SERVICE
            C1ReportsSchedulerService.Logger.Log("WARNING", message);
#else
            WinUtil.ShowWarning(message);
#endif
        }
Пример #2
0
        private void TestClientModeOnStart()
        {
            if (Properties.Settings.Default.ClientMode)
            {
                return;
            }

            bool serviceInstalled;

            if (CanConnectToService(false, out serviceInstalled))
            {
                // connect to a running service:
                string text =
                    "You're about to start C1ReportsScheduler app in standalone mode.\r\n" +
                    "But, it appears that C1Reports scheduling service is installed and running.\r\n" +
                    "For full functionality it is highly recommended that you connect to the C1Reports scheduling service, " +
                    "and use the C1ReportsScheduler (this application) in client mode to communicate with the service.\r\n\r\n" +
                    "Do you want to connect to the service now?\r\n"
                ;
                if (WinUtil.AskQuestion(text, false))
                {
                    Properties.Settings.Default.ClientMode = true;
                }
            }
            else if (serviceInstalled)
            {
                // warn about a stopped service:
                string text =
                    "You're about to start C1ReportsScheduler app in standalone mode.\r\n" +
                    "But, it appears that C1Reports scheduling service is installed but is not running.\r\n" +
                    "For full functionality it is highly recommended that you start the C1Reports scheduling service, " +
                    "and use the C1ReportsScheduler (this application) in client mode to communicate with the service.\r\n\r\n" +
                    "Use menu Service | Start to start the service and connect to it.\r\n"
                ;
                WinUtil.ShowWarning(text);
            }
            else
            {
                // offer to install and start service:
                string text =
                    "You're about to start C1ReportsScheduler app in standalone mode.\r\n" +
                    "Standalone mode provides limited scheduling functionality, as scheduled reports will not run when the application is closed.\r\n" +
                    "For full functionality it is highly recommended that you install the C1Reports scheduling service, " +
                    "and use the C1ReportsScheduler (this application) in client mode to communicate with the service.\r\n\r\n" +
                    "Do you want to install the service now?\r\n\r\n" +
                    "(You can install or uninstall the service at any time via the \"Service\" menu.)"
                ;
                if (WinUtil.AskQuestion(text, false))
                {
                    try
                    {
                        ServiceSetup();
                        Properties.Settings.Default.ClientMode = true;
                    }
                    catch (Exception ex)
                    {
                        WinUtil.ShowError(ex.Message);
                    }
                }
            }
        }