예제 #1
0
 private static void AttachId(MapHashable entry, Guid?parentId = null)
 {
     if (parentId.HasValue)
     {
         entry.ParentId = parentId;
     }
 }
예제 #2
0
 public void PersistEntry(MapHashable entry)
 {
     lock (Locking)
     {
         this.conn.InsertOrReplace(entry, typeof(MapHashable));
     }
 }
예제 #3
0
        private async Task UpdateImageAsync(MapHashable entry)
        {
            string filePath = $"Map/{entry.Id}.png";
            var    fileHash = Convert.ToBase64String(this.cache.GetSha1HashFromFile(filePath) ?? new byte[0]);

            if (fileHash != entry.Hash)
            {
                var imageStream = await this.webHandler.GetImageStreamAsync(entry.Id);

                await this.cache.WriteFileAsync(filePath, imageStream);
            }
        }
예제 #4
0
        private UIViewController CreateTabFor(MapHashable map)
        {
            var screen = new UIViewController();

            var image = Mvx.IocConstruct <ImageLoader>().LoadImage(map.ImagePath);

            var imageView = new UIImageView(new CGRect(new CGPoint(0, 100), CGSize.Subtract(screen.View.Frame.Size, new CGSize(0, 200))))
            {
                ContentMode = UIViewContentMode.ScaleAspectFit,
                Image       = image
            };

            screen.Add(imageView);

            screen.NavigationItem.Title = map.Title;
            screen.TabBarItem           = new UITabBarItem(map.Title, null, this.tabCount++);

            return(screen);
        }
예제 #5
0
 private void UpdateEntry(MapHashable entry)
 {
     this.repo.PersistEntry(entry);
 }