Ejemplo n.º 1
0
        public async Task OnLoad(object data)
        {
            if (!HasContexts)
            {
                var csa = new ConfirmServiceArgs(Strings.DoYouWantToAddANewAccount, Strings.NoAccountAdded);

                if (await ViewServiceRepository.Confirm(csa))
                {
                    await ViewServiceRepository.ShowAccounts(true);
                }
            }

            Task.Run(async() =>
            {
                await CheckCredentials();
                await ReportAppVersion();
            }).Forget();

            await Task.WhenAll(Columns.Select(c => c.Load(AsyncLoadContext.Ui)));

            // It's late and I didn't have enough coffee...
            ColumnsLocked = !Configuration.General.ColumnsLocked;
            await Dispatcher.RunAsync(ExecuteToggleColumnsLockCommand);

            try
            {
                await TwitterConfig.QueryConfig();
            }
            catch (Exception ex)
            {
                LogTo.WarnException("Failed to read current config from twitter", ex);
            }

            await Task.WhenAll(CheckForUpdates(), QueryRateLimit());
        }
Ejemplo n.º 2
0
        public async Task OnLoad(object data)
        {
            if (!HasContexts)
            {
                var csa = new ConfirmServiceArgs(Strings.DoYouWantToAddANewAccount, Strings.NoAccountAdded);

                if (await ViewServiceRepository.Confirm(csa))
                {
                    await ViewServiceRepository.ShowAccounts(true);
                }
            }

            await CheckCredentials();

            var loadTasks = Columns.Select(c => c.Load());
            await Task.WhenAll(loadTasks);

            try
            {
                await TwitterConfig.QueryConfig();
            }
            catch (Exception ex)
            {
                LogTo.WarnException("Failed to read current config from twitter", ex);
            }

            if (Configuration?.General?.CheckForUpdates == true)
            {
                bool useBetaChannel = Configuration?.General?.IncludePrereleaseUpdates == true;

                var channelUrl = useBetaChannel
                                        ? Constants.Updates.BetaChannelUrl
                                        : Constants.Updates.ReleaseChannelUrl;

                LogTo.Info("Searching for app updates...");
                LogTo.Info($"Using beta channel for updates: {useBetaChannel}");

                try
                {
                    using (var mgr = UpdateFactory.Construct(channelUrl))
                    {
                        var release = await mgr.UpdateApp();

                        Version newVersion = release?.Version?.Version;

                        if (newVersion == null)
                        {
                            LogTo.Warn("UpdateApp returned null");
                        }
                        else if (newVersion > Assembly.GetExecutingAssembly().GetName().Version)
                        {
                            LogTo.Info($"Updated app to {release.Version}");
                            Notifier.DisplayMessage(string.Format(Strings.UpdateHasBeenInstalled, release.Version),
                                                    NotificationType.Information);
                        }
                        else
                        {
                            LogTo.Info("App is up to date");
                        }
                    }
                }
                catch (Exception ex) when(ex.Message.Contains("Update.exe"))
                {
                }
                catch (Exception ex)
                {
                    LogTo.WarnException("Error during update check", ex);
                }
            }

            await QueryRateLimit();
        }
Ejemplo n.º 3
0
 private async void ExecuteAccountsCommand()
 {
     await ViewServiceRepository.ShowAccounts();
 }