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


C# Platform.SetPage方法代码示例

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


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

示例1: LoadApplication

		protected void LoadApplication(Application application)
		{
			if (application == null)
				throw new ArgumentNullException("application");

			Application.Current = application;
			Platform = CreatePlatform();
			Platform.SetPage(Application.Current.MainPage);
			application.PropertyChanged += OnApplicationPropertyChanged;

			Application.Current.SendStart();
		}
开发者ID:Costo,项目名称:Xamarin.Forms,代码行数:12,代码来源:WindowsBasePage.cs

示例2: InternalSetPage

		void InternalSetPage(Page page)
		{
			if (!Forms.IsInitialized)
				throw new InvalidOperationException("Call Forms.Init (Activity, Bundle) before this");

			if (_canvas != null)
			{
				_canvas.SetPage(page);
				return;
			}

			var busyCount = 0;
			MessagingCenter.Subscribe(this, Page.BusySetSignalName, (Page sender, bool enabled) =>
			{
				busyCount = Math.Max(0, enabled ? busyCount + 1 : busyCount - 1);

				if (!Forms.SupportsProgress)
					return;

				SetProgressBarIndeterminate(true);
				UpdateProgressBarVisibility(busyCount > 0);
			});

			UpdateProgressBarVisibility(busyCount > 0);

			MessagingCenter.Subscribe(this, Page.AlertSignalName, (Page sender, AlertArguments arguments) =>
			{
				AlertDialog alert = new AlertDialog.Builder(this).Create();
				alert.SetTitle(arguments.Title);
				alert.SetMessage(arguments.Message);
				if (arguments.Accept != null)
					alert.SetButton((int)DialogButtonType.Positive, arguments.Accept, (o, args) => arguments.SetResult(true));
				alert.SetButton((int)DialogButtonType.Negative, arguments.Cancel, (o, args) => arguments.SetResult(false));
				alert.CancelEvent += (o, args) => { arguments.SetResult(false); };
				alert.Show();
			});

			MessagingCenter.Subscribe(this, Page.ActionSheetSignalName, (Page sender, ActionSheetArguments arguments) =>
			{
				var builder = new AlertDialog.Builder(this);
				builder.SetTitle(arguments.Title);
				string[] items = arguments.Buttons.ToArray();
				builder.SetItems(items, (sender2, args) => { arguments.Result.TrySetResult(items[args.Which]); });

				if (arguments.Cancel != null)
					builder.SetPositiveButton(arguments.Cancel, delegate { arguments.Result.TrySetResult(arguments.Cancel); });

				if (arguments.Destruction != null)
					builder.SetNegativeButton(arguments.Destruction, delegate { arguments.Result.TrySetResult(arguments.Destruction); });

				AlertDialog dialog = builder.Create();
				builder.Dispose();
				//to match current functionality of renderer we set cancelable on outside
				//and return null
				dialog.SetCanceledOnTouchOutside(true);
				dialog.CancelEvent += (sender3, e) => { arguments.SetResult(null); };
				dialog.Show();
			});

			_canvas = new Platform(this);
			if (_application != null)
				_application.Platform = _canvas;
			_canvas.SetPage(page);
			_layout.AddView(_canvas.GetViewGroup());
		}
开发者ID:cosullivan,项目名称:Xamarin.Forms,代码行数:65,代码来源:FormsApplicationActivity.cs


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