void DrawRoute(DirectionsRoute route) { Java.Util.ArrayList points = new Java.Util.ArrayList(); IList <Com.Mapbox.Geojson.Point> coords = LineString.FromPolyline(route.Geometry(), Constants.Precision6).Coordinates(); foreach (Com.Mapbox.Geojson.Point point in coords) { points.Add(new LatLng(point.Latitude(), point.Longitude())); } if (points.IsEmpty == false) { if (polyline != null) { mapboxMap.RemovePolyline(polyline); } // Draw polyline on map polyline = mapboxMap .AddPolyline(new PolylineOptions() .AddAll(points) .InvokeColor(Color.ParseColor("#4264fb")) .InvokeWidth(5)); } }
public async Task <bool> SetMatch(string luogo, int data, string ora, IList <string> giocatori) { try { Java.Util.ArrayList nuovo = new Java.Util.ArrayList(); foreach (var g in giocatori) { nuovo.Add(g); } var docRef = Firebase.Firestore.FirebaseFirestore.Instance.Collection("partite").Document(); Dictionary <string, Java.Lang.Object> map = new Dictionary <string, Java.Lang.Object>(); map.Add("risultato", docRef.Id); map.Add("luogo", luogo); map.Add("data", data); map.Add("ora", ora); map.Add("giocatori", nuovo); await docRef.Set(map); } catch (FirebaseFirestoreException exc) { exc.PrintStackTrace(); return(false); } catch (Exception err) { Console.WriteLine(err.StackTrace); return(false); } return(true); }
private Java.Util.ArrayList getDataPage(int pageSize) { Java.Util.ArrayList page = new Java.Util.ArrayList(); for (int i = 0; i < pageSize; i++) { page.Add("Item " + (((MyListViewAdapter)listView.GetAdapter()).ItemCount + i)); } return page; }
private Java.Util.ArrayList getDataPage(int pageSize) { Java.Util.ArrayList page = new Java.Util.ArrayList(); for (int i = 0; i < pageSize; i++) { page.Add("Item " + source.Count); } return page; }
private Java.Util.ArrayList getDataPage(int pageSize) { Java.Util.ArrayList page = new Java.Util.ArrayList(); for (int i = 0; i < pageSize; i++) { page.Add("Item " + source.Count); } return(page); }
private Java.Util.ArrayList getDataPage(int pageSize) { Java.Util.ArrayList page = new Java.Util.ArrayList(); int sourceSize = listView.GetAdapter ().ItemCount; for (int i = 0; i < pageSize; i++) { page.Add("Item " + (sourceSize + i)); } return page; }
private void InitChartData() { monthResults = new Java.Util.ArrayList(); if (Settings.TotalPaid > 0) { this.IsGreen = true; monthResults.Add(new MonthResult("Paid", double.Parse(Settings.TotalPaid.ToString()))); } if (Settings.TotalOutstanding > 0) { this.IsBlue = true; monthResults.Add(new MonthResult("Remaining", double.Parse(Settings.TotalOutstanding.ToString()))); } if (Settings.TotalOverDue > 0) { this.IsRed = true; monthResults.Add(new MonthResult("Overdue", double.Parse(Settings.TotalOverDue.ToString()))); } }
/// <summary> /// Converts the coordinates. /// </summary> /// <returns>The coordinates.</returns> /// <param name="coordinates">Coordinates list.</param> private static Java.Util.ArrayList ConvertCoordinates(List <Position> coordinates) { var coords = new Java.Util.ArrayList(); foreach (var pos in coordinates) { coords.Add(new LatLng(pos.Latitude, pos.Longitude)); } return(coords); }
public void CopyTo() { using (var al = new Java.Util.ArrayList()) { al.Add(1); al.Add(2); al.Add(3); using (var c = new JavaCollection(al.Handle, JniHandleOwnership.DoNotTransfer)) { var to = new int[3]; c.CopyTo(to, 0); Assert.IsTrue(new[] { 1, 2, 3 }.SequenceEqual(to)); } using (var c = new JavaCollection <int> (al.Handle, JniHandleOwnership.DoNotTransfer)) { var to = new int[3]; c.CopyTo(to, 0); Assert.IsTrue(new[] { 1, 2, 3 }.SequenceEqual(to)); } } }
private Java.Util.ArrayList getDataPage(int pageSize) { Java.Util.ArrayList page = new Java.Util.ArrayList(); int sourceSize = listView.GetAdapter().ItemCount; for (int i = 0; i < pageSize; i++) { page.Add("Item " + (sourceSize + i)); } return(page); }
static Java.Util.ArrayList CreateList(params int[][] items) { var list = new Java.Util.ArrayList(); foreach (int[] values in items) { using (var v = new Java.Lang.Object( JNIEnv.NewArray(values), JniHandleOwnership.TransferLocalRef)) list.Add(v); } return(list); }
public static Java.Util.IList ToJavaList <T>(this System.Collections.Generic.IList <System.Collections.Generic.IList <System.Collections.Generic.IList <T> > > list) { if (list == null) { return(null); } var result = new Java.Util.ArrayList(list.Count); for (int i = 0; i < list.Count; i++) { result.Add((Java.Lang.Object)list[i].ToJavaList()); } return(result); }
public void OnClick(IDialogInterface dialog, int which) { Java.Util.ArrayList selectedTrackKeys = new Java.Util.ArrayList(); for (int i = 0; i < representationList.ChildCount; i++) { if (representationList.IsItemChecked(i)) { selectedTrackKeys.Add(trackKeys[i]); } } if (!selectedTrackKeys.IsEmpty || trackKeys.Count == 0) { // We have selected keys, or we're dealing with single stream content. DownloadAction downloadAction = downloadHelper.GetDownloadAction(Utils.GetUtf8Bytes(name), selectedTrackKeys); downloadTracker.StartDownload(downloadAction); } }
public static Java.Util.IList ToJavaList <T>(this System.Collections.Generic.IList <T> list) { if (list == null) { return(null); } var result = new Java.Util.ArrayList(list.Count); for (int i = 0; i < list.Count; i++) { var item = list[i] as Java.Lang.Object; if (item == null) { continue; } result.Add(item); } return(result); }
/// <summary> /// Converts the coordinates. /// </summary> /// <returns>The coordinates.</returns> /// <param name="coordinates">Coordinates list.</param> private static Java.Util.ArrayList ConvertCoordinates(List<Position> coordinates) { var coords = new Java.Util.ArrayList(); foreach (var pos in coordinates) { coords.Add(new LatLng(pos.Latitude, pos.Longitude)); } return coords; }
public void testSimple1() { var list = new Java.Util.ArrayList<string>(); list.Add("Hello world"); }
public MainPage() { InitializeComponent(); #if __IOS__ // UI FOR XAMARIN iOS native controls RootGrid.Padding = new Thickness(0, 20, 0, 0); var explanation1 = new UILabel { MinimumFontSize = 14f, Lines = 0, LineBreakMode = UILineBreakMode.WordWrap, Text = "This is the native iOS TKChart", }; HeaderGrid.Children.Add(explanation1); // Chart TKChart chart = new TKChart(); chart.AllowAnimations = true; chart.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; // Sample Data Random r = new Random(); var list = Enumerable.Range(1, 12).Select(i => new TKChartDataPoint(new NSNumber(i), new NSNumber(r.Next() % 2000))).ToArray(); // Add Series TKChartLineSeries series = new TKChartLineSeries(list); series.Selection = TKChartSeriesSelection.Series; chart.AddSeries(series); BodyGrid.Children.Add(chart); #endif #if __ANDROID__ // UI FOR XAMARIN Android native controls HeaderGrid.Children.Add(new TextView(Forms.Context) { Text = "This is the native Android RadCartesianChartView", TextSize = 14 }); RadCartesianChartView chartView = new RadCartesianChartView(Forms.Context); chartView.HorizontalAxis = new CategoricalAxis(); chartView.VerticalAxis = new LinearAxis(); // Sample Data var monthResults = new Java.Util.ArrayList(); monthResults.Add(new MonthResult("Jan", 12)); monthResults.Add(new MonthResult("Feb", 5)); monthResults.Add(new MonthResult("Mar", 10)); monthResults.Add(new MonthResult("Apr", 7)); chartView.Series.Add(new LineSeries { CategoryBinding = new MonthResultDataBinding("Month"), ValueBinding = new MonthResultDataBinding("Result"), Data = monthResults }); BodyGrid.Children.Add(chartView); #endif #if WINDOWS_UWP // UI FOR XAMARIN UWP native controls var explanation1 = new TextBlock { Text = "The next control is a CustomControl (a customized TextBlock with a bad ArrangeOverride implementation).", FontSize = 14, FontFamily = new FontFamily("HelveticaNeue"), TextWrapping = TextWrapping.Wrap }; HeaderGrid.Children.Add(explanation1); // Set up chart var chartView = new RadCartesianChart(); chartView.HorizontalAxis = new CategoricalAxis(); chartView.VerticalAxis = new LinearAxis(); // sample data var monthResults = new List <MonthResult> { new MonthResult("Jan", 12), new MonthResult("Feb", 5), new MonthResult("Mar", 10), new MonthResult("Apr", 7) }; chartView.Series.Add(new LineSeries { CategoryBinding = new PropertyNameDataPointBinding("Month"), ValueBinding = new PropertyNameDataPointBinding("Result"), ItemsSource = monthResults }); // Add native chart to Visual Tree BodyGrid.Children.Add(chartView); #endif }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); _listAdapter = new ArrayAdapter <string>(this, Resource.Layout.ListEntry, Resource.Id.TextView01); _listView = FindViewById <ListView> (Resource.Id.listView1); if (_listView != null) { _listView.Adapter = _listAdapter; } _spass = new Spass(); try { _spass.Initialize(this); } catch (SsdkUnsupportedException e) { Log(e.Message); return; } catch (SecurityException) { Log("Did you add the permission to the AndroidManifest.xml?"); return; } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); return; } _isFeatureEnabled = _spass.IsFeatureEnabled(Spass.DeviceFingerprint); if (_isFeatureEnabled) { _spassFingerprint = new SpassFingerprint(this); Log("Fingerprint Service is supported in the device."); Log("SDK version : " + _spass.VersionName); } else { LogClear(); Log("Fingerprint Service is not supported in the device."); return; } FindViewById(Resource.Id.buttonHasRegisteredFinger).Click += (sender, e) => { LogClear(); try { var hasRegisteredFinger = _spassFingerprint.HasRegisteredFinger; Log("HasRegisteredFinger = " + hasRegisteredFinger); } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonIdentify).Click += (sender, e) => { LogClear(); try { if (!_spassFingerprint.HasRegisteredFinger) { Log("Please register finger first"); } else { if (!_onReadyIdentify) { try { _onReadyIdentify = true; _spassFingerprint.StartIdentify(new IdentifyListener(_spassFingerprint, Log, () => _onReadyIdentify = false)); Log("Please identify finger to verify you"); } catch (SpassInvalidStateException m) { _onReadyIdentify = false; if (m.Type == SpassInvalidStateException.StatusOperationDenied) { Log("Exception: " + m.Message); } } catch (IllegalStateException ex) { _onReadyIdentify = false; Log("Exception: " + ex); } } else { Log("Please cancel Identify first"); } } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonShowIdentifyDialogWithPW).Click += (sender, e) => { LogClear(); try { if (!_spassFingerprint.HasRegisteredFinger) { Log("Please register finger first"); } else { if (!_onReadyIdentify) { try { _onReadyIdentify = true; _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint, Log, () => _onReadyIdentify = false), true); Log("Please identify finger to verify you"); } catch (SpassInvalidStateException m) { _onReadyIdentify = false; if (m.Type == SpassInvalidStateException.StatusOperationDenied) { Log("Exception: " + m.Message); } } catch (IllegalStateException ex) { _onReadyIdentify = false; Log("Exception: " + ex); } } else { Log("Please cancel Identify first"); } } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonShowIdentifyDialogWithoutPW).Click += (sender, e) => { LogClear(); try { if (!_spassFingerprint.HasRegisteredFinger) { Log("Please register finger first"); } else { if (!_onReadyIdentify) { try { _onReadyIdentify = true; _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint, Log, () => _onReadyIdentify = false), false); Log("Please identify finger to verify you"); } catch (SpassInvalidStateException m) { _onReadyIdentify = false; if (m.Type == SpassInvalidStateException.StatusOperationDenied) { Log("Exception: " + m.Message); } } catch (IllegalStateException ex) { _onReadyIdentify = false; Log("Exception: " + ex); } } else { Log("Please cancel Identify first"); } } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonCancel).Click += (sender, e) => { LogClear(); try { if (_onReadyIdentify) { try { _spassFingerprint.CancelIdentify(); Log("cancelIdentify is called"); } catch (IllegalStateException ise) { Log(ise.Message); } _onReadyIdentify = false; } else { Log("Please request Identify first"); } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonRegisterFinger).Click += (sender, e) => { LogClear(); try { if (!_onReadyIdentify) { if (!_onReadyEnroll) { _onReadyEnroll = true; _spassFingerprint.RegisteredFinger(this, new RegisterListener(Log, () => _onReadyEnroll = false)); Log("Jump to the Enroll screen"); } else { Log("Please wait and try to register again"); } } else { Log("Please cancel Identify first"); } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonGetRegisteredFingerprintName).Click += (sender, e) => { LogClear(); try { Log("=Fingerprint Name="); var registeredFingerprintNames = _spassFingerprint.RegisteredFingerprintUniqueId; if (registeredFingerprintNames == null) { Log("Registered fingerprints do not exist on this device"); } else { int i = 0; foreach (var registeredFingerprintName in registeredFingerprintNames) { Log("Index " + i + ", Name is " + registeredFingerprintName); i++; } } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonGetRegisteredFingerprintID).Click += (sender, e) => { LogClear(); try { if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintUniqueId)) { try { Log("=Fingerprint Unique ID="); var registeredFingerprintIds = _spassFingerprint.RegisteredFingerprintUniqueId; if (registeredFingerprintIds == null) { Log("Registered fingerprints do not exist on this device"); } else { int i = 0; foreach (var registedFingerprintId in registeredFingerprintIds) { Log("Index " + i + ", Unique ID is " + registedFingerprintId); i++; } } } catch (IllegalStateException ise) { Log(ise.Message); } } else { Log("To get Fingerprint ID is not supported in the device"); } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonIdentifyWithIndex).Click += (sender, e) => { LogClear(); try { if (!_spassFingerprint.HasRegisteredFinger) { Log("Please register finger first"); } else { if (!_onReadyIdentify) { try { _onReadyIdentify = true; if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintFingerIndex)) { var designatedFingers = new Java.Util.ArrayList(); designatedFingers.Add(1); _spassFingerprint.SetIntendedFingerprintIndex(designatedFingers); } _spassFingerprint.StartIdentify(new IdentifyListener(_spassFingerprint, Log, () => _onReadyIdentify = false)); Log("Please identify fingerprint index 1 to verify you"); } catch (SpassInvalidStateException ise) { _onReadyIdentify = false; if (ise.Type == SpassInvalidStateException.StatusOperationDenied) { Log("Exception: " + ise.Message); } } catch (IllegalStateException ex) { _onReadyIdentify = false; Log("Exception: " + ex); } } else { Log("Please cancel Identify first"); } } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonShowIdentifyDialogWithIndex).Click += (sender, e) => { LogClear(); try { if (!_spassFingerprint.HasRegisteredFinger) { Log("Please register finger first"); } else { if (!_onReadyIdentify) { try { _onReadyIdentify = true; if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintFingerIndex)) { var designatedFingers = new Java.Util.ArrayList(); designatedFingers.Add(2); designatedFingers.Add(3); _spassFingerprint.SetIntendedFingerprintIndex(designatedFingers); } _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint, Log, () => _onReadyIdentify = false), false); Log("Please identify fingerprint index 2 or 3 to verify you"); } catch (SpassInvalidStateException ise) { _onReadyIdentify = false; if (ise.Type == SpassInvalidStateException.StatusOperationDenied) { Log("Exception: " + ise.Message); } } catch (IllegalStateException ex) { _onReadyIdentify = false; Log("Exception: " + ex); } } else { Log("Please cancel Identify first"); } } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonShowIdentifyDialogWithTitleNLogo).Click += (sender, e) => { LogClear(); try { if (!_spassFingerprint.HasRegisteredFinger) { Log("Please register finger first"); } else { if (!_onReadyIdentify) { _onReadyIdentify = true; if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintCustomizedDialog)) { try { _spassFingerprint.SetDialogTitle("Customized Dialog With Logo", 0x000000); _spassFingerprint.SetDialogIcon("Icon"); } catch (IllegalStateException ise) { Log(ise.Message); } } try { _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint, Log, () => _onReadyIdentify = false), false); Log("Please Identify fingerprint to verify you"); } catch (IllegalStateException ex) { _onReadyIdentify = false; Log("Exception: " + ex); } } else { Log("Please cancel Identify first"); } } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonCustomizedDialogWithTransparency).Click += (sender, e) => { LogClear(); try { if (!_spassFingerprint.HasRegisteredFinger) { Log("Please register finger first"); } else { if (!_onReadyIdentify) { _onReadyIdentify = true; if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintCustomizedDialog)) { try { _spassFingerprint.SetDialogTitle("Customized Dialog With Transparency", 0x000000); _spassFingerprint.SetDialogBgTransparency(0); } catch (IllegalStateException ise) { Log(ise.Message); } } try { _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint, Log, () => _onReadyIdentify = false), false); Log("Please Identify fingerprint to verify you"); } catch (IllegalStateException ex) { _onReadyIdentify = false; Log("Exception: " + ex); } } else { Log("Please cancel Identify first"); } } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; FindViewById(Resource.Id.buttonCustomizedDialogWithSetDialogDismiss).Click += (sender, e) => { LogClear(); try { if (!_spassFingerprint.HasRegisteredFinger) { Log("Please register finger first"); } else { if (!_onReadyIdentify) { _onReadyIdentify = true; if (_spass.IsFeatureEnabled(Spass.DeviceFingerprintCustomizedDialog)) { try { _spassFingerprint.SetDialogTitle("Customized Dialog With Setting Dialog dismiss", 0x000000); _spassFingerprint.SetCanceledOnTouchOutside(true); } catch (IllegalStateException ise) { Log(ise.Message); } } try { _spassFingerprint.StartIdentifyWithDialog(this, new IdentifyListener(_spassFingerprint, Log, () => _onReadyIdentify = false), false); Log("Please Identify fingerprint to verify you"); } catch (IllegalStateException ex) { _onReadyIdentify = false; Log("Exception: " + ex); } } else { Log("Please cancel Identify first"); } } } catch (UnsupportedOperationException) { Log("Fingerprint Service is not supported in the device"); } }; }