本文整理汇总了C#中Android.App.Activity.StartActivity方法的典型用法代码示例。如果您正苦于以下问题:C# Activity.StartActivity方法的具体用法?C# Activity.StartActivity怎么用?C# Activity.StartActivity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.App.Activity
的用法示例。
在下文中一共展示了Activity.StartActivity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainActivityViewModel
public MainActivityViewModel(Activity context)
{
this.NavigateReactivePropertyBasicsCommand = new ReactiveCommand();
this.NavigateReactivePropertyBasicsCommand
.Subscribe(_ => context.StartActivity(typeof(ReactivePropertyBasicsActivity)));
this.NavigateListAdapterCommand = new ReactiveCommand();
this.NavigateListAdapterCommand
.Subscribe(_ => context.StartActivity(typeof(ListAdapterActivity)));
}
示例2: Start
public static void Start (Activity activity, bool edit, ActivityOptions options)
{
var starter = new Intent (activity, typeof(SignInActivity));
starter.PutExtra (ExtraEdit, edit);
if (options == null) {
activity.StartActivity (starter);
activity.OverridePendingTransition (Android.Resource.Animation.SlideInLeft, Android.Resource.Animation.SlideOutRight);
} else {
activity.StartActivity (starter, options.ToBundle ());
}
}
示例3: StartTargetActivity
/// <summary>
/// 启动登录活动activity.并传入参数至下一步
/// </summary>
/// <param name="activity">Activity.</param>
public static void StartTargetActivity(Activity activity,FuncActivityType _funcActivityType)
{
var type = FuncTypeActivityFactory.CreateFuncActivityFactory ((int)_funcActivityType);
if (HasLogin) {
//已经登录
activity.StartActivity(type);
activity.OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
} else {
//未登录,跳转到登录界面
Intent intent = new Intent (activity, typeof(LoginActivity));
intent.PutExtra (Global.FuncType, (int)_funcActivityType);
activity.StartActivity (intent);
activity.OverridePendingTransition (Resource.Animation.bottom_in, 0);
}
}
示例4: ActivityRoutedViewHost
public ActivityRoutedViewHost(Activity hostActivity)
{
var keyUp = hostActivity.GetType()
.GetMethods(BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance)
.FirstOrDefault(x => x.Name == "OnKeyUp");
if (keyUp == null) {
throw new Exception("You must override OnKeyUp and call theRoutedViewHost.OnKeyUp");
}
var viewFor = hostActivity as IViewFor;
if (viewFor == null) {
throw new Exception("You must implement IViewFor<TheViewModelClass>");
}
bool firstSet = false;
_inner = _hostScreen.Router.ViewModelObservable()
.Where(x => x != null)
.Subscribe(vm => {
if (!firstSet) {
viewFor.ViewModel = vm;
firstSet = true;
return;
}
var view = RxRouting.ResolveView(vm);
if (view.GetType() != typeof(Type)) {
throw new Exception("Views in Android must be the Type of an Activity");
}
hostActivity.StartActivity((Type)view);
});
}
示例5: StartQuizActivityWithTransition
void StartQuizActivityWithTransition(Activity activity, View toolbar, Category category) {
var pairs = TransitionHelper.CreateSafeTransitionParticipants(activity, false, new Pair(toolbar, activity.GetString(Resource.String.transition_toolbar)));
var sceneTransitionAnimation = ActivityOptions.MakeSceneTransitionAnimation(activity, pairs);
// Start the activity with the participants, animating from one to the other.
var transitionBundle = sceneTransitionAnimation.ToBundle();
activity.StartActivity(QuizActivity.GetStartIntent(activity, category), transitionBundle);
}
示例6: Show
public void Show(Activity activity)
{
Validate();
var i = FillIntent();
activity.StartActivity(i);
activity.OverridePendingTransition(AnimationEnterInResource, AnimationEnterOutResource);
}
示例7: ShowDonateReminderIfAppropriate
public static void ShowDonateReminderIfAppropriate(Activity context)
{
foreach (Reminder r in GetReminders())
{
if ((DateTime.Now >= r.From )
&& (DateTime.Now < r.To))
{
ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(context);
if (prefs.GetBoolean(r.Key, false) == false)
{
ISharedPreferencesEditor edit = prefs.Edit();
edit.PutBoolean(r.Key, true);
EditorCompat.Apply(edit);
context.StartActivity(new Intent(context, typeof(DonateReminder)));
}
}
}
}
示例8: MainActivityViewModel
public MainActivityViewModel(Activity context, AppContext app)
{
this.People = app.Master.People.ToReadOnlyReactiveCollection(x => new PersonViewModel(x));
this.InsertNewCommand = new ReactiveCommand();
this.InsertNewCommand.Subscribe(_ => app.Master.InsertNew());
this.LoadCommand = new ReactiveCommand();
this.LoadCommand.Subscribe(_ => app.Master.Load());
this.LoadMoreCommand = app.Master.ObserveProperty(x => x.CanLoadMore)
.ToReactiveCommand();
this.LoadMoreCommand.Subscribe(_ => app.Master.LoadMore());
this.EditCommand = new ReactiveCommand<long>();
this.EditCommand.Subscribe(id =>
{
app.Detail.SetEditTarget(id);
context.StartActivity(typeof(DetailActivity));
});
}
示例9: ActivityRoutedViewHost
public ActivityRoutedViewHost(Activity hostActivity, IViewLocator viewLocator = null)
{
viewLocator = viewLocator ?? ViewLocator.Current;
var platform = RxApp.DependencyResolver.GetService<IPlatformOperations>();
var keyUp = hostActivity.GetType()
.GetMethods(BindingFlags.Public | BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Instance)
.FirstOrDefault(x => x.Name == "OnKeyUp");
if (keyUp == null) {
throw new Exception("You must override OnKeyUp and call theRoutedViewHost.OnKeyUp");
}
var viewFor = hostActivity as IViewFor;
if (viewFor == null) {
throw new Exception("You must implement IViewFor<TheViewModelClass>");
}
bool firstSet = false;
_inner = _hostScreen.Router.CurrentViewModel
.Where(x => x != null)
.Subscribe(vm => {
if (!firstSet) {
viewFor.ViewModel = vm;
firstSet = true;
return;
}
var view = viewLocator.ResolveView(vm, platform.GetOrientation());
if (view.GetType() != typeof(Type)) {
throw new Exception("Views in Android must be the Type of an Activity");
}
hostActivity.StartActivity((Type)view);
});
}
示例10: startThisActivity
public static void startThisActivity(Activity activity)
{
activity.StartActivity(new Intent(activity, typeof(Sample2Activity)));
}
示例11: 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));
});
});
}
示例12: Launch
public static void Launch(Activity act, PwEntry pw, int pos, AppTask appTask, ActivityFlags? flags = null)
{
Intent i = new Intent(act, typeof(EntryActivity));
i.PutExtra(KeyEntry, pw.Uuid.ToHexString());
i.PutExtra(KeyRefreshPos, pos);
if (flags != null)
i.SetFlags((ActivityFlags) flags);
appTask.ToIntent(i);
if (flags != null && (((ActivityFlags) flags) | ActivityFlags.ForwardResult) == ActivityFlags.ForwardResult)
act.StartActivity(i);
else
act.StartActivityForResult(i, 0);
}
示例13: Login
public static void Login(Activity activity)
{
activity.StartActivity(typeof(Login));
}
示例14: Logout
/// <summary>
/// Logout from the system.
/// </summary>
/// <param name="activeActivity">Active activity used to start intent from.</param>
public void Logout(Activity activeActivity)
{
userToken = null;
var toLogin = new Intent(activeActivity, typeof(MainActivity));
toLogin.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
activeActivity.StartActivity(toLogin);
}
示例15: StartNewActivity
/// <summary>
/// Start new activity
/// </summary>
/// <param name="currentActivity">current activity</param>
/// <param name="newActivityType">new activity to start</param>
public static void StartNewActivity(Activity currentActivity, Type newActivityType)
{
var intent = new Intent(currentActivity, newActivityType);
currentActivity.StartActivity(intent);
}