Új hozzászólás Aktív témák

  • tboy93

    nagyúr

    No, kicsit átalakítottam.

    private async Task GetExchangeRates()
    {
    await Task.Run(() =>
    {
    Task<List<Model.Currency>> task = Service.CurrencyService.GetList();
    task.Wait();
    var currencies = task.Result;
    if (currencies != null)
    {
    foreach (Model.Currency curr in currencies)
    {
    if (curr.Name == "USD") this.Usd = curr.Value;
    if (curr.Name == "EUR") this.Eur = curr.Value;
    if (curr.Name == "GBP") this.Gbp = curr.Value;
    }
    }
    });
    }

    Viszont amire nem számítottam, hogy összeakad itt a RaisePropertyChange-el:

    public double Usd
    {
    get { return usd; }
    set
    {
    usd = value;
    RaisePropertyChanged("Usd");
    }
    }

    Aszongya:
    An exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Runtime.WindowsRuntime.dll but was not handled in user code

    Additional information: Az alkalmazás olyan objektumfelületet hívott, amely egy másik szálhoz volt rendelve. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))

Új hozzászólás Aktív témák