Esempio n. 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            SignaturePadView signature = FindViewById <SignaturePadView> (Resource.Id.signatureView);

            // Get our button from the layout resource,
            // and attach an event to it
            Button btnSave = FindViewById <Button> (Resource.Id.btnSave);

            btnSave.Click += delegate {
                if (signature.IsBlank)
                {                //Display the base line for the user to sign on.
                    AlertDialog.Builder alert = new AlertDialog.Builder(this);
                    alert.SetMessage("No signature to save.");
                    alert.SetNeutralButton("Okay", delegate { });
                    alert.Create().Show();
                }
                points = signature.Points;
            };
            btnSave.Dispose();

            Button btnLoad = FindViewById <Button> (Resource.Id.btnLoad);

            btnLoad.Click += delegate {
                if (points != null)
                {
                    signature.LoadPoints(points);
                }
            };
            btnLoad.Dispose();
        }
Esempio n. 2
0
 private void InitComponents()
 {
     _signaturePadView = new SignaturePadView(this);
     AddContentView(_signaturePadView,
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                               ViewGroup.LayoutParams.MatchParent));
 }
Esempio n. 3
0
        public Signature1()
        {
            _signature = new SignaturePadView();
            _signature.BackgroundColor    = Color.White;
            _signature.SignatureLineColor = Color.Black;
            _signature.HeightRequest      = 150;
            _signature.WidthRequest       = 240;
            _signature.StrokeColor        = Color.Black;
            _signature.StrokeWidth        = 2;
            _signature.CaptionText        = "Mettre à jour signature";
            _signature.ClearText          = "Vider ";
            _signature.ClearTextColor     = Color.Black;

            Button btnDone = new Button
            {
                HorizontalOptions = LayoutOptions.Center,
                Text = "Save"
            };

            btnDone.Clicked += BtnDone_Clicked;

            Content = new StackLayout
            {
                Spacing  = 10,
                Children =
                {
                    new Label {
                        Text = "Mettre ajour la signature"
                    },
                    _signature,
                    btnDone
                }
            };
        }
Esempio n. 4
0
        public void ValidFillColorReturnsImage()
        {
            SignaturePadView signature = new SignaturePadView(new RectangleF(0, 0, 50, 100));
            UIImage          image     = signature.GetImage(UIColor.Black, UIColor.White);

            Assert.That(image != null);
        }
Esempio n. 5
0
        public void ZeroWidthReturnsNullImage()
        {
            SignaturePadView signature = new SignaturePadView(new RectangleF(0, 0, 50, 100));
            UIImage          image     = signature.GetImage(new SizeF(0, 50));

            Assert.That(image == null);
        }
Esempio n. 6
0
        public void UnboundSignaturePadViewReturnsNullImage()
        {
            SignaturePadView signature = new SignaturePadView();
            UIImage          image     = signature.GetImage();

            Assert.That(image == null);
        }
Esempio n. 7
0
    public CaptureSignature()
    {
        signaturePadView = new SignaturePadView();

        signaturePadView.BackgroundColor    = Color.Yellow;
        signaturePadView.SignatureLineColor = Color.Black;
        signaturePadView.HeightRequest      = 150;
        signaturePadView.WidthRequest       = 240;
        signaturePadView.StrokeColor        = Color.Black;
        signaturePadView.StrokeWidth        = 2;
        signaturePadView.CaptionText        = "Please sign above";
        signaturePadView.ClearText          = "Clear";
        signaturePadView.ClearTextColor     = Color.Red;

        Button btnDone = new Button
        {
            HorizontalOptions = LayoutOptions.Center,
            Text = "Save"
        };

        btnDone.Clicked += BtnDone_Clicked;

        Content = new StackLayout
        {
            Spacing  = 10,
            Children =
            {
                signaturePadView,
                btnDone
            }
        };
    }
Esempio n. 8
0
        public void StrokeColorChanges()
        {
            SignaturePadView signature = new SignaturePadView();

            signature.StrokeColor = UIColor.Green;
            Assert.That(signature.StrokeColor == UIColor.Green);
        }
Esempio n. 9
0
        public void PositiveScaleReturnsImage()
        {
            SignaturePadView signature = new SignaturePadView(new RectangleF(0, 0, 50, 100));
            UIImage          image     = signature.GetImage(2f);

            Assert.That(image != null);
        }
