当前位置: 首页>>代码示例>>C#>>正文


C# Button.SetHighlightColor方法代码示例

本文整理汇总了C#中Button.SetHighlightColor方法的典型用法代码示例。如果您正苦于以下问题:C# Button.SetHighlightColor方法的具体用法?C# Button.SetHighlightColor怎么用?C# Button.SetHighlightColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Button的用法示例。


在下文中一共展示了Button.SetHighlightColor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Refresh

		void Refresh()
		{
			if (input == null) {
				// Normal dialog
				// TODO: HTML
				textDescription.Text = messageBox.Text; // Html.FromHtml(messageBox.HTML.Replace("&lt;BR&gt;", "<br>").Replace("<br>\n", "<br>").Replace("\n", "<br>"));
				textDescription.Gravity = GravityFlags.Left;
				if (messageBox.Image != null) {
					imageView.SetImageBitmap (ctrl.ConvertMediaToBitmap(messageBox.Image));
					imageView.Visibility = ViewStates.Visible;
				} else {
					imageView.Visibility = ViewStates.Gone;
				}
				if (!String.IsNullOrEmpty (messageBox.FirstButtonLabel)) {
					btnView1.Visibility = ViewStates.Visible;
					btnView1.Text = messageBox.FirstButtonLabel;
				} else
					btnView1.Visibility = ViewStates.Gone;
				if (!String.IsNullOrEmpty (messageBox.SecondButtonLabel)) {
					btnView2.Visibility = ViewStates.Visible;
					btnView2.Text = messageBox.SecondButtonLabel;
				} else
					btnView2.Visibility = ViewStates.Gone;
			} else {
				// TODO: HTML
				textDescription.Text = input.Text; // Html.FromHtml(input.HTML.Replace("&lt;BR&gt;", "<br>").Replace("<br>\n", "<br>").Replace("\n", "<br>"));
				textDescription.Gravity = GravityFlags.Left;
				if (input.Image != null) {
					imageView.SetImageBitmap (ctrl.ConvertMediaToBitmap(input.Image));
					imageView.Visibility = ViewStates.Visible;
				} else {
					imageView.Visibility = ViewStates.Gone;
				}
				if (input.InputType == InputType.MultipleChoice) {
					// Multiple choice dialog
					layoutMultipleChoice.RemoveAllViews ();
					foreach (string s in input.Choices) {
						Button btnView = new Button (Activity.ApplicationContext);
						btnView.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
						btnView.SetTextColor(Color.Black);
						btnView.SetHighlightColor(Color.Black);
						btnView.Text = s;
						btnView.Click += OnChoiceClicked;
						layoutMultipleChoice.AddView (btnView);
					}
				} else {
					// Input dialog
					// ToDo: Clear text field editInput
				}
			}
		}
开发者ID:jonny65,项目名称:WF.Player.Android,代码行数:51,代码来源:ScreenDialog.cs

