private static void UpdateItem( DatabaseItem item, string icon) { var info = (DatabaseInfo)item.Info; if (info.HasPassword) { item.PasswordIcon = ThemeData .GetImageSource("unlock"); } else item.PasswordIcon = null; if (!string.IsNullOrEmpty(icon)) { item.UpdatedIcon = ThemeData .GetImageSource(icon); } else item.UpdatedIcon = null; }
private static void UpdateItem( DatabaseItem item, bool updated) { var info = (DatabaseInfo)item.Info; if (info.HasPassword) { item.PasswordIcon = ThemeData .GetImageSource("unlock"); } else item.PasswordIcon = null; if (updated) { item.UpdatedIcon = ThemeData .GetImageSource("updated"); } else item.UpdatedIcon = null; }
private void Update(DatabaseItem item) { if (item == null) throw new ArgumentNullException("item"); if (!Network.CheckNetwork()) return; item.IsUpdating = true; var database = (DatabaseInfo)item.Info; database.Update(_ => item.IsUpdating, DatabaseUpdated); }
private void ListDatabases(string tile, string syncdb) { var dispatcher = Dispatcher; var databases = DatabaseInfo.GetAll(); var open = tile == null ? null : databases.FirstOrDefault( x => x.Folder == tile); if (open != null) { dispatcher.BeginInvoke( () => Open(open, true)); return; } foreach (var db in databases) db.LoadDetails(); var items = databases .Where(x => x.Details != null) .Select(x => new DatabaseItem(x)) .OrderBy(x => x.Name) .ToList(); foreach (var item in items) { var local = item; dispatcher.BeginInvoke(() => { if (_items.Contains(local)) return; UpdateItem(local, null); _items.Add(local); }); } var hasUpdatables = items .Any(x => x.CanUpdate); dispatcher.BeginInvoke(() => _RefreshButton.IsEnabled = hasUpdatables); if (syncdb != null) { foreach (var db in items) { var test = (DatabaseInfo)db.Info; if (test.Folder == syncdb) db.IsUpdating = true; } var udbi = databases.FirstOrDefault(x => x.Folder == syncdb); var udb = new DatabaseItem(udbi); Update(udb); } var UpdateAbleDBs = items .Where(x => x.CanUpdate); // AutoUpdate if (!_fAppLoaded) { _fAppLoaded = true; dispatcher.BeginInvoke(() => { if (hasUpdatables) { _RefreshButton.IsEnabled = true; if (AppSettings.Instance.AutoUpdate) { if (AppSettings.Instance.AutoUpdateWLAN) { if (DeviceNetworkInformation.IsWiFiEnabled) { foreach (var uDB in UpdateAbleDBs) Update(uDB); } } else { foreach (var uDB in UpdateAbleDBs) Update(uDB); } } } else _RefreshButton.IsEnabled = false; }); } }
protected bool Equals(DatabaseItem other) { return Equals(_info, other._info); }
protected bool Equals(DatabaseItem other) { return(Equals(_info, other._info)); }