Esempio n. 10
0
        public void NegativeHeightReturnsNullImage()
        {
            SignaturePadView signature = new SignaturePadView(new RectangleF(0, 0, 50, 100));
            UIImage          image     = signature.GetImage(new SizeF(25, -50));

            Assert.That(image == null);
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        public SignaturePage()
        {
            ToolbarItem saveToolbarItem = new ToolbarItem();

            saveToolbarItem.Text     = "Save";
            saveToolbarItem.Clicked += SaveToolbarItem_Clicked;
            ToolbarItems.Add(saveToolbarItem);

            //Form Header Label
            Label formTitle = new Label();

            formTitle.Text     = "Signature";
            formTitle.FontSize = 30;
            //formTitle.BackgroundColor = Color.FromRgb(52,152,219);

            signaturePadView                 = new SignaturePadView();
            signaturePadView.StrokeWidth     = 10;
            signaturePadView.StrokeColor     = Color.Black;
            signaturePadView.BackgroundColor = Color.White;
            signaturePadView.WidthRequest    = 280;
            signaturePadView.HeightRequest   = 360;


            Content = new StackLayout
            {
                Children =
                {
                    formTitle,
                    signaturePadView
                }
            };
        }
Esempio n. 13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            this.SetContentView(Resource.Layout.SignaturePad);

            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 = this.Resolve().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;
        }
Esempio n. 14
0
        public void NullFillColorReturnsNullImage()
        {
            SignaturePadView signature = new SignaturePadView(new RectangleF(0, 0, 50, 100));
            UIImage          image     = signature.GetImage(UIColor.Black, null);

            Assert.That(image == null);
        }
Esempio n. 15
0
        public void ReturnsFalseIfPointsExist()
        {
            SignaturePadView signature = new SignaturePadView();

            signature.LoadPoints(new PointF [] { new PointF(0, 30) });
            Assert.That(!signature.IsBlank);
        }
Esempio n. 16
0
        public SampleView()
        {
            BackgroundColor = UIColor.White;

            //Create the save button
            btnSave = UIButton.FromType(UIButtonType.RoundedRect);
            btnSave.SetTitle("Save", UIControlState.Normal);

            //Create the load button
            btnLoad = UIButton.FromType(UIButtonType.RoundedRect);
            btnLoad.SetTitle("Load Last", UIControlState.Normal);
            btnLoad.TouchUpInside += (sender, e) => {
                if (points != null)
                {
                    Signature.LoadPoints(points);
                }
            };

            Frame = UIScreen.MainScreen.ApplicationFrame;

            Signature = new SignaturePadView();
            //Using different layouts for the iPhone and iPad, so setup device specific requirements here.
            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
            {
                //iPhone version simply saves the vector of points in an instance variable.
                btnSave.TouchUpInside += (sender, e) => {
                    if (Signature.IsBlank)
                    {
                        new UIAlertView("", "No signature to save.", null, "Okay", null).Show();
                    }
                    else
                    {
                        points = Signature.Points;
                        new UIAlertView("", "Vector Saved.", null, "Okay", null).Show();
                    }
                };
            }
            else
            {
                //iPad version saves the vector of points as well as retrieving the UIImage to display
                //in a UIImageView.
                btnSave.TouchUpInside += (sender, e) => {
                    //if (signature.IsBlank)
                    //	new UIAlertView ("", "No signature to save.", null, "Okay", null).Show ();
                    imageView.Image = Signature.GetImage();
                    points          = Signature.Points;
                };

                //Create the UIImageView to display a saved signature.
                imageView = new UIImageView();
                AddSubview(imageView);
            }
            TranslatesAutoresizingMaskIntoConstraints = false;

            //Add the subviews.
            AddSubview(Signature);
            AddSubview(btnSave);
            AddSubview(btnLoad);
        }
Esempio n. 17
0
        public void NullStrokeColorDoesntChange()
        {
            SignaturePadView signature = new SignaturePadView();

            signature.StrokeColor = UIColor.Green;
            signature.StrokeColor = null;
            Assert.That(signature.StrokeColor == UIColor.Green);
        }
