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

            sb.Append("http://www.iris.edu/servlet/eventserver/eventsXML.do?Catalog=ALL&Contributor=ALL&magtype=ALL&LatMax=86.20&LatMin=-79.50&LonMax=180.00&LonMin=-180.00");
            if (!string.IsNullOrWhiteSpace(model.StartDate))
            {
                sb.Append(@"&StartDate=" + model.StartDate.Replace("/", ""));
            }

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

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

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

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

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

            sb.Append(@"&priority=" + model.SelectedPriority.Key);
            sb.Append(@"&PointsMax=" + model.SelectedDisplayCount.Key);

            return sb;
        }