コード例 #1
0
ファイル: RegisteredDevice.cs プロジェクト: haefele/YnabApi
        public RegisteredDevice(YnabApiSettings settings, Budget budget, JObject device)
        {
            this._settings = settings;
            this._device = device;

            this.Budget = budget;
            this.FriendlyName = device.Value<string>("friendlyName");
            this.ShortDeviceId = device.Value<string>("shortDeviceId");
            this.HasFullKnowledge = device.Value<bool>("hasFullKnowledge");
            this.KnowledgeString = device.Value<string>("knowledge");
            this.CurrentKnowledge = Knowledge.ExtractKnowledgeForDevice(this.KnowledgeString, this.ShortDeviceId);
            this.DeviceGuid = device.Value<string>("deviceGUID");
            this.YnabVersion = device.Value<string>("YNABVersion");
            this.DeviceType = device.Value<string>("deviceType");
        }
コード例 #2
0
        public override async void Enter()
        {
            var api = await this._container.RegisterYnabApiAsync();

            this._budget = await api.GetBudgetAsync(this.BudgetName);
            this._device = await this._budget.RegisterDevice(Windows.Networking.Proximity.PeerFinder.DisplayName);

            this._sessionStateService.DeviceGuid = this._device.DeviceGuid;

            this.Application.Actions.Add(this._overviewItem);
            this.Application.Actions.Add(this._transactionsItem);
            this.Application.Actions.Add(this._addTransactionItem);
            this.Application.Actions.Add(this._refreshItem);

            this.Application.SecondaryActions.Add(this._changeBudgetItem);

            this.Overview();
        }
コード例 #3
0
        private void OpenBudget(Budget budget)
        {
            this._sessionStateService.BudgetName = budget.BudgetName;

            var newState = IoC.Get<OpenBudgetApplicationState>();
            newState.BudgetName = budget.BudgetName;

            this.Application.CurrentState = newState;
        }
コード例 #4
0
 protected override async void OnInitialize()
 {
     this._budget = await this._ynabApi.GetBudgetAsync(this._sessionStateService.BudgetName);
     this._device = await this._budget.GetRegisteredDevice(this._sessionStateService.DeviceGuid);
 }
コード例 #5
0
        protected override async void OnInitialize()
        {
            using (this._loadingService.Show("Loading data..."))
            {
                this._budget = await this._api.GetBudgetAsync(this._sessionStateService.BudgetName);
                this._device = await this._budget.GetRegisteredDevice(this._sessionStateService.DeviceGuid);
                
                var payees = await this._device.GetPayeesAsync();
                this.Payees.AddRange(payees.OnlyActive().WithoutTransfers());

                var accounts = await this._device.GetAccountsAsync();
                this.Accounts.AddRange(accounts);

                var masterCategories = await this._device.GetCategoriesAsync();
                this.Categories.AddRange(masterCategories.OnlyActive().SelectMany(f => f.SubCategories.OnlyActive().Select(d => new CategoryViewModel(f, d))));
            }
        }