void AddSignaturePadLayout(StackLayout root) { signaturePad = new SignaturePadView() { HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 320, BackgroundColor = Color.FromHex("#ecf0f1"), CaptionText = "SIGN HERE", CaptionTextColor = Color.Black, ClearText = "X", ClearTextColor = Color.Red, SignatureLineColor = Color.Black, StrokeColor = Color.FromHex("#2c3e50"), StrokeWidth = 2, VerticalOptions = LayoutOptions.Start }; SignaturePadConfiguration aaas = new SignaturePadConfiguration() { SaveText = "Salvame" }; Button saveButton = new Button { Text = "SAVE", FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null), BackgroundColor = Color.FromHex("#2ECC71"), TextColor = Color.White }; root.Children.Add(signaturePad); root.Children.Add(saveButton); }
/// <summary> /// Return the Current SignaturePad Configuration /// </summary> /// <returns>CurrentConfig - The currently set signature pad configuation</returns> public SignaturePadConfiguration GetConfiguration() { if (CurrentConfig == null) { CurrentConfig = SignaturePadConfiguration.Default; } return(CurrentConfig); }
/// <summary> /// Return the Current SignaturePad Configuration /// </summary> /// <returns>CurrentConfig - The currently set signature pad configuation</returns> public SignaturePadConfiguration GetConfiguration() { if (CurrentConfig == null) { CurrentConfig = SignaturePadConfiguration.Default; } return CurrentConfig; }
public virtual Task<SignatureResult> Request(SignaturePadConfiguration config, CancellationToken cancelToken) { CurrentConfig = config ?? SignaturePadConfiguration.Default; this.tcs = new TaskCompletionSource<SignatureResult>(); cancelToken.Register(this.Cancel); Forms.Context.StartActivity(typeof(SignaturePadActivity)); return this.tcs.Task; }
public virtual Task <SignatureResult> Request(SignaturePadConfiguration config, CancellationToken cancelToken) { CurrentConfig = config ?? SignaturePadConfiguration.Default; this.tcs = new TaskCompletionSource <SignatureResult>(); cancelToken.Register(this.Cancel); Forms.Context.StartActivity(typeof(SignaturePadActivity)); return(this.tcs.Task); }
public virtual Task<SignatureResult> Request(SignaturePadConfiguration config, CancellationToken cancelToken) { CurrentConfig = config ?? SignaturePadConfiguration.Default; this.tcs = new TaskCompletionSource<SignatureResult>(); cancelToken.Register(this.Cancel); var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity; activity.StartActivity(typeof(SignaturePadActivity)); return this.tcs.Task; }
public virtual Task <SignatureResult> Request(SignaturePadConfiguration config, CancellationToken cancelToken) { CurrentConfig = config ?? SignaturePadConfiguration.Default; this.tcs = new TaskCompletionSource <SignatureResult>(); cancelToken.Register(this.Cancel); var activity = Mvx.Resolve <IMvxAndroidCurrentTopActivity>().Activity; activity.StartActivity(typeof(SignaturePadActivity)); return(this.tcs.Task); }
public virtual Task<SignatureResult> Request(SignaturePadConfiguration config, CancellationToken cancelToken) { CurrentConfig = config ?? SignaturePadConfiguration.Default; this.tcs = new TaskCompletionSource<SignatureResult>(); cancelToken.Register(this.Cancel); var frame = ((Windows.UI.Xaml.Controls.Frame)Window.Current.Content); //Navigate to the SignatureServicePage frame.Navigate(typeof(SignaturePadServicePage)); return this.tcs.Task; }
public Task<SignatureResult> Request(SignaturePadConfiguration config = null, CancellationToken cancelToken = default(CancellationToken)) { config = config ?? SignaturePadConfiguration.Default; var tcs = new TaskCompletionSource<SignatureResult>(); var controller = new MvxSignatureController(config, x => tcs.TrySetResult(x)); var presenter = Mvx.Resolve<IMvxTouchViewPresenter>(); presenter.PresentModalViewController(controller, true); cancelToken.Register(() => { tcs.TrySetCanceled(); controller.DismissViewController(true, null); }); return tcs.Task; }
public Task<SignatureResult> Request(SignaturePadConfiguration config = null, CancellationToken cancelToken = default(CancellationToken)) { config = config ?? SignaturePadConfiguration.Default; var tcs = new TaskCompletionSource<SignatureResult>(); var controller = new SignatureServiceController(config, x => tcs.TrySetResult(x)); var topCtrl = this.GetTopViewController(); topCtrl.PresentViewController(controller, true, null); cancelToken.Register(() => { tcs.TrySetCanceled(); controller.DismissViewController(true, null); }); return tcs.Task; }
public virtual Task <SignatureResult> Request(SignaturePadConfiguration config, CancellationToken cancelToken) { CurrentConfig = config ?? SignaturePadConfiguration.Default; this.tcs = new TaskCompletionSource <SignatureResult>(); cancelToken.Register(this.Cancel); var frame = ((Windows.UI.Xaml.Controls.Frame)Window.Current.Content); //Navigate to the SignatureServicePage frame.Navigate(typeof(SignaturePadServicePage)); return(this.tcs.Task); }
public Task <SignatureResult> Request(SignaturePadConfiguration config = null, CancellationToken cancelToken = default(CancellationToken)) { config = config ?? SignaturePadConfiguration.Default; var tcs = new TaskCompletionSource <SignatureResult>(); var controller = new SignatureServiceController(config, x => tcs.TrySetResult(x)); var topCtrl = this.GetTopViewController(); topCtrl.PresentViewController(controller, true, null); cancelToken.Register(() => { tcs.TrySetCanceled(); controller.DismissViewController(true, null); }); return(tcs.Task); }
public Task <SignatureResult> Request(SignaturePadConfiguration config = null, CancellationToken cancelToken = default(CancellationToken)) { config = config ?? SignaturePadConfiguration.Default; var tcs = new TaskCompletionSource <SignatureResult>(); var controller = new MvxSignatureController(config, x => tcs.TrySetResult(x)); var presenter = Mvx.Resolve <IMvxTouchViewPresenter>(); presenter.PresentModalViewController(controller, true); cancelToken.Register(() => { tcs.TrySetCanceled(); controller.DismissViewController(true, null); }); return(tcs.Task); }
public virtual Task<SignatureResult> Request(SignaturePadConfiguration config, CancellationToken cancelToken) { CurrentConfig = config ?? SignaturePadConfiguration.Default; this.tcs = new TaskCompletionSource<SignatureResult>(); cancelToken.Register(this.Cancel); //var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity; var intent = new Android.Content.Intent(Android.App.Application.Context, typeof(SignaturePadActivity)); intent.AddFlags(Android.Content.ActivityFlags.NewTask); //NOT RECOMMENDED; BUT NECCESSARY intent.AddFlags(Android.Content.ActivityFlags.ClearWhenTaskReset); intent.AddFlags(Android.Content.ActivityFlags.NoHistory); CurrentConfig.SaveToIntent(intent); var recieverIntent = new Android.Content.IntentFilter("acr.mvvmcross.plugins.signaturepad.droid.SIGNATURE"); Android.App.Application.Context.RegisterReceiver(new Broadcast.SignatureReceiver(), recieverIntent); Android.App.Application.Context.StartActivity(intent); return this.tcs.Task; }
public static void SaveToIntent(this SignaturePadConfiguration config, Intent intent) { intent.PutExtra(() => config.BackgroundColor); intent.PutExtra(() => config.CancelText); intent.PutExtra(() => config.CaptionText); intent.PutExtra(() => config.CaptionTextColor); intent.PutExtra(() => config.ClearText); intent.PutExtra(() => config.ClearTextColor); intent.PutExtraEnum(() => config.ImageType); intent.PutExtra(() => config.PromptText); intent.PutExtra(() => config.PromptTextColor); intent.PutExtra(() => config.SaveText); intent.PutExtra(() => config.SignatureBackgroundColor); intent.PutExtra(() => config.SignatureLineColor); intent.PutExtra(() => config.StrokeColor); intent.PutExtra(() => config.StrokeWidth); intent.PutExtra(() => config.BackgroundImage); intent.PutExtra(() => config.BackgroundImageAlpha); intent.PutExtra(() => config.CropImage); intent.PutExtra(() => config.Points); }
public virtual Task <SignatureResult> Request(SignaturePadConfiguration config, CancellationToken cancelToken) { CurrentConfig = config ?? SignaturePadConfiguration.Default; this.tcs = new TaskCompletionSource <SignatureResult>(); cancelToken.Register(this.Cancel); //var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity; var intent = new Android.Content.Intent(Android.App.Application.Context, typeof(SignaturePadActivity)); intent.AddFlags(Android.Content.ActivityFlags.NewTask); //NOT RECOMMENDED; BUT NECCESSARY intent.AddFlags(Android.Content.ActivityFlags.ClearWhenTaskReset); intent.AddFlags(Android.Content.ActivityFlags.NoHistory); CurrentConfig.SaveToIntent(intent); var recieverIntent = new Android.Content.IntentFilter("acr.mvvmcross.plugins.signaturepad.droid.SIGNATURE"); Android.App.Application.Context.RegisterReceiver(new Broadcast.SignatureReceiver(), recieverIntent); Android.App.Application.Context.StartActivity(intent); return(this.tcs.Task); }
protected override void OnCreate(Bundle bundle) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(bundle); this.SetContentView(Resource.Layout.SignaturePad); SignaturePadOrientation actualOrientation = SignaturePadOrientation.Automatic; this.currentConfig = new SignaturePadConfiguration(); this.currentConfig.LoadFromIntent(this.Intent); var rootView = this.FindViewById <RelativeLayout>(Resource.Id.rootView); this.signatureView = this.FindViewById <SignaturePadView>(Resource.Id.signatureView); this.btnSave = this.FindViewById <Button>(Resource.Id.btnSave); this.btnCancel = this.FindViewById <Button>(Resource.Id.btnCancel); var cfg = currentConfig; rootView.SetBackgroundColor(cfg.BackgroundColor.ToAndroidColor()); this.signatureView.BackgroundColor = cfg.SignatureBackgroundColor.ToAndroidColor(); this.signatureView.Caption.Text = cfg.CaptionText; this.signatureView.Caption.SetTextColor(cfg.CaptionTextColor.ToAndroidColor()); this.signatureView.ClearLabel.Text = cfg.ClearText; this.signatureView.ClearLabel.SetTextColor(cfg.ClearTextColor.ToAndroidColor()); this.signatureView.SignatureLineColor = cfg.SignatureLineColor.ToAndroidColor(); this.signatureView.SignaturePrompt.Text = cfg.PromptText; this.signatureView.SignaturePrompt.SetTextColor(cfg.PromptTextColor.ToAndroidColor()); this.signatureView.StrokeColor = cfg.StrokeColor.ToAndroidColor(); this.signatureView.StrokeWidth = cfg.StrokeWidth; this.btnSave.Text = cfg.SaveText; this.btnCancel.Text = cfg.CancelText; if (string.IsNullOrWhiteSpace(cfg.CancelText)) { this.btnCancel.Visibility = ViewStates.Invisible; } var exif = new ExifInterface(cfg.BackgroundImage); var orientation = exif.GetAttribute(ExifInterface.TagOrientation); var width = exif.GetAttributeInt(ExifInterface.TagImageWidth, 100); var height = exif.GetAttributeInt(ExifInterface.TagImageLength, 80); switch (orientation) { case "1": // landscape case "3": // landscape actualOrientation = SignaturePadOrientation.Landscape; break; case "8": case "4": case "6": // portrait actualOrientation = SignaturePadOrientation.Portrait; break; case "0": //undefined default: if (width > height) { actualOrientation = SignaturePadOrientation.Landscape; } else { actualOrientation = SignaturePadOrientation.Portrait; } break; } switch (actualOrientation) { case SignaturePadOrientation.Landscape: this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Landscape; break; case SignaturePadOrientation.Portrait: this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; break; } this.signatureView.BackgroundImageView.LayoutParameters.Height = ViewGroup.LayoutParams.FillParent; this.signatureView.BackgroundImageView.LayoutParameters.Width = ViewGroup.LayoutParams.FillParent; this.signatureView.BackgroundImageView.ViewTreeObserver.GlobalLayout += (sender, e) => //also tried with _View { var newSize = new Size(this.signatureView.Width, this.signatureView.Height); if (newSize.Width > 0 && !hasBackground) { if (cfg.Points != null && cfg.Points.Count() > 0) { var points = cfg.Points.Select(i => i.GetPointF()).ToArray(); this.signatureView.LoadPoints(points); } else { } //Get a smaller image if needed (memory optimization) var bm = LoadAndResizeBitmap(cfg.BackgroundImage, newSize); if (bm != null) { hasBackground = true; switch (cfg.BackgroundImageSize) { case SignaturePadBackgroundSize.Fill: this.signatureView.BackgroundImageView.SetScaleType(ImageView.ScaleType.FitXy); this.signatureView.BackgroundImageView.SetAdjustViewBounds(true); break; case SignaturePadBackgroundSize.Stretch: this.signatureView.BackgroundImageView.SetScaleType(ImageView.ScaleType.FitXy); break; } this.signatureView.BackgroundImageView.SetImageBitmap(bm); } } }; }
protected override void OnCreate(Bundle bundle) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(bundle); this.SetContentView(Resource.Layout.SignaturePad); SignaturePadOrientation actualOrientation = SignaturePadOrientation.Automatic; this.currentConfig = new SignaturePadConfiguration(); this.currentConfig.LoadFromIntent(this.Intent); var rootView = this.FindViewById<RelativeLayout>(Resource.Id.rootView); this.signatureView = this.FindViewById<SignaturePadView>(Resource.Id.signatureView); this.btnSave = this.FindViewById<Button>(Resource.Id.btnSave); this.btnCancel = this.FindViewById<Button>(Resource.Id.btnCancel); var cfg = currentConfig; rootView.SetBackgroundColor(cfg.BackgroundColor.ToAndroidColor()); this.signatureView.BackgroundColor = cfg.SignatureBackgroundColor.ToAndroidColor(); this.signatureView.Caption.Text = cfg.CaptionText; this.signatureView.Caption.SetTextColor(cfg.CaptionTextColor.ToAndroidColor()); this.signatureView.ClearLabel.Text = cfg.ClearText; this.signatureView.ClearLabel.SetTextColor(cfg.ClearTextColor.ToAndroidColor()); this.signatureView.SignatureLineColor = cfg.SignatureLineColor.ToAndroidColor(); this.signatureView.SignaturePrompt.Text = cfg.PromptText; this.signatureView.SignaturePrompt.SetTextColor(cfg.PromptTextColor.ToAndroidColor()); this.signatureView.StrokeColor = cfg.StrokeColor.ToAndroidColor(); this.signatureView.StrokeWidth = cfg.StrokeWidth; this.btnSave.Text = cfg.SaveText; this.btnCancel.Text = cfg.CancelText; if (string.IsNullOrWhiteSpace(cfg.CancelText)) { this.btnCancel.Visibility = ViewStates.Invisible; } var exif = new ExifInterface(cfg.BackgroundImage); var orientation = exif.GetAttribute(ExifInterface.TagOrientation); var width = exif.GetAttributeInt(ExifInterface.TagImageWidth, 100); var height = exif.GetAttributeInt(ExifInterface.TagImageLength, 80); switch (orientation) { case "1": // landscape case "3": // landscape actualOrientation = SignaturePadOrientation.Landscape; break; case "8": case "4": case "6": // portrait actualOrientation = SignaturePadOrientation.Portrait; break; case "0": //undefined default: if (width > height) actualOrientation = SignaturePadOrientation.Landscape; else actualOrientation = SignaturePadOrientation.Portrait; break; } switch (actualOrientation) { case SignaturePadOrientation.Landscape: this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Landscape; break; case SignaturePadOrientation.Portrait: this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait; break; } this.signatureView.BackgroundImageView.LayoutParameters.Height = ViewGroup.LayoutParams.FillParent; this.signatureView.BackgroundImageView.LayoutParameters.Width = ViewGroup.LayoutParams.FillParent; this.signatureView.BackgroundImageView.ViewTreeObserver.GlobalLayout += (sender, e) => //also tried with _View { var newSize = new Size(this.signatureView.Width, this.signatureView.Height); if (newSize.Width > 0 && !hasBackground) { if (cfg.Points != null && cfg.Points.Count() > 0) { var points = cfg.Points.Select(i => i.GetPointF()).ToArray(); this.signatureView.LoadPoints(points); } else { } //Get a smaller image if needed (memory optimization) var bm = LoadAndResizeBitmap(cfg.BackgroundImage, newSize); if (bm != null) { hasBackground = true; switch (cfg.BackgroundImageSize) { case SignaturePadBackgroundSize.Fill: this.signatureView.BackgroundImageView.SetScaleType(ImageView.ScaleType.FitXy); this.signatureView.BackgroundImageView.SetAdjustViewBounds(true); break; case SignaturePadBackgroundSize.Stretch: this.signatureView.BackgroundImageView.SetScaleType(ImageView.ScaleType.FitXy); break; } this.signatureView.BackgroundImageView.SetImageBitmap(bm); } } }; }
public SignatureServiceController(SignaturePadConfiguration config, IEnumerable<DrawPoint> points) { this.config = config; this.points = points; }
public Task <SignatureResult> Request(SignaturePadConfiguration config = null, CancellationToken cancelToken = new CancellationToken()) { throw new NotImplementedException(); }
public SignatureServiceController(SignaturePadConfiguration config, Action<SignatureResult> onResult) { this.config = config; this.onResult = onResult; }
public SignatureServiceController(SignaturePadConfiguration config, Action <SignatureResult> onResult) { this.config = config; this.onResult = onResult; }
public SignatureServiceController(SignaturePadConfiguration config, IEnumerable <DrawPoint> points) { this.config = config; this.points = points; }
public Task<SignatureResult> Request(SignaturePadConfiguration config = null, CancellationToken cancelToken = new CancellationToken()) { throw new NotImplementedException(); }