Subversion Repository Public Repository

Nextrek

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using System.ComponentModel;

namespace DatacronVideoGuide.ViewModels
{
    public class Planet : INotifyPropertyChanged
    {
        public String name { get; set; }//binding
        public String Name { get; set; }
        public  const double minOpacity = 0.6;
        public  const double maxOpacity = 1.0;
        public String listItemImage { get; set; }
        public String portraitImage { get; set; }
        public List<Datacron> datacrons{get;set;}
        private double Opacity;
        public double opacity { get{
                    return this.Opacity;
            }
            set
            {
                if (this.Opacity != value)
                {
                    this.Opacity = value;
                    NotifyPropertyChanged("opacity");
                }
                    
            
            }
        }



        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public void parseJson(JToken token) {
            this.Name = ((Newtonsoft.Json.Linq.JProperty)token).Name;
            this.name = Name.ToLower();
            this.opacity = minOpacity;
            this.listItemImage = "/DatacronVideoGuide;component/Planet/" + Name + "/"+Name+"01.png";
            this.portraitImage = "/DatacronVideoGuide;component/Planet/" + Name + "/" + Name + "Sfondo.png";
            this.datacrons = new List<Datacron>();
            Datacron dc;
            
            foreach (var datacron in token.First.Children()) {
                dc = new Datacron();
                dc.parseJson((JToken)datacron);
                dc.planet = this;
                this.datacrons.Add(dc);

            }
        
        }
    }
}

Commits for Nextrek/WindowsPhone/SwtorDatacronVideoGuide/DatacronVideoGuide/DatacronVideoGuide/ViewModels/Planet.cs

Diff revisions: vs.
Revision Author Commited Message
6 FMMortaroli picture FMMortaroli Sat 20 Apr, 2013 15:30:47 +0000