예제 #1
0
 public MobileGame(AndroidContent.Context context, Setup setupDelegate, Update updateDelegate)
     : base(context)
 {
     window = new Window(this);
     this.setupDelegate = setupDelegate;
     this.updateDelegate = updateDelegate;
 }
        public void ComposeEmail(string to, string cc, string subject, string body, bool isHtml)
        {
            var emailIntent = new Intent(global::Android.Content.Intent.ActionSend);

            var toList = new[] {to ?? string.Empty};
            var ccList = new[] {cc ?? string.Empty};
            ;

            emailIntent.PutExtra(global::Android.Content.Intent.ExtraEmail, toList);
            emailIntent.PutExtra(global::Android.Content.Intent.ExtraCc, ccList);

            emailIntent.PutExtra(global::Android.Content.Intent.ExtraSubject, subject ?? string.Empty);

            if (isHtml)
                emailIntent.SetType("text/html");
            else
                emailIntent.SetType("plain/text");

            emailIntent.PutExtra(global::Android.Content.Intent.ExtraText, body ?? string.Empty);

            StartActivity(emailIntent);
        }
예제 #3
0
		public Style GetStyle(int style)
		{
			var result = new Style(typeof(Label));

			double fontSize = 0;
			string fontFamily = null;
			global::Android.Graphics.Color defaultColor = global::Android.Graphics.Color.Argb(0, 0, 0, 0);
			global::Android.Graphics.Color androidColor = defaultColor;

			Context context = Forms.Context;
			using (var value = new TypedValue())
			{
				if (context.Theme.ResolveAttribute(style, value, true))
				{
					var styleattrs = new[] { global::Android.Resource.Attribute.TextSize, global::Android.Resource.Attribute.FontFamily, global::Android.Resource.Attribute.TextColor };
					using (TypedArray array = context.ObtainStyledAttributes(value.ResourceId, styleattrs))
					{
						fontSize = context.FromPixels(array.GetDimensionPixelSize(0, -1));
						fontFamily = array.GetString(1);
						androidColor = array.GetColor(2, defaultColor);
					}
				}
			}

			if (fontSize > 0)
				result.Setters.Add(new Setter { Property = Label.FontSizeProperty, Value = fontSize });

			if (!string.IsNullOrEmpty(fontFamily))
				result.Setters.Add(new Setter { Property = Label.FontFamilyProperty, Value = fontFamily });

			if (androidColor != defaultColor)
			{
				result.Setters.Add(new Setter { Property = Label.TextColorProperty, Value = Color.FromRgba(androidColor.R, androidColor.G, androidColor.B, androidColor.A) });
			}

			return result;
		}