Esempio n. 1
0
        /// <summary>
        /// Dialog with two buttons ('ok' and 'cancel' by default)
        /// </summary>
        /// <param name="title">Title of the dialog.</param>
        /// <param name="settings">Settings options.</param>
        public TwoButtonsDialog(string title = null, TwoButtonsDialogSettings settings = null)
            : base(title)
        {
            // Set the settings. If none specfied, create a default set
            var _settings = settings ?? new TwoButtonsDialogSettings();

            var okButtonText = string.IsNullOrWhiteSpace(_settings.OverrideOkButtonText) ?
                               UiResources.Ok : _settings.OverrideOkButtonText;

            var cancelButtonText = string.IsNullOrWhiteSpace(_settings.OverrideCancelButtonText) ?
                                   UiResources.Cancel : _settings.OverrideCancelButtonText;

            if (!_settings.ApplicationBarButtons)
            {
                this.CreateButtons(okButtonText, cancelButtonText);
                return;
            }

            // Set the default aspect in case of application bar buttons presence
            this.IsFullScreen             = true;
            this.VerticalContentAlignment = VerticalAlignment.Stretch;
            this.OpenAnimation            = AnimationService.GetOpenDialogAnimation();
            this.CloseAnimation           = AnimationService.GetCloseDialogAnimation();

            this.MainGrid.HorizontalAlignment = HorizontalAlignment.Stretch;
            this.MainGrid.VerticalAlignment   = VerticalAlignment.Stretch;

            this.ApplicationBarInfo = new ApplicationBarInfo()
            {
                Buttons =
                {
                    CreateOkApplicationBarButton(okButtonText),         // Default ok button with check icon
                    CreateCancelApplicationBarButton(cancelButtonText), // Default cancel button with cross icon
                }
            };
        }