当前位置: 首页>>代码示例>>C#>>正文


C# Java.JavaCast方法代码示例

本文整理汇总了C#中Java.JavaCast方法的典型用法代码示例。如果您正苦于以下问题:C# Java.JavaCast方法的具体用法?C# Java.JavaCast怎么用?C# Java.JavaCast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Java的用法示例。


在下文中一共展示了Java.JavaCast方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnLoadFinished

		public void OnLoadFinished (Loader loader, Java.Lang.Object data)
		{
			var cursor = data.JavaCast<ICursor> ();

			TextView tv = ((Activity) mContext).FindViewById <TextView> (Resource.Id.sample_output);

			// Reset text in case of a previous query
			tv.Text = mContext.GetText (Resource.String.intro_message) + "\n\n";

			if (cursor.Count == 0) {
				return;
			}

			// Pulling the relevant value from the cursor requires knowing the column index to pull
			// it from.

			int phoneColumnIndex =  cursor.GetColumnIndex (ContactsContract.CommonDataKinds.Phone.Number);
			int emailColumnIndex = cursor.GetColumnIndex (ContactsContract.CommonDataKinds.Email.Address);
			int nameColumnIndex = cursor.GetColumnIndex (ContactsContract.CommonDataKinds.Contactables.InterfaceConsts.DisplayName);
			int lookupColumnIndex = cursor.GetColumnIndex (ContactsContract.CommonDataKinds.Contactables.InterfaceConsts.LookupKey);
			int typeColumnIndex = cursor.GetColumnIndex (ContactsContract.CommonDataKinds.Contactables.InterfaceConsts.Mimetype);


			cursor.MoveToFirst ();
			// Lookup key is the easiest way to verify a row of data is for the same
			// contact as the previous row.
			String lookupKey = "";
			do {

				String currentLookupKey = cursor.GetString (lookupColumnIndex);
				if (!lookupKey.Equals (currentLookupKey)) {
					String displayName = cursor.GetString (nameColumnIndex);
					tv.Append (displayName + "\n");
					lookupKey = currentLookupKey;
				}


				// The data type can be determined using the mime type column.
				String mimeType = cursor.GetString (typeColumnIndex);
				if (mimeType.Equals (ContactsContract.CommonDataKinds.Phone.ContentItemType)) {
					tv.Append ("\tPhone Number: " + cursor.GetString (phoneColumnIndex) + "\n");
				} else if (mimeType.Equals (ContactsContract.CommonDataKinds.Email.ContentItemType)) {
					tv.Append ("\tEmail Address: " + cursor.GetString (emailColumnIndex) + "\n");
				}


				// Look at DDMS to see all the columns returned by a query to Contactables.
				// Behold, the firehose!
				foreach (String column in cursor.GetColumnNames ()) {
					  Log.Debug (TAG, column + column + ": " +
					      cursor.GetString (cursor.GetColumnIndex (column)) + "\n");
				}
			} while (cursor.MoveToNext ());
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:54,代码来源:ContactablesLoaderCallbacks.cs

示例2: OnNestedScroll

        public override void OnNestedScroll(CoordinatorLayout coordinatorLayout, Java.Lang.Object child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed)
        {
            base.OnNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);

            var floatingActionButtonChild = child.JavaCast<FloatingActionButton>();

            if (dyConsumed > 0 && floatingActionButtonChild.Visibility == ViewStates.Visible)
                floatingActionButtonChild.Hide();
            else if (dyConsumed < 0 && floatingActionButtonChild.Visibility != ViewStates.Visible)
                floatingActionButtonChild.Show();
        }
开发者ID:Ideine,项目名称:MvvmCross-AndroidSupport,代码行数:11,代码来源:ScrollAwareGrowShrinkFABBehavior.cs

示例3: OnResult

		public void OnResult (Java.Lang.Object result)
		{
			googleApiClient.Disconnect ();
			IDataApiDeleteDataItemsResult deleteDataItemsResult;
			try 
			{
				deleteDataItemsResult = result.JavaCast<IDataApiDeleteDataItemsResult>();
			}
			catch {
				return;
			}
			if (!deleteDataItemsResult.Status.IsSuccess)
				Log.Error (Tag, "DismissWearableNotification(): Failed to delete IDataItem");
		}
开发者ID:Appercode,项目名称:monodroid-samples,代码行数:14,代码来源:DismissListener.cs

示例4: Apply

			public void Apply (Java.Lang.Object calendarCell)
			{
				if (calendarCell.Class.SimpleName == "CalendarMonthCell") {
					return;
				}

				CalendarDayCell dayCell = calendarCell.JavaCast<CalendarDayCell> ();
				if (dayCell.CellType != CalendarCellType.Date) {
					return;
				}

				this.calendar.TimeInMillis = dayCell.Date;
				
				if (calendar.Get (CalendarField.DayOfWeek) == Calendar.Saturday) {
					dayCell.Selectable = false;
				} else {
					dayCell.Selectable = true;
				}
			}
