示例#1
0
        public static async Task InitializeAsync()
        {
            var settings = new AppSettings();

            // Note: initialize as soon as a new setting is added
            if (settings.IsFirstRun || IsNewerAppVersion(settings))
            {
                settings.AppVersion = PhoneInteraction.GetAppVersion();
                settings.ItemsControlViewInfoIndex = 0;
                settings.IsSortedAscending = true;
                settings.IsAttackFilterEnabled = false;
                settings.IsCostFilterEnabled = false;
                settings.SortOptionSelection = new[] { true, false, false };
                // 9 classes, 1 neutral
                settings.ClassSelection = new [] { true, true, true, true, true, true, true, true, true, true };
                // 7 sets
                settings.SetSelection = new[] { true, true, true, true, true, true, true };
                // 5 rarities
                settings.RaritySelection = new [] { true, true, true, true, true };
                // 24 mechanics
                settings.MechanicsSelection = new[]
                {
                    true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true,
                    true, true, true, true, true, true, true
                };
                settings.IsAnyMechanicsChecked = true;

                settings.IsFirstRun = false;

                await AddPurchasesAsync();
            }
        }
示例#2
0
        public MainPage()
        {
            this.InitializeComponent();
            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            // set data context
            _mainVm = SingletonLocator.Get<MainViewModel>();
            DataContext = _mainVm;

            // set initial items panel template (from settings)
            var iptIndex = new AppSettings().ItemsControlViewInfoIndex;
            SetItemsPanelTemplate(iptIndex);

            Loaded += MainPage_OnLoaded;

            // listen for back-button
            HardwareButtons.BackPressed += async (sender, args) =>
            {
                if (_mainVm.IsSortingControlVisible)
                {
                    _mainVm.ToggleSorterControlVisibility();
                    await _mainVm.ApplySortAsync();
                    args.Handled = true;
                }
            };
        }