상속: DependencyObject
 public InputScopeSample()
 {
     InitializeComponent();
     InputScope inputScope = new InputScope();
     inputScope.Names.Add(new InputScopeName { NameValue = InputScopeNameValue.TelephoneNumber });
     textBox1.InputScope = inputScope;
 }
 public static InputScope ToInputScope(this InputScopeNameValue inputScopeNameValue)
 {
     var inputScope = new InputScope();
     var inputScopeName = new InputScopeName { NameValue = inputScopeNameValue };
     inputScope.Names.Add(inputScopeName);
     return inputScope;
 }
예제 #3
0
        private void Use_Zip_Code(object sender, System.Windows.RoutedEventArgs e)
        {
            TextBox textBox = new TextBox();
            // restrict input to digits:
            InputScope inputScope = new InputScope();
            InputScopeName inputScopeName = new InputScopeName();
            inputScopeName.NameValue = InputScopeNameValue.Digits;
            inputScope.Names.Add(inputScopeName);
            textBox.InputScope = inputScope;

            CustomMessageBox messageBox = new CustomMessageBox()
            {
                Message = "Enter your US zip code:",
                LeftButtonContent = "okay",
                RightButtonContent = "cancel",
                Content = textBox
            };
            messageBox.Loaded += (a, b) =>
            {
                textBox.Focus();
            };
            messageBox.Show();
            messageBox.Dismissed += (s, args) =>
            {
                if (args.Result == CustomMessageBoxResult.LeftButton)
                {
                    if (textBox.Text.Length >= 5)
                    {
                        geocodeUsingString(textBox.Text);
                    }
                }
            };
        }
예제 #4
0
        public MainPage()
        {
            InitializeComponent();

            var numericScope = new InputScope();
            var numericScopeName = new InputScopeName();
            totalbillblock.Visibility = Visibility.Collapsed;
            totaltipblock.Visibility = Visibility.Collapsed;
            totalperpersonblock.Visibility = Visibility.Collapsed;
            tipperperson.Visibility = Visibility.Collapsed;
            //taxpercentlbl.Visibility = Visibility.Collapsed;
            //taxtextbox.Visibility = Visibility.Collapsed;
            taxtextbox.IsEnabled = false;
            numericScopeName.NameValue = InputScopeNameValue.Number;
            numericScope.Names.Add(numericScopeName);
            billbox.InputScope = numericScope;
            billbox.Text = DEFAULTBILL.ToString("#.##");
            tippercentdsp.Text = DEFAULTTIPPERC.ToString();
            taxtextbox.InputScope = numericScope;
            tipvaluebox.InputScope = numericScope;
            peoplebox.InputScope = numericScope;
            taxtextbox.InputScope = numericScope;
            tippercentdsp.InputScope = numericScope;
            TipPercentBoxChange();

            initialized = true;
            tipreviewdsp.Visibility = REVIEW ? Visibility.Visible : Visibility.Collapsed;
            funphrases = new List<List<String>>();
            PopulateTierLists();
            RecalculateEverything();
        }
예제 #5
0
        public InputScopesPage()
        {
            InitializeComponent();

            Loaded += (s, e) =>
                          {
                              spInputScopes.Children.Clear();

                              int index = 0;
                              foreach (int enumValue in EnumUtils.GetValues(typeof (InputScopeNameValue)))
                              {
                                  if (enumValue >= 0)
                                  {

                                      var tb = new TextBox()
                                                       {Text = Enum.GetName(typeof (InputScopeNameValue), enumValue)};

                                      var inputScope = new InputScope();
                                      inputScope.Names.Add(new InputScopeName()
                                                               {
                                                                   NameValue =
                                                                       (InputScopeNameValue)
                                                                       Enum.Parse(typeof (InputScopeNameValue),
                                                                                  enumValue.ToString(CultureInfo.InvariantCulture)
                                                                                  , true)
                                                               });
                                      tb.InputScope = inputScope;

                                      spInputScopes.Children.Add(tb);

                                      index++;
                                  }
                              }
                          };
        }
