예제 #1
0
 public override object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         string scale = value as string;
         return(ScaleFactorHelper.ScaleToDouble(scale));
     }
     else
     {
         return(0);
     }
 }
예제 #2
0
 public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 {
     if (value != null)
     {
         double scale = (double)value;
         return(ScaleFactorHelper.DoubleToScale(scale));
     }
     else
     {
         return(string.Empty);
     }
 }
        public SpaceMonkeyCoreViewModel()
        {
            string apiKey = string.Empty;

            using (StreamReader reader = new StreamReader("secrets.json"))
            {
                string    json    = reader.ReadToEnd();
                SmSecrets secrets = JsonConvert.DeserializeObject <SmSecrets>(json);
                apiKey = secrets.ApiKey;
            }
            this.NextIndex           = 0;
            this.Satellites          = new List <SmSatellite>();
            this.DisplayedSatellites = new ObservableCollection <SatelliteCardViewModel>();
            this.Categories          = new ObservableCollection <string>(CategoryIdHelper.GetCategories());
            this.Scales = new ObservableCollection <string>(ScaleFactorHelper.GetScales());
            this.Client = new SpaceMonkeyWebClient(apiKey);
            this.GetSatellitesCommand = new RelayCommand(this.GetSatellites);
            this.BakeAllCommand       = new RelayCommand(this.BakeAll);
            this.SearchRadius         = 70;
            this.CategoryId           = 0;
            this.ScaleFactor          = 0.001;
            Instance = this;
        }