Пример #1
0
		public static void WriteToPreferences(Context context, Player player) {
			var editor = GetEditor(context);
			editor.PutString(PreferenceFirstName, player.FirstName);
			editor.PutString(PreferenceLastName, player.LastInitial);
			editor.PutString(PreferenceAvatar, player.Avatar.ToString());
			editor.Apply();
		}
		void SetUpToolbar(Player player) {
			var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar_player);
			SetActionBar(toolbar);

			ActionBar.SetDisplayShowTitleEnabled(false);
			var avatarView = toolbar.FindViewById<AvatarView>(Resource.Id.avatar);
			avatarView.SetImageDrawable (GetDrawable((int)player.Avatar));
			(toolbar.FindViewById<TextView>(Resource.Id.title)).Text = GetDisplayName(player);
		}
		string GetDisplayName(Player player) {
			return string.Format(GetString(Resource.String.player_display_name), player.FirstName, player.LastInitial);
		}
		public static void Start(Context context, Player player) {
			var starter = new Intent(context, typeof(CategorySelectionActivity));
			starter.PutExtra(ExtraPlayer, player);
			context.StartActivity(starter);
		}
 void AssurePlayerInit()
 {
     if (null == player)
         player = PreferencesHelper.GetPlayer (Activity);
 }
 void SavePlayer(Activity activity)
 {
     player = new Player (firstName.Text, lastInitial.Text, selectedAvatar);
     PreferencesHelper.WriteToPreferences (activity, player);
 }