예제 #6
0
 private void textBox_email_Tap(object sender, EventArgs e)
 {
     InputScope Keyboard = new InputScope();
     InputScopeName ScopeName = new InputScopeName();
     ScopeName.NameValue = InputScopeNameValue.EmailSmtpAddress;
     Keyboard.Names.Add(ScopeName);
     textBox_email.InputScope = Keyboard;
 }
예제 #7
0
 private void textBox_phone_Tap(object sender, EventArgs e)
 {
     InputScope Keyboard = new InputScope();
     InputScopeName ScopeName = new InputScopeName();
     ScopeName.NameValue = InputScopeNameValue.Digits;
     Keyboard.Names.Add(ScopeName);
     textBox_phone.InputScope = Keyboard;
 }
예제 #8
0
 private InputScope GetSearchInputScope()
 {
     InputScope scope = new InputScope();
     InputScopeName name = new InputScopeName();
     name.NameValue = InputScopeNameValue.Search;
     scope.Names.Add(name);
     return scope;
 }
 void MainPageLoaded(object sender, RoutedEventArgs e)
 {
     var numericScope = new InputScope();
     var numericScopeName = new InputScopeName();
     numericScopeName.NameValue = InputScopeNameValue.Number;
     numericScope.Names.Add(numericScopeName);
     numberTextBox.InputScope = numericScope;
 }
예제 #10
0
 //set the keyboard to number input mode for the servings text box
 private void setInputScope()
 {
     InputScope inputScope = new InputScope();
     InputScopeName inputScopeName = new InputScopeName();
     inputScopeName.NameValue = InputScopeNameValue.Number;
     inputScope.Names.Add(inputScopeName);
     txtServings.InputScope = inputScope;
 }
        public PersistentObjectAttributeNumeric()
        {
            SetBinding(NumberProperty, new Binding { Path = new PropertyPath("Value") });
            SetBinding(IsReadOnlyProperty, new Binding { Path = new PropertyPath("IsReadOnly") });

            InputScope = new InputScope { Names = { new InputScopeName { NameValue = InputScopeNameValue.Number } } };

            TextChanged += NumericTextBox_TextChanged;
        }
예제 #12
0
 public MainPage()
 {
     InitializeComponent();
     var numericScope = new InputScope();
     var numericScopeName = new InputScopeName();
     numericScopeName.NameValue = InputScopeNameValue.Number;
     numericScope.Names.Add(numericScopeName);
     bxGuess.InputScope = numericScope;
 }
예제 #13
0
파일: Fee.xaml.cs 프로젝트: atomicus/wpaxi
 public Fee()
 {
     InitializeComponent();
     var numericScope = new InputScope();
     var numericScopeName = new InputScopeName();
     numericScopeName.NameValue = InputScopeNameValue.Number;
     numericScope.Names.Add(numericScopeName);
     feeBox.InputScope = numericScope;
 }
 static MoneyInputTextBox()
 {
     InputScopeName name = new InputScopeName
     {
         NameValue = InputScopeNameValue.TelephoneNumber
     };
     NumberInputScope = new InputScope();
     NumberInputScope.Names.Add(name);
 }
        public MyIntTextBox()
        {
            Value = 0;
            InputScope scope = new InputScope();
            InputScopeName name = new InputScopeName();

            name.NameValue = InputScopeNameValue.Number;
            scope.Names.Add(name);

            InputScope = scope;
        }
예제 #16
0
        public FuelConsumption()
        {
            InitializeComponent();

            var numericScope = new InputScope();
            var numericScopeName = new InputScopeName();
            numericScopeName.NameValue = InputScopeNameValue.Number;
            numericScope.Names.Add(numericScopeName);
            cityBox.InputScope = numericScope;
            mixedBox.InputScope = numericScope;
            hwBox.InputScope = numericScope;
        }
