當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。