Esempio n. 18
0
 public SignOnFormViewModel(INavigation nav, SignaturePadView sig)
 {
     Navigation   = nav;
     SignaturePad = sig;
     SignOn       = new SignOn {
         PrestartId = Settings.SelectedPrestartId
     };
 }
        public void ValidPointsArrayDoesGetLoaded()
        {
            SignaturePadView signature = new SignaturePadView();

            CGPoint [] points = new CGPoint [] { new CGPoint(0, 0), new CGPoint(10, 30), new CGPoint(50, 70) };
            signature.LoadPoints(points);
            Assert.That(signature.Points.Count() > 0);
        }
        public void EmptyPointsArrayDoesntChangeAnything()
        {
            SignaturePadView signature = new SignaturePadView();

            CGPoint [] points = new CGPoint [] { new CGPoint(0, 0), new CGPoint(10, 30), new CGPoint(50, 70) };
            signature.LoadPoints(points);
            signature.LoadPoints(new CGPoint [0]);
            Assert.That(signature.Points.Count() > 0);
        }
Esempio n. 21
0
        public void NullPointsArrayDoesntChangeAnything()
        {
            SignaturePadView signature = new SignaturePadView();

            PointF [] points = new PointF [] { new PointF(0, 0), new PointF(10, 30), new PointF(50, 70) };
            signature.LoadPoints(points);
            signature.LoadPoints(null);
            Assert.That(signature.Points.Count() > 0);
        }
Esempio n. 22
0
 async void CompleteButton_OnClicked(Object sender, EventArgs e)
 {
     if (!SignaturePadView.GetDrawPoints().Any())
     {
         await this.SignOrderPageViewModel.NoSignatureFound();
     }
     else
     {
         var result = ImageStreamToBytes(SignaturePadView.GetImage(ImageFormatType.Png));
         await this.SignOrderPageViewModel.SignatureComplete(result);
     }
 }
Esempio n. 23
0
 public SigView()
 {
     BackgroundColor = Color.DarkGray;
     Add(Label       = new UILabel {
         Font          = UIFont.BoldSystemFontOfSize(60),
         TextAlignment = UITextAlignment.Center,
         TextColor     = UIColor.White,
         Text          = "$100",
     });
     Label.SizeToFit();
     Add(SignaturePadView = new SignaturePadView());
 }
Esempio n. 24
0
 public DrvPackingSlipSignPageViewModel(IEnumerable <PackingSlip> packingSlips, SignaturePadView signatureView)
 {
     _signatureView        = signatureView;
     _packingSlips         = packingSlips.ToList();
     ClearCommand          = new Command(OnClear);
     SubmitCommand         = new AsyncDelegateCommand(OnSubmit);
     CloseCommand          = new AsyncDelegateCommand(OnClose);
     ChoosePicturesCommand = new AsyncDelegateCommand(OnChoosePicture);
     DeletePictureCommand  = new Command <SignatureImage>(OnDeleteImage);
     PictureList           = new ObservableCollection <SignatureImage>();
     Title = string.Format(nameof(AppResources.SignatureForPackingSlips).Translate(),
                           GetFlattenedPackingSlipList(_packingSlips));
 }
Esempio n. 25
0
 public void initialiseDialog()
 {
     sign_pad = new SignaturePadView(Activity)
     {
         StrokeWidth        = 3F,
         StrokeColor        = Android.Graphics.Color.Black,
         SignatureLineColor = Android.Graphics.Color.Black,
         BackgroundColor    = Android.Graphics.Color.White
     };
     sign_pad.SignaturePrompt.Text = "✍";
     sign_pad.SignaturePrompt.SetTextColor(Android.Graphics.Color.Black);
     sign_pad.Caption.SetTextColor(Android.Graphics.Color.Black);
     sign_pad.Caption.Text = "Please Sign Here";
 }
Esempio n. 26
0
        /// <summary>
        /// Se guarda la firma
        /// Se devuelve a la vista de donde fue llamada la pantalla de firmas
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Guardar_Click(object sender, EventArgs e)
        {
            if (fragmentoRetornar != null)
            {
                //fzeledon
                SignaturePadView signature = Activity.FindViewById <SignaturePadView>(Resource.Id.signatureFrame);
                Bitmap           imagen    = signature.GetImage();
                var t = signature.BackgroundImageView;
                //guardarFirma(imagen);//Se guarda la firma

                //Se retorna a la pantalla anterior
                ((Activities.MainActivity)Activity).navegacionFragment(fragmentoRetornar);
            }
        }