예제 #17
0
        private async void Donate_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            var InSc = new System.Windows.Input.InputScope();
            InputScopeName name = new InputScopeName();

            name.NameValue = InputScopeNameValue.Number;
            InSc.Names.Add(name);
            var initialValue = (2.0f).ToString("N2");

            const string DonationItem = "Donazione libera";

            PayPal.Checkout.BuyNow purchase = new PayPal.Checkout.BuyNow("*****@*****.**") { UseSandbox = false, DisplayShipping = 1, ConfirmedShippingOnly = false, Currency = "EUR" };
            var item = new PayPal.Checkout.ItemBuilder(DonationItem)
                .Name(DonationItem)
                .Description(DonationItem)
                .ID("DON")
                .Price(float.Parse(initialValue).ToString(new NumberFormatInfo { CurrencyDecimalDigits = 2, NumberDecimalDigits = 2, CurrencyDecimalSeparator = ".", NumberDecimalSeparator = ".", NumberGroupSeparator = ",", CurrencyGroupSeparator = "," }))
                .Tax("0.00")
                //.AddMetadata("type", "Digital") //It must be included. Modify paypal account to allow this
                .Quantity(1);

            purchase.AddItem(item);


            purchase.Error += new EventHandler<PayPal.Checkout.Event.ErrorEventArgs>((source, eventArg) =>
            {
                new MessagePrompt { IsCancelVisible = false, Title = "SimInfo", Message = string.Format(AppResources.DonateError, eventArg.Message) }.Show();
                SystemTray.SetProgressIndicator(this, new ProgressIndicator() { Text = "", IsIndeterminate = true, IsVisible = false });
            });
            purchase.Complete += new EventHandler<PayPal.Checkout.Event.CompleteEventArgs>((source, eventArg) =>
            {
                new MessagePrompt { IsCancelVisible = false, Title = "SimInfo", Message = AppResources.DonateSuccess }.Show();
                SystemTray.SetProgressIndicator(this, new ProgressIndicator() { Text = "", IsIndeterminate = true, IsVisible = false });
            });
            purchase.Cancel += new EventHandler<PayPal.Checkout.Event.CancelEventArgs>((source, eventArg) =>
            {
                new MessagePrompt { IsCancelVisible = false, Title = "SimInfo", Message = AppResources.DonateCancel }.Show();
                SystemTray.SetProgressIndicator(this, new ProgressIndicator() { Text = "", IsIndeterminate = true, IsVisible = false });
            });
            purchase.Start += new EventHandler<PayPal.Checkout.Event.StartEventArgs>((source, eventArg) =>
            {
                SystemTray.SetProgressIndicator(this, new ProgressIndicator() { Text = AppResources.PaypalLoading, IsIndeterminate = true, IsVisible = true });

            });
            purchase.Auth += new EventHandler<PayPal.Checkout.Event.AuthEventArgs>((source, eventArg) =>
            {
                SystemTray.SetProgressIndicator(this, new ProgressIndicator() { Text = string.Format(AppResources.PayPalAuth, eventArg.Token), IsIndeterminate = true, IsVisible = false });
            });

            bool res = await purchase.Execute();

        }
        protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                var control = (PhoneTextBox) Control.Children[0];
                InputScope inputScope = new InputScope();
                InputScopeName inputScopeName = new InputScopeName();

                inputScopeName.NameValue = InputScopeNameValue.TelephoneNumber;
                inputScope.Names.Add(inputScopeName);
                control.InputScope = inputScope;
            }
        }
