Example #1
0
        /// <summary>
        /// Checks if the services are running (database and optional custom services)
        /// </summary>
        /// <returns></returns>
        internal string GetServiceStates()
        {
            bool success = true;

            // check if database is running
            if (VersionMonitor.CheckDatabaseFunction != null && !VersionMonitor.CheckDatabaseFunction())
            {
                success = false;
            }

            // check if custom services are running
            if (VersionMonitor.CheckCustomServicesFunction != null)
            {
                foreach (var result in VersionMonitor.CheckCustomServicesFunction())
                {
                    if (!result.IsRunning)
                    {
                        success = false;
                        break;
                    }
                }
            }

            return(success ? "OK" : "NOK");
        }
Example #2
0
        /// <summary>
        /// Checks for new application version.
        /// </summary>
        private async void CheckVersionAsync()
        {
            // Let application show
            await Task.Delay(TimeSpan.FromSeconds(4));

            // If new version is available...
            if (await VersionMonitor.IsNewAsync())
            {
                // Prompt user
                await DI.UIManager.ShowConfirmDialogBoxAsync(new ConfirmDialogBoxViewModel
                {
                    Title    = Strings.NewVersionDialogTitle,
                    Message  = string.Format(Strings.NewVersionDialogContent, Consts.APP_TITLE),
                    OnAccept = () =>
                    {
                        Process.Start(new ProcessStartInfo
                        {
                            FileName        = Consts.APP_DOWNLOAD_URL,
                            UseShellExecute = true
                        });
                    },
                    OkText     = Strings.Download,
                    CancelText = Strings.Close
                });
            }
        }
 public MonitoringControllerTests()
 {
     _monitoringController = new MonitoringController();
     _accestoken           = Guid.NewGuid().ToString();
     VersionMonitor.SetAccessToken(_accestoken);
 }