1

JSON フィードのリクエストを送信するときに、この問題が発生します。問題は、フィードに動的なヘッダーがあることです (つまり、"testinput1" の要求を送信すると、ヘッダーの応答は testinput1.

したがって、RootObject を動的にする必要がありますが、方法がわかりません。助けていただけますか?

以下のコードの面倒な部分を入力しました

Deployment.Current.Dispatcher.BeginInvoke(() =>
{
    textBlock1.Text = "Details Loaded.";
    short_description.Text = feed.testinput1.short_description; // can I make testinput1 a constant? its based on code below
});

public class Event
{
    public string description { get; set; }
    public string datetime { get; set; }
}

public class TrackCode
{
    public string short_description { get; set; }
    public List<Event> events { get; set; }
}

public class RootObject
{
    public string tracker;
    public TrackCode testinput1// This needs to be based on user input each time
    {
        get; // Can I do something here to make sure that the "testinput1" changes each time?
        set;  // And create a constant that can be referred to?
    }
}

うまくいけば、私はこのようなことをすることができます:

     short_description.Text = feed.trackcode.short_description; // this is a constant


    public class RootObject
    {
        public string tracker = "AB123456789NZ"; // This is the variable that changes

        public TrackCode trackcode // this becomes a constant
        {
            get { return tracker; }  // uses tracking number as value for JSON when it retrieves it
            set { tracker = value;}
        }
    }

どこで間違ったのですか?ありがとうございました!

4

0 に答える 0