예제 #19
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string newText;
           
            if (NavigationContext.QueryString.TryGetValue("cantidadPersonas", out newText))
            {
                cantPersonas = Convert.ToInt32(newText);
            }
            if (NavigationContext.QueryString.TryGetValue("valorTotal", out newText))
            {
                valorTotal = Convert.ToInt32(newText);   
            }
            if (NavigationContext.QueryString.TryGetValue("valorVuelto", out newText))
            {
                valorVuelto = Convert.ToInt32(newText);
            }


            for (int i = 1; i != cantPersonas + 1; i++)
            {
                InputScope scope = new InputScope();
                InputScopeName name = new InputScopeName();

                name.NameValue = InputScopeNameValue.Number;
                scope.Names.Add(name);

                TextBlock texto = new TextBlock();
                texto.Text = "Ingrese lo que Pago la Persona " + i;
                TextBox txtCampo = new TextBox();
                txtCampo.Name = "Persona" + i;
                txtCampo.Text = 0+"";
                txtCampo.InputScope = scope;
                txtCampo.GotFocus += txtCampo_GotFocus;
                txtCampo.LostFocus += txtCampo_LostFocus;
                txtCampo.TextChanged += txtCampo_TextChanged;
               
                panelControl.Children.Add(texto);
                panelControl.Children.Add(txtCampo);
            }

            Button btnCalcular = new Button();
            btnCalcular.Content="Calcular";
            btnCalcular.Click+=btnCalcular_Click;
            panelControl.Children.Add(btnCalcular);
            panelControl.Children.Add(stackPanel);
            base.OnNavigatedTo(e);
        }
예제 #20
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            string newText = string.Empty;
            
            if (NavigationContext.QueryString.TryGetValue("cantidadPersonas", out newText))
            {     
                    cantPersonas = Convert.ToInt32(newText);
                    
            }
            if (NavigationContext.QueryString.TryGetValue("pagoPersonas", out newText))
            {
                valorDividido = newText;
                valorDivididoPermanente = newText;
            }
            TextBlock textoDiferencia = new TextBlock();
            textoDiferencia.Name = "diferencia";
            
            panelControl.Children.Add(textoDiferencia);
           
            for (int i = 1; i != cantPersonas+1; i++)
            {
                InputScope scope = new InputScope();
                InputScopeName name = new InputScopeName();

                name.NameValue = InputScopeNameValue.Number;
                scope.Names.Add(name);

                TextBlock texto = new TextBlock();
                texto.Text = "Persona " + i;
                TextBox txtCampo = new TextBox();
                txtCampo.Name = "Persona" + i;
                txtCampo.Text = valorDividido;
                txtCampo.InputScope = scope;
                txtCampo.LostFocus += txtCampo_LostFocus;
                txtCampo.TextChanged += txtCampo_TextChanged;


                panelControl.Children.Add(texto);
                panelControl.Children.Add(txtCampo);
            }

            base.OnNavigatedTo(e);
        }
예제 #21
0
 private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
 {
     //loading logic here
     //either custom regex or:
     InputScope scope = new InputScope();
     InputScopeName name = new InputScopeName();
     name.NameValue = InputScopeNameValue.Url;
     scope.Names.Add(name);
     txtServerAddress.InputScope = scope;
     //or in XAML for MVC:
     /*
      * <TextBox Name="txtPhoneNumber" Height="71" Width="460" >
             <TextBox.InputScope>
                 <InputScope>
                     <InputScopeName NameValue="Number" />
                 </InputScope>
         </TextBox.InputScope>
     </TextBox>
      */
 }
예제 #22
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value != null)
            {
                if (value is InputScope)
                {
                    return ((InputScope)value).Names[0];
                }
                else
                {
                    InputScopeNameValue enumValue = (InputScopeNameValue)Enum.Parse(typeof(InputScopeNameValue), value.ToString(), true);
                    InputScope scope = new InputScope();
                    scope.Names.Add(new InputScopeName()
                    {
                        NameValue = enumValue
                    });
                    return scope;
                }
            }

            return DependencyProperty.UnsetValue;
        }
        public CreateExercisePage()
        {
            InitializeComponent();

            InputScope inputScope = new InputScope()
            {
                Names = { new InputScopeName() { NameValue = InputScopeNameValue.Number } }
            };

            time.InputScope = inputScope;
            resistance.InputScope = inputScope;
            sets.InputScope = inputScope;
            reps.InputScope = inputScope;
            weight.InputScope = inputScope;

            foreach (UIElement element in IconsPanel.Children)
            {
                Button button = (Button)element;
                Image image = (Image)button.Content;
                BitmapImage bitmapImage = new BitmapImage(new Uri(button.Tag.ToString(), UriKind.Relative));
                image.Source = bitmapImage;
            }
        }
