public void setDataContext() { Settings s = GlobalSettings.getSettings(); LabeledComboBoxContext currency = new LabeledComboBoxContext(); setSettingsComboContext(ref currency); LabeledComboBoxContext wage = new LabeledComboBoxContext(); setSettingsComboContext(ref wage); LabeledComboBoxContext height = new LabeledComboBoxContext(); setSettingsComboContext(ref height); LabeledComboBoxContext weight = new LabeledComboBoxContext(); setSettingsComboContext(ref weight); LabeledComboBoxContext allowEditing = new LabeledComboBoxContext(); setSettingsComboContext(ref allowEditing); LabeledComboBoxContext language = new LabeledComboBoxContext(); setSettingsComboContext(ref language); LabeledComboBoxContext theme = new LabeledComboBoxContext(); setSettingsComboContext(ref theme); LabeledNumericContext wonderkidsMaxAge = new LabeledNumericContext(); setNumericsContext(ref wonderkidsMaxAge); wonderkidsMaxAge.Maximum = 200; LabeledNumericContext wonderkidsMinPA = new LabeledNumericContext(); setNumericsContext(ref wonderkidsMinPA); LabeledNumericContext wonderstaffMinPA = new LabeledNumericContext(); wonderkidsMinPA.Maximum = 200; setNumericsContext(ref wonderstaffMinPA); wonderstaffMinPA.Maximum = 200; LabeledNumericContext wonderteamsMinRep = new LabeledNumericContext(); setNumericsContext(ref wonderteamsMinRep); wonderteamsMinRep.Maximum = 10000; vm = new GeneralTabItemViewModel(); vm.generalsettings = new LabeledHeaderContext(); vm.currency = currency; vm.wage = wage; vm.height = height; vm.weight = weight; vm.allowEditing = allowEditing; vm.language = language; vm.theme = theme; vm.wonderkidsMaxAge = wonderkidsMaxAge; vm.wonderkidsMinPA = wonderkidsMinPA; vm.wonderstaffMinPA = wonderstaffMinPA; vm.wonderteamsMinRep = wonderteamsMinRep; ScoutLocalization localization = globalFuncs.localization; vm.currency.ComboBoxItems = localization.currencies; vm.wage.ComboBoxItems = localization.wages; vm.height.ComboBoxItems = localization.heights; vm.weight.ComboBoxItems = localization.weights; vm.allowEditing.ComboBoxItems = localization.YesNo; vm.language.ComboBoxItems = globalFuncs.languages; vm.theme.ComboBoxItems = globalFuncs.themes; setControlValues(); setLocalization(); this.DataContext = vm; }
public void setDataContext() { vm = new PreferencesWindowViewModel(); generalTabItemViewModel = this.GeneralTabItem.vm; ImageButtonContext close = new ImageButtonContext(); close.ImageSource = TryFindResource("close") as ImageSource; ImageTextButtonContext ok = new ImageTextButtonContext(); ok.ImageSource = TryFindResource("yes") as ImageSource; ImageTextButtonContext cancel = new ImageTextButtonContext(); cancel.ImageSource = TryFindResource("cancel") as ImageSource; ImageButtonContext save = new ImageButtonContext(); save.ImageSource = TryFindResource("save") as ImageSource; ImageButtonContext del = new ImageButtonContext(); del.ImageSource = TryFindResource("delete") as ImageSource; ImageButtonContext def = new ImageButtonContext(); def.ImageSource = TryFindResource("default") as ImageSource; LabeledComboBoxContext setting = new LabeledComboBoxContext(); setting.LabelWidth = 60; setting.ComboBoxWidth = 120; vm.close = close; vm.ok = ok; vm.cancel = cancel; vm.save = save; vm.del = del; vm.def = def; vm.setting = setting; vm.setting.ComboBoxItems = settings.settingNames; vm.header = new LabeledHeaderContext(); vm.general = new LabeledHeaderContext(); vm.player = new LabeledHeaderContext(); vm.staff = new LabeledHeaderContext(); vm.team = new LabeledHeaderContext(); vm.shortlist = new LabeledHeaderContext(); vm.playercolumnsettings = new LabeledHeaderContext(); vm.staffcolumnsettings = new LabeledHeaderContext(); vm.teamcolumnsettings = new LabeledHeaderContext(); vm.shortlistcolumnsettings = new LabeledHeaderContext(); vm.selectedallcolumns = new LabeledHeaderContext(); vm.clearcolumns = new LabeledHeaderContext(); vm.defcolumns = new LabeledHeaderContext(); vm.buttonWarningTooltip = new LabeledHeaderContext(); vm.buttonSaveTooltip = new LabeledHeaderContext(); vm.buttonDeleteTooltip = new LabeledHeaderContext(); vm.buttonSetDefaultTooltip = new LabeledHeaderContext(); vm.buttonUseChangesTooltip = new LabeledHeaderContext(); vm.buttonCancelChangesTooltip = new LabeledHeaderContext(); setControlValues(); setLocalization(); this.DataContext = vm; }