public async void CheckVersion() { try { if (!alreadyChecked) { AssureVersion(); var myVersion = VersionUtils.getVersion(); var config = DB.Instance.GetConfig(); alreadyChecked = true; VersionResponse checkVersion = await _irpyteDownloader.CheckVersion(currentVersion); var newVersionStatus = new NewVersionStatus(checkVersion.newestVersion, checkVersion.needToUpdate, checkVersion.url, myVersion); config.NewVersionStatus = newVersionStatus; logger.Info("NewVersionStatus: " + newVersionStatus); DB.Instance.UpdateConfig(config); } } catch (Exception e) { logger.Error(e, "Couldn't check version"); } }
public void AssureVersion() { lock (this) { var config = DB.Instance.GetConfig(); var myVersion = VersionUtils.getVersion(); if (config.NewVersionStatus != null && config.NewVersionStatus.myVersion != myVersion) { logger.Info("New version has been downloaded: " + myVersion); config.NewVersionStatus = null; DB.Instance.UpdateConfig(config); } } }
private void inicializarComponente() { /* * _logoImage = new Image * { * Source = "logo_menu.png", * HorizontalOptions = LayoutOptions.CenterAndExpand, * VerticalOptions = LayoutOptions.Center, * WidthRequest = 150, * HeightRequest = 150 * }; */ _listView = new ListView { HasUnevenRows = true, RowHeight = -1, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Style = Estilo.Estilo.Current[Estilo.Estilo.MENU_LISTA], ItemTemplate = new DataTemplate(typeof(MenuItemCell)) }; _listView.SetBinding(ListView.ItemsSourceProperty, new Binding(".")); _listView.ItemsSource = _menus; _listView.ItemTapped += (sender, e) => { MenuItemInfo item = (MenuItemInfo)e.Item; if (item.aoClicar != null) { item.aoClicar(sender, new EventArgs()); _listView.SelectedItem = null; if (App.Current.MainPage is MasterDetailPage) { ((MasterDetailPage)App.Current.MainPage).IsPresented = false; } } }; /* * _fotoImage = new Image * { * Margin = new Thickness(0, 5, 0, 0), * VerticalOptions = LayoutOptions.Start, * HorizontalOptions = LayoutOptions.Start, * Source = "imovel_corretor.png", * WidthRequest = 40, * HeightRequest = 40, * Aspect = Aspect.AspectFit * }; */ _nomeLabel = new Label { TextColor = Color.FromHex("#ffffff"), FontSize = 18, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Start }; /* * _tipoLabel = new Label * { * TextColor = Color.FromHex("#ffffff"), * FontSize = 15, * FontAttributes = FontAttributes.Italic, * VerticalOptions = LayoutOptions.Start, * HorizontalOptions = LayoutOptions.Start * }; */ /* * _usuarioLayout = new StackLayout * { * Orientation = StackOrientation.Horizontal, * VerticalOptions = LayoutOptions.Start, * HorizontalOptions = LayoutOptions.CenterAndExpand, * Margin = new Thickness(0, 10), * Spacing = 10, * Children = { * _fotoImage, * new StackLayout { * Orientation = StackOrientation.Vertical, * VerticalOptions = LayoutOptions.Start, * HorizontalOptions = LayoutOptions.Start, * Spacing = 0, * Children = { * _nomeLabel, * _tipoLabel * } * } * } * }; */ _versaoLabel = new Label { VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.Fill, Style = Estilo.Estilo.Current[Estilo.Estilo.MENU_TEXTO], FontSize = 11, HorizontalTextAlignment = TextAlignment.Center }; _versaoLabel.Text = "Versão: " + VersionUtils.getVersion() + " (build " + VersionUtils.getBuild() + ")"; _mainLayout = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(5, 25, 5, 5), BackgroundColor = Color.Transparent }; }