本文整理汇总了C#中Bundle.GetBundle方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.GetBundle方法的具体用法?C# Bundle.GetBundle怎么用?C# Bundle.GetBundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bundle
的用法示例。
在下文中一共展示了Bundle.GetBundle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.snake_layout);
Button b1 = (Button)FindViewById (Resource.Id.button1);
b1.SetX (200);
b1.SetY (530);
b1.SetHeight (60);
b1.SetWidth (60);
b1.Text = "Arriba";
b1.Click += delegate {
snake_view.keypress(Keycode.DpadUp);
};
Button b2 = (Button)FindViewById(Resource.Id.button2);
b2.SetX(200);
b2.SetY(610);
b2.SetHeight (60);
b2.SetWidth (60);
b2.Text = "Abajo";
b2.Click += delegate {
snake_view.keypress(Keycode.DpadDown);
};
Button b3 = (Button)FindViewById(Resource.Id.button3);
b3.SetX(100);
b3.SetY(610);
b3.Text = "Izq.";
b3.SetHeight (60);
b3.SetWidth (60);
b3.Click += delegate {
snake_view.keypress(Keycode.DpadLeft);
};
Button b4 = (Button)FindViewById(Resource.Id.button4);
b4.SetX(300);
b4.SetY(610);
b4.Text = "Der.";
b4.SetHeight (60);
b4.SetWidth (60);
b4.Click += delegate {
snake_view.keypress(Keycode.DpadRight);
};
snake_view = (GameView)FindViewById(Resource.Id.snake);
snake_view.SetTextView((TextView)FindViewById(Resource.Id.text));
if (savedInstanceState == null) {
snake_view.SetMode (GameMode.Ready);
} else {
Bundle map = savedInstanceState.GetBundle (ICICLE_KEY);
if (map != null)
snake_view.RestoreState (map);
else
snake_view.SetMode (GameMode.Paused);
}
}
示例2: OnActivityCreated
/// <summary>
/// Tells the fragment that its activity has completed its own Activity.onCreate().
/// </summary>
/// <param name="savedInstanceState"></param>
public override void OnActivityCreated(Bundle savedInstanceState)
{
base.OnActivityCreated(savedInstanceState);
if (savedInstanceState != null) { //Load pre-saved wizard context.. Coming in from a orientation change perhaps
WizardFlow.LoadFlow(savedInstanceState);
StateManager.ContextBundle = savedInstanceState.GetBundle(STATE_WIZARD_CONTEXT);
StateManager.LoadStepContext(this);
}
else {
StateManager.ContextBundle = new Bundle(); //Initialize wizard context
//Persist hosting activity/fragment fields to wizard context enabling easy data transfer between wizard host and the steps
StateManager.PersistStepContext(this);
}
Wizard = new Wizard(WizardFlow, StateManager, ChildFragmentManager);
Wizard.StepChanged += OnWizardStepChanged;
Wizard.WizardComplete += OnWizardComplete;
}
示例3: OnCreate
// Called when Activity is first created. Turns off the title bar, sets up
// the content views, and fires up the SnakeView.
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.snake_layout);
snake_view = FindViewById<SnakeView> (Resource.Id.snake);
snake_view.SetTextView (FindViewById<TextView> (Resource.Id.text));
if (savedInstanceState == null) {
// We were just launched -- set up a new game
snake_view.SetMode (GameMode.Ready);
} else {
// We are being restored
Bundle map = savedInstanceState.GetBundle (ICICLE_KEY);
if (map != null)
snake_view.RestoreState (map);
else
snake_view.SetMode (GameMode.Paused);
}
}
示例4: RestoreViewModelsFromBundle
private static void RestoreViewModelsFromBundle(IMvxJsonConverter serializer, Bundle savedInstanceState)
{
IMvxSavedStateConverter savedStateConverter;
IMvxMultipleViewModelCache viewModelCache;
IMvxViewModelLoader viewModelLoader;
if (!Mvx.TryResolve(out savedStateConverter))
{
Mvx.Trace("Could not resolve IMvxSavedStateConverter, won't be able to convert saved state");
return;
}
if (!Mvx.TryResolve(out viewModelCache))
{
Mvx.Trace("Could not resolve IMvxMultipleViewModelCache, won't be able to convert saved state");
return;
}
if (!Mvx.TryResolve(out viewModelLoader))
{
Mvx.Trace("Could not resolve IMvxViewModelLoader, won't be able to load ViewModel for caching");
return;
}
// Harder ressurection, just in case we were killed to death.
var json = savedInstanceState.GetString(SavedFragmentTypesKey);
if (string.IsNullOrEmpty(json)) return;
var savedState = serializer.DeserializeObject<Dictionary<string, Type>>(json);
foreach (var item in savedState)
{
var bundle = savedInstanceState.GetBundle(item.Key);
if (bundle.IsEmpty) continue;
var mvxBundle = savedStateConverter.Read(bundle);
var request = MvxViewModelRequest.GetDefaultRequest(item.Value);
// repopulate the ViewModel with the SavedState and cache it.
var vm = viewModelLoader.LoadViewModel(request, mvxBundle);
viewModelCache.Cache(vm, item.Key);
}
}
示例5: RestoreQuizState
void RestoreQuizState(Bundle savedInstanceState)
{
if (null == savedInstanceState) {
return;
}
EventHandler<View.LayoutChangeEventArgs> handler = null;
handler += (sender, e) => {
quizView.LayoutChange -= handler;
var currentChild = quizView.GetChildAt(0);
var viewGroup = currentChild as ViewGroup;
if (viewGroup != null) {
var potentialQuizView = viewGroup.GetChildAt(0);
var absQuizView = potentialQuizView as AbsQuizView;
if (absQuizView != null) {
absQuizView.UserInput = savedInstanceState.GetBundle(KeyUserInput);
}
}
};
quizView.LayoutChange += handler;
}
示例6: OnActivityCreated
public override void OnActivityCreated (Bundle savedInstanceState)
{
base.OnActivityCreated (savedInstanceState);
MRequestFocus = delegate {
mList.FocusableViewAvailable (mList);
};
mHandler = new MyPreferenceFragmentHandler (this);
if (mHavePrefs) {
BindPreferences ();
}
mInitDone = true;
if (savedInstanceState != null) {
Bundle container = savedInstanceState.GetBundle (PREFERENCES_TAG);
if (container != null) {
PreferenceScreen preferenceScreen = PreferenceScreen;
if (preferenceScreen != null) {
preferenceScreen.RestoreHierarchyState (container);
}
}
}
}