Beispiel #1
0
 public StationViewModel()
 {
     StationData      = new StationDataModel();
     EarthquakeData   = new EarthquakeDataModel();
     this.saveCommand = new SaveCommandHandler(this);
     this.getEarthquakeDataCommand = new GetEarthquakeDataCommandHandler(this);
 }
        private static StringBuilder BuildQuery(StationDataModel model)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("http://www.iris.edu/ws/station/query?");
            if (!string.IsNullOrWhiteSpace(model.Network))
            {
                sb.Append(@"&net=" + model.Network);
            }

            if (!string.IsNullOrWhiteSpace(model.Station))
            {
                sb.Append(@"&sta=" + model.Station);
            }

            if (!string.IsNullOrWhiteSpace(model.Location))
            {
                sb.Append(@"&loc=" + model.Location);
            }

            if (!string.IsNullOrWhiteSpace(model.Channel))
            {
                sb.Append(@"&cha=" + model.Channel);
            }

            if (!string.IsNullOrWhiteSpace(model.StartDate) && !string.IsNullOrWhiteSpace(model.EndDate))
            {
                sb.Append(@"&timewindow=" + model.StartDate + "," + model.EndDate);
            }

            if (!string.IsNullOrWhiteSpace(model.Level))
            {
                sb.Append(@"&level=" + model.Level);
            }

            sb.Replace("query?&", "query?");
            return sb;
        }