开发者ID:bmccool,项目名称:Android-samples,代码行数:19,代码来源:SelectionDisabledDatesFragment.cs

示例5: OnResult

        public void OnResult(Java.Lang.Object result)
        {
            if (state == 0) {
                state = 1;
                var apiResult = result.JavaCast<INodeApiGetConnectedNodesResult> ();
                var nodes = apiResult.Nodes;
                var phoneNode = nodes.FirstOrDefault ();
                if (phoneNode == null) {
                    DisplayError ();
                    return;
                }

                WearableClass.MessageApi.SendMessage (client, phoneNode.Id,
                                                      "/bikenow/SearchNearestStations/" + ActionStatus.ToString (),
                                                      new byte[0]).SetResultCallback (this);
            } else {
                state = 0;
                var apiResult = result.JavaCast<IMessageApiSendMessageResult> ();
                Android.Util.Log.Info ("SendMessage", apiResult.RequestId.ToString ());
            }
        }
开发者ID:SpiderMaster,项目名称:BikeNow,代码行数:21,代码来源:FindNearestHubway.cs

示例6: OnResult

			public void OnResult (Java.Lang.Object result)
			{
				var ar = result.JavaCast<ILeaderboardsLoadScoresResult>();
				if (ar != null) {
					var id = ar.Leaderboard.LeaderboardId;
					if (!helper.scores.ContainsKey (id)) {
						helper.scores.Add (id, new List<ILeaderboardScore> ());
					}
					helper.scores [id].Clear ();
					var count = ar.Scores.Count;
					for (int i = 0; i < count; i++) {
						var score = ar.Scores.Get(i).JavaCast<ILeaderboardScore> ();
						helper.scores [id].Add (score);
					}
				}
			}
开发者ID:EssMarkus,项目名称:monodroid-samples,代码行数:16,代码来源:GameHelper.cs

示例7: OnResult

 public void OnResult(Java.Lang.Object result)
 {
     var dataItemResult = result.JavaCast<IDataApiDataItemResult> ();
     if (dataItemResult.Status.IsSuccess && dataItemResult.DataItem != null) {
         var configDataItem = dataItemResult.DataItem;
         var dataMapItem = DataMapItem.FromDataItem (configDataItem);
         SetupAllPickers (dataMapItem.DataMap);
     } else {
         SetupAllPickers (null);
     }
 }
开发者ID:gandersson,项目名称:android-wear-xamarin-watchface,代码行数:11,代码来源:DigitalWatchFaceCompanionConfigActivity.cs

示例8: OnResult

		//Follow the same flow as the MainActivity for the Wearable (Wearable/MainActivity has more details).
		public void OnResult (Java.Lang.Object raw)
		{
			Exception nodeException, messageException;
			try {
				var nodeResult = raw.JavaCast<INodeApiGetConnectedNodesResult> ();
				foreach (var node in nodeResult.Nodes)
					WearableClass.MessageApi.SendMessage (mGoogleApiClient, node.Id, START_ACTIVITY_PATH, new byte[0])
							.SetResultCallback (this);
				return;
			} catch (Exception e) {
				nodeException = e;
			}
			try {
				var messageResult = raw.JavaCast<IMessageApiSendMessageResult> ();
				if (!messageResult.Status.IsSuccess)
					Log.Error (TAG, "Failed to connect to Google Api Client with status "
					+ messageResult.Status);
				return;
			} catch (Exception e) {
				messageException = e;
			}
			//We should never get to this point
			Log.Wtf (TAG, "Unexpected type for OnResult");
			Log.Error (TAG, "Node Exception", nodeException);
			Log.Error (TAG, "Message Exception", messageException);
		}
开发者ID:WalterVale,项目名称:monodroid-samples,代码行数:27,代码来源:MainActivity.cs

示例9: OnSuccess

 public override void OnSuccess(Java.Lang.Object jObject)
 {
     PurchaseResult purchaseResult = jObject.JavaCast<PurchaseResult>();
     if (null == purchaseResult) {
         m_debugText = string.Format ("PurchaseResult is null!");
     } else {
         m_debugText = string.Format ("Request Purchase: OnSuccess");
         Log.Info (TAG, "OnSuccess identiifer"+purchaseResult.ProductIdentifier);
     }
 }
开发者ID:wister01,项目名称:ouya-sdk-examples,代码行数:10,代码来源:Game1.cs

示例10: OnFinished

 public void OnFinished(Kiip p0, Java.Lang.Object p1)
 {
     ME.Kiip.Api.Resource response = p1.JavaCast<ME.Kiip.Api.Resource>();
     example.toast(response.ToString());
 }
开发者ID:vkheleli,项目名称:monodroid-samples-master,代码行数:5,代码来源:ExampleActivity.cs

