public DialogViewModel(string message, string caption, string yesBtn, bool showNoBtn, string noBtn, BoxOperation operation, Action action) { _operation = operation; _action = action; Message = message; Caption = caption; Yes = yesBtn; No = noBtn; ShowNoBtn = showNoBtn; YesBtn = new RelayCommand(YesButtonPressed); NoBtn = new RelayCommand(NoButtonPressed); }
public string Get(BoxOperation request) { try { // parse the bounding box. if (string.IsNullOrWhiteSpace(request.Box)) { throw new ArgumentException("Invalid request: bbox not defined!"); } // split arguments. string[] bounds = request.Box.Split(','); if (bounds == null || bounds.Length != 4) { throw new ArgumentException(string.Format( "Invalid request: bbox invalid: {0}!", request.Box)); } // parse bounds. float left, bottom, right, top; if (!float.TryParse(bounds[0], NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out left) || !float.TryParse(bounds[1], NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out bottom) || !float.TryParse(bounds[2], NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out right) || !float.TryParse(bounds[3], NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture, out top)) { throw new ArgumentException(string.Format( "Invalid request: bbox invalid: {0}!", request.Box)); } // execute the request. return (new DataService()).RequestData(request.File, new GeoCoordinateBox( new GeoCoordinate(left, bottom), new GeoCoordinate(right, top))); } catch (Exception ex) { base.Response.StatusCode = (int) HttpStatusCode.BadRequest; return string.Empty; } }
public void ShowMessageBox(string message, string caption, string yesBtn = "OK", bool showNoBtn = false, string noBtn = "Cancel", BoxOperation operation = BoxOperation.Message, Action action = null) { var dialogViewModel = new DialogViewModel(message, caption, yesBtn, showNoBtn, noBtn, operation, action); var window = new DialogView() { DataContext = dialogViewModel, Topmost = true, Title = caption, ResizeMode = ResizeMode.NoResize, Height = 150, Width = 300, BorderBrush = Brushes.LightBlue, WindowStartupLocation = WindowStartupLocation.CenterScreen, }; window.ShowDialog(); }