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(); } }
/// <summary> /// Показать диалог ввода даты /// </summary> /// <returns></returns> public async Task <DateTime?> ShowDateTimeDialog() { var dialog = new DateTimeDialog(); await ShowDialog(dialog); return(dialog.Result); }
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(); } }
public async Task ShowAsync(string title, string imageURL) { var contentDialog = new DateTimeDialog(title, imageURL); await contentDialog.ShowAsync(); }