示例11: OnResult

        /// <summary>
        /// On Geofence Request Result
        /// </summary>
        /// <param name="result"></param>
        public void OnResult(Java.Lang.Object result)
        {
            var res = result.JavaCast<IResult>();
          
            int statusCode = res.Status.StatusCode;
            string message = string.Empty;

            switch (res.Status.StatusCode)
            {
                case Android.Gms.Location.GeofenceStatusCodes.SuccessCache:
                case Android.Gms.Location.GeofenceStatusCodes.Success:
                    if (CurrentRequestType == RequestType.Add)
                    {
                        message = string.Format("{0} - {1}", CrossGeofence.Id, "Successfully added Geofence.");
                        
                        foreach (GeofenceCircularRegion region in Regions.Values)
                        {
                            CrossGeofence.GeofenceListener.OnMonitoringStarted(region.Id);
                        }
                    }
                    else
                    {
                        message = string.Format("{0} - {1}", CrossGeofence.Id, "Geofence Update Received");
                    }
                    
                    break;
                case Android.Gms.Location.GeofenceStatusCodes.Error:
                    message = string.Format("{0} - {1}", CrossGeofence.Id, "Error adding Geofence.");
                    break;
                case Android.Gms.Location.GeofenceStatusCodes.GeofenceTooManyGeofences:
                    message = string.Format("{0} - {1}", CrossGeofence.Id, "Too many geofences.");
                    break;
                case Android.Gms.Location.GeofenceStatusCodes.GeofenceTooManyPendingIntents:
                    message = string.Format("{0} - {1}", CrossGeofence.Id, "Too many pending intents.");
                    break;
                case Android.Gms.Location.GeofenceStatusCodes.GeofenceNotAvailable:
                    message = string.Format("{0} - {1}", CrossGeofence.Id, "Geofence not available.");
                    break;
            }

            System.Diagnostics.Debug.WriteLine(message);

            if (statusCode != Android.Gms.Location.GeofenceStatusCodes.Success && statusCode != Android.Gms.Location.GeofenceStatusCodes.SuccessCache && IsMonitoring)
            {
                // Rather than force killing all running geofences, delegate action on geofence failures to the application.
                // This lets the application decide to ignore the error, perform retry logic, stop monitoring as below, or any other behavior.
                // StopMonitoringAllRegions();
                ((GeofenceImplementation)CrossGeofence.Current).LocationHasError = true;

                if (!string.IsNullOrEmpty(message))
                    CrossGeofence.GeofenceListener.OnError(message);
            }
        }
开发者ID:JPHBrivo,项目名称:xamarin-plugins,代码行数:57,代码来源:GeofenceImplementation.cs

示例12: OnDependentViewChanged

		public override bool OnDependentViewChanged (CoordinatorLayout parent, Java.Lang.Object child, View dependency)
		{
			// Move the fab vertically to place correctly wrt the info pane
			var fab = child.JavaCast<SwitchableFab> ();
			var currentInfoPaneY = ViewCompat.GetTranslationY (dependency);
			var newTransY = (int)Math.Max (0, dependency.Height - currentInfoPaneY - minMarginBottom - fab.Height / 2);
			ViewCompat.SetTranslationY (fab, -newTransY);

			// If alternating between open/closed state, change the FAB face
			if (wasOpened ^ ((InfoPane)dependency).Opened) {
				fab.Switch ();
				wasOpened = !wasOpened;
			}

			return true;
		}
开发者ID:wsenjer,项目名称:Moyeu,代码行数:16,代码来源:HubwayMapFragment.cs

示例13: OnResult

        public void OnResult(Java.Lang.Object result)
        {
            var apiResult = result.JavaCast<ICapabilityApiGetCapabilityResult> ();
            var nodes = apiResult.Capability.Nodes;
            phoneNode = nodes.FirstOrDefault ();
            if (phoneNode == null) {
                DisplayError ();
                return;
            }

            WearableClass.MessageApi.SendMessage (client, phoneNode.Id,
                                                  SearchStationPath + ActionStatus.ToString (),
                                                  new byte[0]);
        }
开发者ID:wsenjer,项目名称:Moyeu,代码行数:14,代码来源:MainActivity.cs

示例14: OnResult

 public void OnResult(Java.Lang.Object statusRaw)
 {
     var status = statusRaw.JavaCast<Statuses>();
     if (status.IsSuccess) {
         var myHandler = new Handler ();
         myHandler.Post (() => {
             Android.Widget.Toast.MakeText (this, "Geofencing Started.", Android.Widget.ToastLength.Long).Show ();
         });
     } else {
         var myHandler = new Handler ();
         myHandler.Post (() => {
             Android.Widget.Toast.MakeText (this, "Error Starting Geofencing.", Android.Widget.ToastLength.Long).Show ();
         });
     }
 }
开发者ID:jdrharding,项目名称:ROMPAndroid,代码行数:15,代码来源:CheckInPassiveActivity.cs

示例15: OnResult

 public void OnResult(Java.Lang.Object result)
 {
     var dataItemResult = result.JavaCast<IDataApiDataItemResult> ();
     if (dataItemResult.Status.IsSuccess) {
         OnResultAction (dataItemResult);
     }
 }
开发者ID:gandersson,项目名称:android-wear-xamarin-watchface,代码行数:7,代码来源:DigitalWatchFaceUtil+copy.cs


注:本文中的Java.JavaCast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。