Example #1
0
 public MainViewModel()
 {
     if (File.Exists("Palette.dat"))
     {
         using (var fs = new FileStream("Palette.dat", FileMode.Open, FileAccess.Read))
         {
             using (var reader = new StreamReader(fs))
             {
                 var res = JsonConvert.DeserializeObject<List<Palette>>(reader.ReadToEnd());
                 _palettes = new ObservableCollection<PeiseListItemViewModel>();
                 foreach (var i in res)
                     _palettes.Add(new PeiseListItemViewModel(i));
             }
         }
     }
     if (_palettes.Count > 0)
     {
         _curpeiselistitem = _palettes[0];
         PeiseDisplayViewModel vm = new PeiseDisplayViewModel(_curpeiselistitem.Palette);
         _curpeisedisplay = vm;
     }
 }
Example #2
0
 public MainViewModel()
 {
     if (File.Exists("Palette.dat"))
     {
         using (var fs = new FileStream("Palette.dat", FileMode.Open, FileAccess.Read))
         {
             using (var reader = new StreamReader(fs))
             {
                 var res = JsonConvert.DeserializeObject <List <Palette> >(reader.ReadToEnd());
                 _palettes = new ObservableCollection <PeiseListItemViewModel>();
                 foreach (var i in res)
                 {
                     _palettes.Add(new PeiseListItemViewModel(i));
                 }
             }
         }
     }
     if (_palettes.Count > 0)
     {
         _curpeiselistitem = _palettes[0];
         PeiseDisplayViewModel vm = new PeiseDisplayViewModel(_curpeiselistitem.Palette);
         _curpeisedisplay = vm;
     }
 }