Exemplo n.º 1
0
		public virtual void DrawThumbnail (IDocument doc, IGraphics g, SizeF size, Theme theme)
		{
			g.SetColor (GetThumbnailBackgroundColor (theme));
			g.FillRect (new RectangleF (PointF.Empty, size));
		}
Exemplo n.º 2
0
		public virtual Color GetThumbnailBackgroundColor (Theme theme) {
			return theme.DocumentBackgroundColor.GetColor ();
		}
			public override void ApplyTheme (Theme theme)
			{
				SetNeedsDisplay ();
			}
		public override void ApplyTheme (Theme theme)
		{
			base.ApplyTheme (theme);
			RefreshThumbnail ();
		}
Exemplo n.º 5
0
		async Task<UIImage> GenerateDocumentThumbnailAsync (IDocument s, Praeclarum.Graphics.SizeF size, Theme theme)
		{
			var scale = UIScreen.MainScreen.Scale;
			return await Task.Run (() => {

				var width = (int)(size.Width * scale);
				var height = (int)(size.Height * scale);

				using (var colorSpace = CoreGraphics.CGColorSpace.CreateDeviceRGB ()) {
					using (var c = new CoreGraphics.CGBitmapContext (
						              IntPtr.Zero,
						              width,
						              height,
						              8,
						              4 * width,
						              colorSpace,
						              CoreGraphics.CGImageAlphaInfo.NoneSkipFirst)) {

						c.TranslateCTM (0, height);
						c.ScaleCTM (scale, -scale);

						var g = new Praeclarum.Graphics.CoreGraphicsGraphics (c, true);
						App.DrawThumbnail (s, g, size, theme);

						//
						// Create the bitmap
						//
						return UIImage.FromImage (c.ToImage (), scale, UIImageOrientation.Up);
					}
				}
			});
		}
		public override void ApplyTheme (Theme theme)
		{
			base.ApplyTheme (theme);
			RefreshThumbnails ().ContinueWith (t => {
				if (t.IsFaulted) {
					Console.WriteLine (t.Exception);
				}
			});
		}
		public void ApplyTheme (Theme theme)
		{
			button.SetNeedsDisplay ();
		}
Exemplo n.º 8
0
		public virtual string GetThumbnailKey (IFile file, Theme theme)
		{
			if (file == null)
				return "";

			return string.Format ("{0}-{1}{2}",
				FileSystemManager.Shared.ActiveFileSystem.Id,
				file.Path.Replace ('/', '-').Replace ('.', '-'),
				theme.IsDark ? "-Dark14" : "");
		}
		public void ApplyTheme (Theme theme)
		{
			BackgroundColor = theme.DocumentsBackgroundColor;
			if (ios7) {
				segs.TintColor = theme.DocumentsControlColor;
			}
		}
Exemplo n.º 10
0
			public void ApplyTheme (Theme theme)
			{
//				var appdel = DocumentAppDelegate.Shared;
				BackgroundColor = UIColor.Clear;// appdel.App.GetThumbnailBackgroundColor (appdel.Theme).GetUIColor ().ColorWithAlpha (0.5f);
			}
Exemplo n.º 11
0
		public virtual void ApplyTheme (Theme theme)
		{
			SetNeedsDisplay ();
		}
Exemplo n.º 12
0
		public void ApplyTheme (Theme theme)
		{
			BackgroundColor = theme.DocumentsBackgroundColor;	
		}
Exemplo n.º 13
0
		public void ApplyTheme (Theme theme)
		{
			BackgroundColor = theme.DocumentsBackgroundColor;
			if (label != null) {
				label.TextColor = theme.NavigationTextColor;
			}
		}
			public void ApplyTheme (Theme theme)
			{
				BackgroundColor = theme.TableCellBackgroundColor;
				TextLabel.TextColor = theme.TableCellTextColor;
			}
Exemplo n.º 15
0
		public static UIColor GetNotSelectableColor (Theme theme) {
			if (theme.IsDark) {
				return UIColor.FromWhiteAlpha (1.0f - 0.875f, 0.5961f);;
			}
			return UIColor.FromWhiteAlpha (0.875f, 0.5961f);
		}
Exemplo n.º 16
0
		static Theme ()
		{
			Current = new Theme (dark: false);
		}
Exemplo n.º 17
0
		public virtual void ApplyTheme (Theme theme)
		{
			BackgroundColor = theme.DocumentsBackgroundColor;
			if (label != null) {
				label.BackgroundColor = theme.DocumentsBackgroundColor;
			}
		}
Exemplo n.º 18
0
		public virtual async Task<UIImage> GenerateThumbnailAsync (DocumentReference docRef, Praeclarum.Graphics.SizeF size, Theme theme)
		{
			UIImage r = null;

			IDocument doc = null;
			LocalFileAccess local = null;
			var opened = false;

			//
			// Draw the document
			//
			try {
				local = await docRef.File.BeginLocalAccess ();
				var f = local.LocalPath;

				doc = App.CreateDocument (f);
				await doc.OpenAsync ();
				opened = true;

//				Console.WriteLine ("GenerateThumbnail: " + docRef.File.Path + " " + docRef.File.ModifiedTime);

				r = await GenerateDocumentThumbnailAsync (doc, size, theme);

			} catch (Exception ex) {
				Debug.WriteLine ("FAILED to genenerate thumbnail for {0}, {1}", docRef.File.Path, ex.Message);
//				Debug.WriteLine (ex);
			}

			if (opened) {
				try {
					await doc.CloseAsync ();					
				} catch (Exception ex) {
					Console.WriteLine (ex);
				}
			}

			if (local != null) {
				try {
					await local.End ();
				} catch (Exception ex) {
					Console.WriteLine (ex);
				}
			}

			return r;
		}
Exemplo n.º 19
0
		public override void ApplyTheme (Theme theme)
		{
			base.ApplyTheme (theme);
			if (label != null) {
				label.TextColor = theme.NavigationTextColor;
			}
		}
Exemplo n.º 20
0
		protected virtual void SetTheme (Theme newTheme)
		{
			Theme.Current = newTheme;
			newTheme.Apply ();
			UpdateFonts ();
		}
Exemplo n.º 21
0
		async Task<UIImage> GetThumbnail (DocumentReference doc, Theme theme)
		{
			var appDel = DocumentAppDelegate.Shared;
			var Cache = appDel.ThumbnailCache;

			var thumbKey = appDel.GetThumbnailKey (doc.File, theme);

			var thumbImage = await Cache.GetImageAsync (thumbKey, doc.ModifiedTime);

			if (thumbImage == null) {
				thumbImage = await appDel.GenerateThumbnailAsync (doc, ThumbnailSize, theme);
				if (thumbImage != null) {
					await Cache.SetGeneratedImageAsync (thumbKey, thumbImage, saveToDisk: true);
				}
			}

			return thumbImage;
		}