本文整理汇总了C#中Android.App.Activity.Finish方法的典型用法代码示例。如果您正苦于以下问题:C# Activity.Finish方法的具体用法?C# Activity.Finish怎么用?C# Activity.Finish使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.Activity
的用法示例。
在下文中一共展示了Activity.Finish方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowEula
/**
* Show End User License Agreement.
*
* @param accepted True IFF user has accepted license already, which means it can be dismissed.
* If the user hasn't accepted, then the EULA must be accepted or the program
* exits.
* @param activity Activity started from.
*/
public static void ShowEula(bool accepted, Activity activity)
{
AlertDialog.Builder eula = new AlertDialog.Builder(activity)
.SetTitle(Resource.String.eula_title)
.SetIcon(Android.Resource.Drawable.IcDialogInfo)
.SetMessage(Resource.String.eula_text)
.SetCancelable(accepted);
if (accepted)
{
eula.SetPositiveButton(Android.Resource.String.Ok, (object dialog, DialogClickEventArgs which) => {
(dialog as IDialogInterface).Dismiss();
});
} else {
eula.SetPositiveButton(Resource.String.accept,(object dialog, DialogClickEventArgs which) => {
SetAcceptedEula(activity);
(dialog as IDialogInterface).Dismiss();
})
.SetNegativeButton(Resource.String.decline, (object dialog, DialogClickEventArgs which) => {
(dialog as IDialogInterface).Cancel();
activity.Finish();
});
}
eula.Show();
}
示例2: DetailActivityViewModel
public DetailActivityViewModel(Activity context, AppContext app)
{
this.EditTarget = app.Detail
.ObserveProperty(x => x.EditTarget)
.Select(x => new PersonViewModel(x))
.ToReactiveProperty();
this.SaveCommand = new ReactiveCommand();
this.SaveCommand.Subscribe(_ =>
{
app.Detail.Update();
context.Finish();
});
}
示例3: CheckPlayServices
public static bool CheckPlayServices (Activity context)
{
int result = GooglePlayServicesUtil.IsGooglePlayServicesAvailable (context);
if (result != ConnectionResult.Success)
{
if (GooglePlayServicesUtil.IsUserRecoverableError (result))
{
GooglePlayServicesUtil.GetErrorDialog (result, context, PLAY_SERVICE_RESOLUTION_REQ).Show ();
}
else
{
Log.Debug ("GetMapAsync", "Google Play Services is not supported on this device");
context.Finish ();
}
return false;
}
return true;//we're good
}
示例4: FinishAndForward
public static void FinishAndForward(Activity activity, Intent i)
{
i.SetFlags(ActivityFlags.ForwardResult);
activity.StartActivity(i);
activity.Finish();
}
示例5: LaunchApp
internal void LaunchApp(Activity ctx, ParseUser withUser, Action uiCallback)
{
// Fetch the person corresponding to the user
Task.Factory.StartNew (() => {
var query = new ParseQuery ("Person");
query.SetCachePolicy (ParseQuery.CachePolicy.CacheElseNetwork);
query.WhereEqualTo ("parseUser", withUser);
query.Include ("parseUser");
ParseObject self = null;
try {
self = query.First;
} catch (ParseException ex) {
// We may have a stall result from a previous registration
if (query.HasCachedResult) {
query.ClearCachedResult ();
try {
self = query.First;
} catch {
Android.Util.Log.Error ("Landing", "Error when trying to retrieve user 2. Normal if empty. {0}", ex.ToString ());
}
}
Android.Util.Log.Error ("Landing", "Error when trying to retrieve user. Normal if empty. {0}", ex.ToString ());
}
// First time ever, fill the info
if (self == null) {
TabPerson person = null;
// Check if our TabPerson wasn't created indirectly by another user
query = new ParseQuery ("Person");
query.WhereEqualTo ("emails", TabPerson.MD5Hash (withUser.Email));
try {
person = TabPerson.FromParse (query.First);
person.AssociatedUser = withUser;
} catch {
// We use the main address email we got by parseUser
// and we will fill the rest lazily later from profile
// idem for the display name
person = new TabPerson {
AssociatedUser = withUser,
Emails = new string[] { withUser.Email }
};
}
return person;
} else {
TabPerson.CurrentPerson = TabPerson.FromParse (self);
return null;
}
}).ContinueWith (t => {
ctx.RunOnUiThread (() => {
// If the user was created, we setup a CursorLoader to query the information we need
if (t.Result != null) {
var person = t.Result;
person.DisplayName = profile.DisplayName;
person.Emails = profile.Emails.Union (person.Emails);
person.ToParse ().SaveEventually ();
TabPerson.CurrentPerson = person;
}
if (uiCallback != null)
uiCallback ();
ctx.Finish ();
ctx.StartActivity (typeof (MainActivity));
});
});
}
示例6: dealWithSACWebView
public dealWithSACWebView(Activity f, AccountOAuth.OAuthTypes ProviderType, ISocialProviderManager Provider, ImageButton btnBack)
{
this.parent = f;
this.Provider = Provider;
this.ProviderType = ProviderType;
string authUrl = this.Provider.BrowserAuthUrl;
btnBack.Click += delegate
{
parent.Finish();
};
switch (ProviderType)
{
case AccountOAuth.OAuthTypes.Google:
AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) =>
{
AndroidData.GooglePlusAccessToken = accessToken;
AndroidData.GooglePlusRefreshToken = refreshToken;
AndroidData.GoogleAccessTokenExpiration = expires;
ShowAfterLoginScreen();
};
break;
case AccountOAuth.OAuthTypes.FaceBook:
LFacebookManager lFace = new LFacebookManager(LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret);
AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) =>
{
try
{
if (lFace.RefreshAccessToken())
{
AndroidData.FacebookAccessToken = lFace.AccessToken;
AndroidData.FacebookAccessTokenExpiration =
lFace.AccessTokenExpirationTime ?? DateTime.Now;
}//end if
} catch
{
AndroidData.FacebookAccessToken = accessToken;
AndroidData.FacebookAccessTokenExpiration = expires;
}
ShowAfterLoginScreen();
};
break;
case AccountOAuth.OAuthTypes.LinkedIn:
AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) =>
{
AndroidData.LinkedInAccessToken = accessToken;
AndroidData.LinkedInAccessTokenSecret = accessTokenSecret;
ShowAfterLoginScreen();
};
break;
}
}
示例7: dealWithWebView
public dealWithWebView(Activity f, AccountOAuth.OAuthTypes ProviderType, ISocialProviderManager Provider, ImageButton btnBack)
{
this.parent = f;
this.Provider = Provider;
this.ProviderType = ProviderType;
string authUrl = this.Provider.BrowserAuthUrl;
user = AndroidData.user;
btnBack.Click += delegate
{
parent.Finish();
};
switch (ProviderType)
{
case AccountOAuth.OAuthTypes.Google:
AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) =>
{
AndroidData.GooglePlusAccessToken = accessToken;
AndroidData.GooglePlusRefreshToken = refreshToken;
AndroidData.GoogleAccessTokenExpiration = expires;
startUserLogin(Provider);
};
break;
case AccountOAuth.OAuthTypes.FaceBook:
LFacebookManager lFace = new LFacebookManager(LOLConstants.FacebookAPIKey, LOLConstants.FacebookAppSecret);
AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) =>
{
try
{
if (lFace.RefreshAccessToken())
{
AndroidData.FacebookAccessToken = lFace.AccessToken;
AndroidData.FacebookAccessTokenExpiration = lFace.AccessTokenExpirationTime ?? DateTime.Now;
}
} catch
{
AndroidData.FacebookAccessToken = accessToken;
AndroidData.FacebookAccessTokenExpiration = expires;
}
startUserLogin(Provider);
};
break;
case AccountOAuth.OAuthTypes.LinkedIn:
AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) =>
{
AndroidData.LinkedInAccessToken = accessToken;
AndroidData.LinkedInAccessTokenSecret = accessTokenSecret;
startUserLogin(Provider);
};
break;
case AccountOAuth.OAuthTypes.Twitter:
LTwitterManager lTwit = new LTwitterManager(LOLConstants.TwitterConsumerKey, LOLConstants.TwitterConsumerSecret, AndroidData.TwitterAccessToken, AndroidData.TwitterAccessTokenSecret,
AndroidData.TwitterScreenName, AndroidData.TwitterUserId);
AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) =>
{
AndroidData.TwitterAccessToken = accessToken;
AndroidData.TwitterAccessTokenSecret = accessTokenSecret;
AndroidData.TwitterScreenName = lTwit.ScreenName;
AndroidData.TwitterUserId = lTwit.UserId;
startUserLogin(Provider);
};
break;
case AccountOAuth.OAuthTypes.YouTube:
AccessTokenReceived += (occurred, expires, accessToken, accessTokenSecret, refreshToken) =>
{
AndroidData.YouTubeAccessToken = accessToken;
AndroidData.YouTubeRefreshToken = refreshToken;
AndroidData.YouTubeAccessTokenExpiration = expires;
startUserLogin(Provider);
};
break;
}
}
示例8: dialogErrorInternet
//closeActivity is for finish() activity
public static void dialogErrorInternet(Activity context,int errorType,int close){
context.RunOnUiThread (() => {
string errorMsg = "";
if(errorType == errorInternet){
errorMsg = "Ralat. Sila semak sambungan internet anda.";
}else if(errorType == errorServer){
errorMsg = "Ralat. Server Pi1M dalam proses penyelenggaraan .";
}
Android.App.AlertDialog alertDialog;
Android.App.AlertDialog.Builder alertDialogBuilder = new Android.App.AlertDialog.Builder (context);
alertDialogBuilder
.SetTitle ("Masalah")
.SetMessage (string.Format (errorMsg))
.SetCancelable (false)
.SetPositiveButton ("OK", delegate {
if(close==closeActivity){
context.Finish ();
}
});
alertDialog = alertDialogBuilder.Create ();
alertDialog.Show ();
});
}
示例9: onSignOutRequest
public static void onSignOutRequest(Activity _activity){
new System.Threading.Thread(new System.Threading.ThreadStart(() => {
//TCSignalRClient.getInstance().stop();
if(MApplication.getInstance().tcSignalR != null){
MApplication.getInstance().tcSignalR.stop();
}
})).Start();
if (constants.isSignInFromSplashScreen) {
constants.isSignInFromSplashScreen = false;
Intent intent = new Intent (_activity, typeof(HomeActivity));
_activity.StartActivity (intent);
} else {
_activity.SetResult (Result.Ok);
}
// Clear observer
if (HomeDashBoard.homeDashBoardActivity != null) {
TCNotificationCenter.defaultCenter.removeObserver (HomeDashBoard.homeDashBoardActivity, Constants.kPostNotifyAlertChange);
try{
HomeDashBoard.homeDashBoardActivity.Finish ();
} catch(Exception ex){
#if DEBUG
Console.Write(ex.Message);
#endif
}
}
if(SearchResultActivity.searchActivity != null){
TCNotificationCenter.defaultCenter.removeObserver (SearchResultActivity.searchActivity, constants.kAddFavoriteSuccess);
TCNotificationCenter.defaultCenter.removeObserver (SearchResultActivity.searchActivity, constants.kRemoveFavoriteSuccess);
try {
SearchResultActivity.searchActivity.Finish();
} catch(Exception ex){
#if DEBUG
Console.Write(ex.Message);
#endif
}
}
if (SpecialistDetailActivity.specDetailActivity != null) {
TCNotificationCenter.defaultCenter.removeObserver (SpecialistDetailActivity.specDetailActivity, Constants.kUpdateTalkNowStep);
TCNotificationCenter.defaultCenter.removeObserver (SpecialistDetailActivity.specDetailActivity, constants.kDeferSuccess);
try{
SpecialistDetailActivity.specDetailActivity.Finish();
} catch(Exception e){
#if DEBUG
Console.Write(e.Message);
#endif
}
//SpecialistDetailActivity.specDetailActivity = null;
}
if (ListFavoriteActivity.listFavoriteActivity != null) {
TCNotificationCenter.defaultCenter.removeObserver (ListFavoriteActivity.listFavoriteActivity, constants.kRemoveFavoriteSuccess);
TCNotificationCenter.defaultCenter.removeObserver (ListFavoriteActivity.listFavoriteActivity, constants.kAddFavoriteSuccess);
try {
ListFavoriteActivity.listFavoriteActivity.Finish ();
} catch(Exception ex){
#if DEBUG
Console.Write(ex.Message);
#endif
}
}
if (AlertActivity.eventActivity != null) {
try {
TCNotificationCenter.defaultCenter.removeObserver (AlertActivity.eventActivity, Constants.kPostDeleteFileSuccess);
TCNotificationCenter.defaultCenter.removeObserver (AlertActivity.eventActivity, constants.kUpdateAlertWhenDeleteFileLocal);
AlertActivity.eventActivity.Finish ();
} catch(Exception ex){
#if DEBUG
Console.Write(ex.Message);
#endif
}
}
if (ConfirmedRequestsActivity.confirmedActivity != null) {
TCNotificationCenter.defaultCenter.removeObserver (ConfirmedRequestsActivity.confirmedActivity, constants.kDeleteFileConfirmed);
TCNotificationCenter.defaultCenter.removeObserver (ConfirmedRequestsActivity.confirmedActivity, Constants.kPostDeleteFileSuccess);
try {
ConfirmedRequestsActivity.confirmedActivity.Finish ();
} catch(Exception ex){
#if DEBUG
Console.Write(ex.Message);
#endif
}
}
if(PastBookingActivity.pastBookingActivity != null){
TCNotificationCenter.defaultCenter.removeObserver (PastBookingActivity.pastBookingActivity, constants.kDeleteFilePast);
TCNotificationCenter.defaultCenter.removeObserver (PastBookingActivity.pastBookingActivity, constants.kNotifyUpdateBookingInfo);
TCNotificationCenter.defaultCenter.removeObserver (PastBookingActivity.pastBookingActivity, Constants.kPostDeleteFileSuccess);
try {
PastBookingActivity.pastBookingActivity.Finish ();
} catch(Exception ex){
#if DEBUG
Console.Write(ex.Message);
#endif
}
//.........这里部分代码省略.........