protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); Button monstersButton = FindViewById <Button>(Resource.Id.monstersButton); if (monstersButton != null) { FindViewById <Button>(Resource.Id.monstersButton).Click += delegate { ShowMonsterFragment(); }; FindViewById <Button>(Resource.Id.featsButton).Click += delegate { ShowFeatsFragment(); }; FindViewById <Button>(Resource.Id.spellsButton).Click += delegate { ShowSpellsFragment(); }; FindViewById <Button>(Resource.Id.combatButton).Click += delegate { ShowCombatFragment(); }; FindViewById <Button>(Resource.Id.rulesButton).Click += delegate { ShowRulesFragment(); }; FindViewById <Button>(Resource.Id.treasureButton).Click += delegate { ShowTreasureFragment(); }; } ImageButton b = FindViewById <ImageButton>(Resource.Id.monstersImageButton); if (b != null) { FindViewById <ImageButton>(Resource.Id.monstersImageButton).Click += delegate { ShowMonsterFragment(); }; FindViewById <ImageButton>(Resource.Id.featsImageButton).Click += delegate { ShowFeatsFragment(); }; FindViewById <ImageButton>(Resource.Id.spellsImageButton).Click += delegate { ShowSpellsFragment(); }; FindViewById <ImageButton>(Resource.Id.combatImageButton).Click += delegate { ShowCombatFragment(); }; FindViewById <ImageButton>(Resource.Id.rulesImageButton).Click += delegate { ShowRulesFragment(); }; FindViewById <ImageButton>(Resource.Id.treasureImageButton).Click += delegate { ShowTreasureFragment(); }; } b = FindViewById <ImageButton>(Resource.Id.helpButton); b.Click += delegate { ShowHelp(); }; b = FindViewById <ImageButton>(Resource.Id.settingsButton); b.Click += delegate { UIUtils.ShowListPopover(b, "Options", new List <string> { "Import", "Export", "Settings", }, (option) => { switch (option) { case 0: ShowImport(); break; case 1: ShowExport(); break; case 2: ShowSettings(); break; } }); }; ShowLastFragment(); //UpdateText(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.SpellEditor); OKButton.Click += OKButton_Click; CancelButton.Click += CancelButton_Click; NameText.AttachEditTextString(spell, "Name"); MaterialText.AttachEditTextString(spell.Adjuster, "MaterialText"); FocusText.AttachEditTextString(spell.Adjuster, "FocusText"); DescriptionText.AttachEditTextString(spell, "description"); DismissibleCheckbox.AttachBool(spell.Adjuster, "Dismissible"); VerbalCheckbox.AttachBool(spell.Adjuster, "Verbal"); SomaticCheckbox.AttachBool(spell.Adjuster, "Somatic"); FocusCheckbox.AttachBool(spell.Adjuster, "Focus"); DivineFocusCheckbox.AttachBool(spell.Adjuster, "DivineFocus"); SchoolButton.AttachButtonStringList(spell, "school", Spell.Schools); SubschoolButton.AttachTextCombo(spell, "subschool", Spell.Subschools); DescriptorButton.AttachTextCombo(spell, "descriptor", Spell.Descriptors); CastingTimeButton.AttachTextCombo(spell, "casting_time", Spell.CastingTimeOptions); RangeButton.AttachTextCombo(spell, "range", Spell.RangeOptions); AreaButton.AttachTextCombo(spell, "area", Spell.AreaOptions); TargetsButton.AttachTextCombo(spell, "targets", Spell.TargetsOptions); DurationButton.AttachTextCombo(spell, "duration", Spell.DurationOptions); SavingThrowButton.AttachTextCombo(spell, "saving_throw", Spell.SavingThrowOptions); SpellResistanceButton.AttachTextCombo(spell, "spell_resistence", Spell.SpellResistanceOptions); SpellLevelListView.Adapter = new SpellLevelAdapter(this, SpellLevelListView.Context); AddSpellLevelButton.Click += (sender, e) => { var avList = from className in Spell.SpellAdjuster.Classes.Values where !spell.Adjuster.ContainsClass(className) select className; List <string> availableLevels = new List <string>(); availableLevels.AddRange(avList); availableLevels.Sort(); UIUtils.ShowListPopover(AddSpellLevelButton, "Class", availableLevels, (item) => { String newClass = availableLevels[item]; var lai = new Spell.SpellAdjuster.LevelAdjusterInfo() { Class = newClass, Level = 1 }; spell.Adjuster.Levels.Add(lai); SpellLevelListView.Adapter = new SpellLevelAdapter(this, SpellLevelListView.Context); }); }; spell.PropertyChanged += (sender, e) => { UpdateOK(); }; spell.Adjuster.PropertyChanged += (sender, e) => { UpdateOK(); }; UpdateOK(); }