コード例 #1
0
        private void StartUpdateProcess()
        {
            try
            {
                Context.Logger.Info($"===> [{UpdateProcessName}] process STARTED! <===");

                if (!NetworkChecker.IsNetworkAvailable())
                {
                    Data.Log(Context.LocalizedMessages.NotAvailableNetwork);
                    Context.Logger.Error(null, $"[{UpdateProcessName}] process FAILED! Network is not available or connectivity is low/weak... Check your connection!");

                    if (Data.LaunchAnywayOnError)
                    {
                        StartApp();
                    }
                    else
                    {
                        Data.Dialog.ShowCloseDialog(Context.LocalizedMessages.NotAvailableNetwork, string.Empty, Application.Quit);
                    }
                    return;
                }

                if (!NetworkChecker.IsRemoteServiceAvailable(Context.Settings.GetRemoteBuildsIndexUrl()))
                {
                    Data.Log(Context.LocalizedMessages.NotAvailableServers);
                    Context.Logger.Error(null, $"[{UpdateProcessName}] process FAILED! Our servers are not responding... Wait some minutes and retry!");

                    if (Data.LaunchAnywayOnError)
                    {
                        StartApp();
                    }
                    else
                    {
                        Data.Dialog.ShowCloseDialog(Context.LocalizedMessages.NotAvailableServers, string.Empty, Application.Quit);
                    }

                    return;
                }

                Context.Initialize();

                Task.Run(CheckForUpdates);
            }
            catch (Exception ex)
            {
                UpdateFailed(ex);

                if (Data.LaunchAnywayOnError)
                {
                    StartApp();
                }
            }
        }
コード例 #2
0
        protected bool CheckForNetworkAvailability()
        {
            if (!NetworkChecker.IsNetworkAvailable())
            {
                Data.Log(Context.LocalizedMessages.NotAvailableNetwork);
                Context.Logger.Error(null, $"[{UpdateProcessName}] process FAILED! Network is not available or connectivity is low/weak... Check your connection!");

                return(false);
            }

            return(true);
        }