示例2: Refresh

		void Refresh(object o = null)
		{
			string what = o == null ? "" : (string)o;

			if (activeObject == null || this.Activity == null)
				return;

			Activity.RunOnUiThread(() => {
				if(Activity == null)
					return;

				// Assign this item's values to the various subviews
				ctrl.SupportActionBar.SetDisplayShowHomeEnabled(true);

				string name = activeObject.Name == null ? "" : activeObject.Name;

				if (what.Equals ("") || what.Equals ("Name"))
				{
					if (activeObject is Task)
						ctrl.SupportActionBar.Title = (((Task)activeObject).Complete ? (((Task)activeObject).CorrectState == TaskCorrectness.NotCorrect ? Strings.TaskNotCorrect : Strings.TaskCorrect) + " " : "") + name;
					else
						ctrl.SupportActionBar.Title = name;
				}

				if (what.Equals ("") || what.Equals ("Media")) {
					if (activeObject.Image != null) {
						using (Bitmap bm = ctrl.ConvertMediaToBitmap(activeObject.Image)) {
							_imageView.SetImageBitmap(null);
							_imageView.SetImageBitmap(bm);
						}
						_imageView.Visibility = ViewStates.Visible;
					} else {
						_imageView.Visibility = ViewStates.Gone;
					}
				}

				if (what.Equals ("") || what.Equals ("Description")) {
					if (!String.IsNullOrWhiteSpace (activeObject.Description)) {
						_textDescription.Visibility = ViewStates.Visible;
						_textDescription.Text = activeObject.Description; // Html.FromHtml(activeObject.HTML.Replace("&lt;BR&gt;", "<br>").Replace("<br>\n", "<br>").Replace("\n", "<br>"));
						_textDescription.Gravity = Main.Prefs.TextAlignment.ToSystem();
						_textDescription.SetTextSize(global::Android.Util.ComplexUnitType.Sp, (float)Main.Prefs.TextSize);
					} else {
						_textDescription.Visibility = ViewStates.Visible;
						_textDescription.Text = "";
						_textDescription.Gravity = Main.Prefs.TextAlignment.ToSystem();
						_textDescription.SetTextSize(global::Android.Util.ComplexUnitType.Sp, (float)Main.Prefs.TextSize);
					}
				}
				// Tasks don't have any command button or direction
				if (activeObject is Task) {
					_layoutBottom.Visibility =  ViewStates.Gone;
					return;
				}

				// Check, if the bottom should be displayed or not
				_layoutButtons.Visibility = ((Thing)activeObject).ActiveCommands.Count == 0 ? ViewStates.Invisible : ViewStates.Visible;
				_layoutDirection.Visibility = ctrl.Engine.Player.Inventory.Contains(activeObject) ? ViewStates.Gone : (((Thing)activeObject).VectorFromPlayer == null ? ViewStates.Gone : ViewStates.Visible);
				_layoutBottom.Visibility =  (_layoutButtons.Visibility == ViewStates.Visible || _layoutDirection.Visibility == ViewStates.Visible) ? ViewStates.Visible : ViewStates.Gone;

				if (_layoutButtons.Visibility == ViewStates.Visible) {
					_layoutButtons.RemoveAllViews ();
					commands = ((Thing)activeObject).ActiveCommands;
					_layoutButtons.WeightSum = 1;
					if (commands.Count > 0) {
						Button btnView = new Button (Activity.ApplicationContext);
						btnView.Text = commands.Count == 1 ? commands[0].Text : GetString(Resource.String.screen_detail_commands);
						btnView.SetTextColor(Color.White);
						btnView.SetHighlightColor(Color.White);
						btnView.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
						btnView.LayoutChange += (object sender, View.LayoutChangeEventArgs e) => SetTextScale(btnView);
						btnView.Click += OnButtonClicked;
						// Set size of button
						Android.Views.ViewGroup.LayoutParams lp = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.FillParent, Android.Views.ViewGroup.LayoutParams.FillParent);
						// Add button to view
						_layoutButtons.AddView (btnView, lp);
					}
				}

				if (_layoutDirection.Visibility == ViewStates.Visible) {
					// Draw direction content
					var direction = ((Thing)activeObject).VectorFromPlayer;
					if ( direction != null) {
						_textDirection.Visibility = ViewStates.Visible;
						_imageDirection.Visibility = ViewStates.Visible;
						_textDirection.Text = direction.Distance.BestMeasureAs(DistanceUnit.Meters);
						Bitmap bm;
						_imageDirection.SetImageBitmap(null);
						if (direction.Distance.Value == 0) {
							_imageDirection.SetImageBitmap (BitmapFactory.DecodeResource(Resources, Resource.Drawable.ic_direction_position));
						} else {
							_imageDirection.SetImageBitmap(BitmapArrow.Draw(Math.Min(_imageDirection.Width, _imageDirection.Height), direction.Bearing.Value + Main.GPS.Bearing));
	//							AsyncImageFromDirection.LoadBitmap(_imageDirection, direction.Bearing.Value + Main.GPS.Bearing, 48, 48);
							// TODO:
							// Remove
	//							bm = ctrl.DrawArrow (direction.Bearing.Value + Main.GPS.Bearing);
	//							_imageDirection.SetImageBitmap (bm);
	//							bm = null;
						}
					}
//.........这里部分代码省略.........
开发者ID:WFoundation,项目名称:WF.Player.Android,代码行数:101,代码来源:GameDetailScreenAndroid.cs

示例3: Refresh

		private void Refresh(string what = "")
		{
			if (activeObject != null && this.Activity != null) {
				// Assign this item's values to the various subviews
				((ActionBarActivity)Activity).SupportActionBar.SetDisplayShowHomeEnabled(true);

				string name = activeObject.Name == null ? "" : activeObject.Name;

				if (what.Equals ("") || what.Equals ("Name"))
				{
					if (activeObject is Task)
						((ActionBarActivity)Activity).SupportActionBar.Title = (((Task)activeObject).Complete ? (((Task)activeObject).CorrectState == TaskCorrectness.NotCorrect ? Strings.TaskNotCorrect : Strings.TaskCorrect) + " " : "") + name;
					else
						((ActionBarActivity)Activity).SupportActionBar.Title = name;
				}

				if (what.Equals ("") || what.Equals ("Media")) {
					Bitmap bm = null;

					if (activeObject.Image != null) {
						imageView.SetImageBitmap (ctrl.ConvertMediaToBitmap(activeObject.Image));
						imageView.Visibility = ViewStates.Visible;
					} else {
						imageView.Visibility = ViewStates.Gone;
					}
				}

				if (what.Equals ("") || what.Equals ("Description")) {
					if (!String.IsNullOrWhiteSpace (activeObject.Description)) {
						textDescription.Visibility = ViewStates.Visible;
						textDescription.Text = activeObject.Description; // Html.FromHtml(activeObject.HTML.Replace("&lt;BR&gt;", "<br>").Replace("<br>\n", "<br>").Replace("\n", "<br>"));
						textDescription.Gravity = GravityFlags.Left;
					} else {
						textDescription.Visibility = ViewStates.Visible;
						textDescription.Text = "";
						textDescription.Gravity = GravityFlags.Left;
					}
				}
				// Tasks don't have any command button
				if (activeObject is Task)
					return;

				if (layoutButtons.Visibility == ViewStates.Visible) {
					layoutButtons.RemoveAllViews ();
					commands = ((Thing)activeObject).ActiveCommands;
					for (int i = 0; i < commands.Count; i++) {
						Button btnView = new Button (Activity.ApplicationContext) {
							Text = commands[i].Text,
							Tag = i
						};
						btnView.SetTextColor(Color.Black);
						btnView.SetHighlightColor(Color.Black);
						btnView.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
						btnView.Click += OnButtonClicked;
						layoutButtons.AddView (btnView);
					}
				}

				if (layoutWorksWith.Visibility == ViewStates.Visible) {
					layoutWorksWith.RemoveViews(1,layoutWorksWith.ChildCount-1);
					if (targets.Count == 0) {
						textWorksWith.Text = com.EmptyTargetListText;
						Button btnView = new Button (Activity.ApplicationContext);
						btnView.SetTextColor(Color.Black);
						btnView.SetHighlightColor(Color.Black);
						btnView.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
						btnView.Text = GetString(Resource.String.ok);
						btnView.Click += OnNothingClicked;
						layoutWorksWith.AddView (btnView);
					} else {
						textWorksWith.Text = com.Text;
						for (int i = 0; i < targets.Count; i++) {
							Button btnView = new Button (Activity.ApplicationContext);
							btnView.SetTextColor(Color.Black);
							btnView.SetHighlightColor(Color.Black);
							btnView.SetBackgroundResource(Resource.Drawable.apptheme_btn_default_holo_light);
							btnView.Text = targets[i].Name;
							btnView.Tag = i;
							btnView.Click += OnThingClicked;
							layoutWorksWith.AddView (btnView);
						}
					}
				}

				// Resize scrollview
				layoutDefault.Invalidate();
			}
		}
开发者ID:jonny65,项目名称:WF.Player.Android,代码行数:88,代码来源:ScreenDetailAndroid.cs


注:本文中的Button.SetHighlightColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。