예제 #24
0
 public MainPage()
 {
     InitializeComponent();
      var numericScope = new InputScope();
      var numericScopeName = new InputScopeName();
      totalbillblock.Visibility = Visibility.Collapsed;
      totaltipblock.Visibility = Visibility.Collapsed;
      totalperpersonblock.Visibility = Visibility.Collapsed;
      tipperperson.Visibility = Visibility.Collapsed;
      //taxpercentlbl.Visibility = Visibility.Collapsed;
      //taxtextbox.Visibility = Visibility.Collapsed;
      taxtextbox.IsEnabled = false;
      numericScopeName.NameValue = InputScopeNameValue.Number;
      numericScope.Names.Add(numericScopeName);
      billbox.InputScope = numericScope;
      billbox.Text = DEFAULTBILL.ToString("#.##");
      taxbox.InputScope = numericScope;
      tipBox.InputScope = numericScope;
      peoplebox.InputScope = numericScope;
      taxtextbox.InputScope = numericScope;
      initialized = true;
      RecalculateEverything();
 }
예제 #25
0
파일: InputScopeTest.cs 프로젝트: dfr0/moon
		public void InDesign ()
		{
			InputScope i = null;
			InputScopeName isn = null;

			DesignerProperties.SetIsInDesignMode (Application.Current.RootVisual, true);
			try {
				// creation time limitation only
				i = new InputScope ();
				isn = new InputScopeName (InputScopeNameValue.AddressCity);
			}
			finally {
				DesignerProperties.SetIsInDesignMode (Application.Current.RootVisual, false);
			}

			Assert.AreEqual (0, i.Names.Count, "Count");
			Assert.IsFalse (i.Names.IsFixedSize, "IsFixedSize");
			Assert.IsFalse (i.Names.IsReadOnly, "IsReadOnly");
			Assert.IsInstanceOfType<List<InputScopeName>> (i.Names, "type");

			i.Names.Add (isn);
			Assert.AreEqual (1, i.Names.Count, "1");
		}
예제 #26
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            NavigationService.RemoveBackEntry();

            InputScope scope = new InputScope();
            InputScopeName scopeName = new InputScopeName();
            scopeName.NameValue = InputScopeNameValue.Chat;
            scope.Names.Add(scopeName);
            tbText.InputScope = scope;

            if (!Session.hasUsernameAndPassword())
            {
                var settings = IsolatedStorageSettings.ApplicationSettings;
                try
                {
                    String u = settings[Constants.KEY_USERNAME].ToString();
                    String p = settings[Constants.KEY_PASSWORD].ToString();
                    Session.username = u;
                    Session.password = p;
                    if (u == string.Empty || p == string.Empty)
                    {
                        navigateToLoginPage();
                    }
                }
                catch (KeyNotFoundException)
                {
                    navigateToLoginPage();
                }
            }
        }
        private InputScope CreateInputScope(InputScopeNameValue value)
        {
            var s = new InputScope
                        {
                            Names =
                                {
                                    new InputScopeName() { NameValue = value }
                                }
                        };

            return s;
        }
