Exemple #1
0
            protected override object DeserializeCore(LoadContext identifier, XElement xml, Type objectType, Stream stream)
            {
                //<photosets cancreate="1">
                //    <photoset id="5" primary="2483" secret="abcdef"
                //        server="8" photos="4" farm="1">
                //        <title>Test</title>
                //        <description>foo</description>
                //    </photoset>
                //    <photoset id="4" primary="1234" secret="832659"
                //        server="3" photos="12" farm="1">
                //        <title>My Set</title>
                //        <description>bar</description>
                //    </photoset>
                //</photosets>

                PhotosetListVm vm = new PhotosetListVm(identifier.Identity);

                vm.Photosets = new System.Collections.ObjectModel.ObservableCollection <PhotosetVm>();

                foreach (var ps in xml.Elements("photoset"))
                {
                    bool success;

                    string id = TryGetValue(ps, "id", "", out success);

                    PhotosetVm psvm = new PhotosetVm(id);

                    psvm.Title          = TryGetValue(ps, "title", null, out success);
                    psvm.Description    = TryGetValue(ps, "description", null, out success);
                    psvm.PrimaryPhotoId = TryGetValue(ps, "primary", null, out success);

                    vm.Photosets.Add(psvm);
                }

                return(vm);
            }
Exemple #2
0
            protected override object DeserializeCore(LoadContext identifier, XElement xml, Type objectType, Stream stream)
            {
                //<photosets cancreate="1">
                //    <photoset id="5" primary="2483" secret="abcdef"
                //        server="8" photos="4" farm="1">
                //        <title>Test</title>
                //        <description>foo</description>
                //    </photoset>
                //    <photoset id="4" primary="1234" secret="832659"
                //        server="3" photos="12" farm="1">
                //        <title>My Set</title>
                //        <description>bar</description>
                //    </photoset>
                //</photosets>

                PhotosetListVm vm = new PhotosetListVm(identifier.Identity);

                vm.Photosets = new System.Collections.ObjectModel.ObservableCollection<PhotosetVm>();

                foreach (var ps in xml.Elements("photoset"))
                {
                    bool success;

                    string id = TryGetValue(ps, "id", "", out success);

                    PhotosetVm psvm = new PhotosetVm(id);

                    psvm.Title = TryGetValue(ps, "title", null, out success);
                    psvm.Description = TryGetValue(ps, "description", null, out success);
                    psvm.PrimaryPhotoId = TryGetValue(ps, "primary", null, out success);

                    vm.Photosets.Add(psvm);
                }

                return vm;
            }