Esempio n. 1
0
        private async void AnyDateTimeDialog(DateTimeDialog func, object caption, DateTime current
                                             , IJsExecutable positiveHandler, object positiveValue, IJsExecutable negativeHandler, object negativeValue)
        {
            ControlsContext.Current.ActionHandlerLocker.Acquire();
            try
            {
                string capt = ObjToString(caption);

                var ok     = new DialogButton(D.OK);
                var cancel = new DialogButton(D.CANCEL);

                IDialogAnswer <DateTime> answer = await func(capt, current, ok, cancel);

                IJsExecutable handler = answer.Positive ? positiveHandler : negativeHandler;
                object        value   = answer.Positive ? positiveValue : negativeValue;

                if (handler != null)
                {
                    handler.ExecuteCallback(_scriptEngine.Visitor, value, new Args <DateTime>(answer.Result));
                }
            }
            finally
            {
                ControlsContext.Current.ActionHandlerLocker.Release();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Показать диалог ввода даты
        /// </summary>
        /// <returns></returns>
        public async Task <DateTime?> ShowDateTimeDialog()
        {
            var dialog = new DateTimeDialog();

            await ShowDialog(dialog);

            return(dialog.Result);
        }
Esempio n. 3
0
        private async void AnyDateTimeDialog(DateTimeDialog func, object caption, DateTime current
            , IJsExecutable positiveHandler, object positiveValue, IJsExecutable negativeHandler, object negativeValue)
        {
            ControlsContext.Current.ActionHandlerLocker.Acquire();
            try
            {
                string capt = ObjToString(caption);

                var ok = new DialogButton(D.OK);
                var cancel = new DialogButton(D.CANCEL);

                IDialogAnswer<DateTime> answer = await func(capt, current, ok, cancel);

                IJsExecutable handler = answer.Positive ? positiveHandler : negativeHandler;
                object value = answer.Positive ? positiveValue : negativeValue;

                if (handler != null)
                    handler.ExecuteCallback(_scriptEngine.Visitor, value, new Args<DateTime>(answer.Result));
            }
            finally
            {
                ControlsContext.Current.ActionHandlerLocker.Release();
            }
        }
Esempio n. 4
0
 public async Task ShowAsync(string title, string imageURL)
 {
     var contentDialog = new DateTimeDialog(title, imageURL);
     await contentDialog.ShowAsync();
 }