예제 #28
0
파일: TextStore.cs 프로젝트: mind0n/hive
        private void PrepareAttributes(InputScope inputScope, double fontSize, FontFamily fontFamily, XmlLanguage language, Visual visual, int count, Guid[] filterAttributes)
        {
            if (_preparedattributes == null)
            {
                _preparedattributes = new ArrayList(count);
            }
            else
            {
                _preparedattributes.Clear();
            }

            int i;
            for (i = 0; i < _supportingattributes.Length; i++)
            {
                if (count != 0)
                {
                    int j;
                    bool found = false;
                    for (j = 0; j < count; j++)
                    {
                        if (_supportingattributes[i].Guid.Equals(filterAttributes[j]))
                            found = true;
                    }

                    if (!found)
                        continue;
                }

                UnsafeNativeMethods.TS_ATTRVAL attrval = new UnsafeNativeMethods.TS_ATTRVAL();
                attrval.attributeId = _supportingattributes[i].Guid;
                attrval.overlappedId = (int)_supportingattributes[i].Style;
                attrval.val = new NativeMethods.VARIANT();

                // This VARIANT is returned to the caller, which supposed to call VariantClear().
                // GC does not have to clear it.
                attrval.val.SuppressFinalize();

                switch (_supportingattributes[i].Style)
                {
                    case AttributeStyle.InputScope:
                        object obj = new InputScopeAttribute(inputScope);
                        attrval.val.vt = (short)NativeMethods.tagVT.VT_UNKNOWN;
                        attrval.val.data1.Value = Marshal.GetIUnknownForObject(obj);
                        break;

                    case AttributeStyle.Font_Style_Height:
                        // We always evaluate the font size and returns a value.
                        attrval.val.vt = (short)NativeMethods.tagVT.VT_I4;
                        attrval.val.data1.Value = (IntPtr)(int)fontSize;
                        break;

                    case AttributeStyle.Font_FaceName:
                        {
                            string familyName = GetFontFamilyName(fontFamily, language);
                            if (familyName != null)
                            {
                                attrval.val.vt = (short)NativeMethods.tagVT.VT_BSTR;
                                attrval.val.data1.Value = Marshal.StringToBSTR(familyName);
                            }
                        }
                        break;

                    case AttributeStyle.Font_SizePts:
                        attrval.val.vt = (short)NativeMethods.tagVT.VT_I4;
                        attrval.val.data1.Value = (IntPtr)(int)(fontSize / 96.0 * 72.0);
                        break;

                    case AttributeStyle.Text_ReadOnly:
                        attrval.val.vt = (short)NativeMethods.tagVT.VT_BOOL;
                        attrval.val.data1.Value = IsReadOnly ? (IntPtr)1 : (IntPtr)0;
                        break;

                    case AttributeStyle.Text_Orientation:
                        attrval.val.vt = (short)NativeMethods.tagVT.VT_I4;
                        attrval.val.data1.Value = (IntPtr)0;

                        // Get the transformation that is relative from source.
                        PresentationSource source = null;

                        source = PresentationSource.CriticalFromVisual((Visual)RenderScope);
                        if (source != null)
                        {
                            Visual root = source.RootVisual;
                            if ((root !=  null) && (visual != null))
                            {
                                //
                                // Calc radian from Matirix. This is approximate calculation from the first row.
                                // If tf.M12 is 0, angle will be 0. So we don't have to calc it.
                                //
                                GeneralTransform transform = visual.TransformToAncestor(root);
                                Transform t = transform.AffineTransform;
                                // 
                                if (t != null)
                                {
                                    Matrix tf = t.Value;
                                    if ((tf.M11 != 0) || (tf.M12 != 0))
                                    {
                                        double radSin = Math.Asin(tf.M12 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
                                        double radCos = Math.Acos(tf.M11 / Math.Sqrt((tf.M11 * tf.M11) + (tf.M12 * tf.M12)));
                                        // double angleSin = Math.Round((radSin * 180) / Math.PI, 0);
                                        double angleCos = Math.Round((radCos * 180) / Math.PI, 0);
                                        double angle;

                                        // determine angle from the sign of radSin;
                                        if (radSin <= 0)
                                            angle = angleCos;
                                        else
                                            angle = 360 - angleCos;

                                        attrval.val.data1.Value = (IntPtr)((int)angle * 10);
                                    }
                                }
                            }
                        }
                        break;

                    case AttributeStyle.Text_VerticalWriting:
                        //
                        // 


                        attrval.val.vt = (short)NativeMethods.tagVT.VT_BOOL;
                        attrval.val.data1.Value = (IntPtr)0;
                        break;
                }

                _preparedattributes.Add(attrval);
            }
        }
예제 #29
0
        //-----------------------------------------------------
        //
        //  Constructors
        // 
        //-----------------------------------------------------
 
        #region Constructors 

        // Creates a new InputScopeAttribute instance. 
        internal InputScopeAttribute(InputScope inputscope)
        {
            _inputScope= inputscope;
 
        }
예제 #30
0
        private async void Donate_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            var            InSc = new System.Windows.Input.InputScope();
            InputScopeName name = new InputScopeName();

            name.NameValue = InputScopeNameValue.Number;
            InSc.Names.Add(name);
            var initialValue = (2.0f).ToString("N2");

            const string DonationItem = "Donazione libera";

            PayPal.Checkout.BuyNow purchase = new PayPal.Checkout.BuyNow("*****@*****.**")
            {
                UseSandbox = false, DisplayShipping = 1, ConfirmedShippingOnly = false, Currency = "EUR"
            };
            var item = new PayPal.Checkout.ItemBuilder(DonationItem)
                       .Name(DonationItem)
                       .Description(DonationItem)
                       .ID("DON")
                       .Price(float.Parse(initialValue).ToString(new NumberFormatInfo {
                CurrencyDecimalDigits = 2, NumberDecimalDigits = 2, CurrencyDecimalSeparator = ".", NumberDecimalSeparator = ".", NumberGroupSeparator = ",", CurrencyGroupSeparator = ","
            }))
                       .Tax("0.00")
                       //.AddMetadata("type", "Digital") //It must be included. Modify paypal account to allow this
                       .Quantity(1);

            purchase.AddItem(item);


            purchase.Error += new EventHandler <PayPal.Checkout.Event.ErrorEventArgs>((source, eventArg) =>
            {
                new MessagePrompt {
                    IsCancelVisible = false, Title = "SimInfo", Message = string.Format(AppResources.DonateError, eventArg.Message)
                }.Show();
                SystemTray.SetProgressIndicator(this, new ProgressIndicator()
                {
                    Text = "", IsIndeterminate = true, IsVisible = false
                });
            });
            purchase.Complete += new EventHandler <PayPal.Checkout.Event.CompleteEventArgs>((source, eventArg) =>
            {
                new MessagePrompt {
                    IsCancelVisible = false, Title = "SimInfo", Message = AppResources.DonateSuccess
                }.Show();
                SystemTray.SetProgressIndicator(this, new ProgressIndicator()
                {
                    Text = "", IsIndeterminate = true, IsVisible = false
                });
            });
            purchase.Cancel += new EventHandler <PayPal.Checkout.Event.CancelEventArgs>((source, eventArg) =>
            {
                new MessagePrompt {
                    IsCancelVisible = false, Title = "SimInfo", Message = AppResources.DonateCancel
                }.Show();
                SystemTray.SetProgressIndicator(this, new ProgressIndicator()
                {
                    Text = "", IsIndeterminate = true, IsVisible = false
                });
            });
            purchase.Start += new EventHandler <PayPal.Checkout.Event.StartEventArgs>((source, eventArg) =>
            {
                SystemTray.SetProgressIndicator(this, new ProgressIndicator()
                {
                    Text = AppResources.PaypalLoading, IsIndeterminate = true, IsVisible = true
                });
            });
            purchase.Auth += new EventHandler <PayPal.Checkout.Event.AuthEventArgs>((source, eventArg) =>
            {
                SystemTray.SetProgressIndicator(this, new ProgressIndicator()
                {
                    Text = string.Format(AppResources.PayPalAuth, eventArg.Token), IsIndeterminate = true, IsVisible = false
                });
            });

            bool res = await purchase.Execute();
        }
 private InputScope GetTextInputScope()
 {
     InputScope scope = new InputScope();
     InputScopeName name = new InputScopeName();
     name.NameValue = InputScopeNameValue.Text;
     scope.Names.Add(name);
     return scope;
 }