Esempio n. 27
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            var completeButton = view.FindViewById <Button>(Resource.Id.buttonComplete);

            completeButton.Click += CompleteButton_Click;

            _signaturePad = this.View.FindViewById <SignaturePadView>(Resource.Id.driverSignatureView);
            _signaturePad.BackgroundColor      = AndroidGraphics.Color.Rgb(204, 207, 209);
            _signaturePad.SignaturePrompt.Text = string.Empty;
            _signaturePad.ClearLabel.TextSize  = 20.0f;
            _signaturePad.StrokeColor          = AndroidGraphics.Color.Black;
        }
Esempio n. 28
0
            public override void ViewDidLoad()
            {
                base.ViewDidLoad();

                cancel = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, (sender, e) => {
                    controller.Dismiss(true);
                });
                cancel.SetTitleTextAttributes(new UITextAttributes {
                    TextColor = UIColor.White
                }, UIControlState.Normal);
                cancel.SetBackgroundImage(Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

                save = new UIBarButtonItem("Save", UIBarButtonItemStyle.Bordered, (sender, e) => {
                    //If blank, return
                    if (signatureView.IsBlank)
                    {
                        new UIAlertView(string.Empty, "No signature!", null, "Ok").Show();
                        return;
                    }

                    if (assignmentViewModel.Signature == null)
                    {
                        assignmentViewModel.Signature = new Data.Signature {
                            AssignmentId = assignmentViewModel.SelectedAssignment.Id
                        };
                    }
                    assignmentViewModel.Signature.Image = signatureView.GetImage().ToByteArray();

                    assignmentViewModel.SaveSignatureAsync()
                    .ContinueWith(_ => {
                        BeginInvokeOnMainThread(() => controller.Dismiss(true));
                    });
                });

                save.SetTitleTextAttributes(new UITextAttributes {
                    TextColor = UIColor.White
                }, UIControlState.Normal);
                save.SetBackgroundImage(Theme.DarkBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);

                NavigationItem.LeftBarButtonItem  = cancel;
                NavigationItem.RightBarButtonItem = save;
                NavigationController.NavigationBar.SetBackgroundImage(null, UIBarMetrics.Default);

                signatureView = new SignaturePadView(View.Frame)
                {
                    AutoresizingMask = UIViewAutoresizing.All,
                };
                View.AddSubview(signatureView);
            }
Esempio n. 29
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            GunmetalTheme.Apply();

            var signature = new SignaturePadView()
            {
                StrokeWidth = 3f,
                StrokeColor = UIColor.Black
            };

            return(base.FinishedLaunching(app, options));
        }
Esempio n. 30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.AddSignatureLayout);

            var save = (Button)FindViewById(Resource.Id.signatureSaveButton);

            save.Click += (sender, e) => {
                if (signatureView.IsBlank)
                {
                    AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                    builder
                    .SetTitle(string.Empty)
                    .SetMessage("No signature!")
                    .SetPositiveButton("Ok", (innerSender, innere) => { })
                    .Show();
                    return;
                }
                if (assignmentViewModel.Signature == null)
                {
                    assignmentViewModel.Signature = new Signature
                    {
                        AssignmentId = Assignment.Id
                    };
                }

                assignmentViewModel.Signature.Image = signatureView.GetImage(Color.Black, Color.White).ToByteArray();
                assignmentViewModel.SaveSignatureAsync()
                .ContinueWith(_ => {
                    activity.RunOnUiThread(() => {
                        var fragment = Activity.FragmentManager.FindFragmentById <ConfirmationFragment> (Resource.Id.contentFrame);
                        fragment.ReloadConfirmation();
                        Dismiss();
                    });
                });
            };

            var cancel = (Button)FindViewById(Resource.Id.signatureCancelButton);

            cancel.Click += (sender, e) => {
                Dismiss();
            };

            signatureView = (SignaturePadView)FindViewById(Resource.Id.signatureImage);
            signatureView.BackgroundColor = Color.White;
            signatureView.StrokeColor     = Color.Black;
        }