コード例 #1
0
        private void CreateMallowClick(object sender, RoutedEventArgs e)
        {
            if (MallowSource.CurrentSource.Current is null)
            {
                return;
            }
            Mallow mallow = new Mallow();

            mallow.SetValuesOnDeserialized(new StreamingContext());
            MallowSource.CurrentSource.Current.Mallows.Insert(0, mallow);
            MallowSource.CurrentSource.Current.CurrentMallow = mallow;
        }
コード例 #2
0
        public Mallow[] Parse(string rawData)
        {
            JArray data = (JArray)JObject.Parse(rawData)["items"];

            if (data is null)
            {
                return(Array.Empty <Mallow>());
            }

            List <Mallow> mallows = new List <Mallow>();

            foreach (JToken rawItem in data)
            {
                Mallow mallow = new Mallow
                {
                    OriginalMessage = (string)rawItem["content"]
                };
                mallow.SetValuesOnDeserialized(new StreamingContext());
                mallows.Add(mallow);
            }

            return(mallows.ToArray());
        }