本文整理汇总了C#中Location.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Location.ToString方法的具体用法?C# Location.ToString怎么用?C# Location.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Location
的用法示例。
在下文中一共展示了Location.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Trigger
public void Trigger(ErrorType type, Location location, string message)
{
string locstring = location == null ? "" : " at " + location.ToString();
Console.WriteLine(type.ToString() + locstring + ": " + message);
fatalErrorOccured |= IsFatalError(type);
}
示例2: Location_tostring
public void Location_tostring()
{
Location l = new Location("Somewhereville");
string expected = "Somewhereville";
string actual = l.ToString();
Assert.AreEqual(expected, actual);
}
示例3: BtnGetLocation_OnClick
async private void BtnGetLocation_OnClick(object sender, RoutedEventArgs e)
{
txtLocation.Text = "Getting Data...";
MyLocation = await WeatherRepository.Instance.GetCurrentLocation();
txtLocation.Text = MyLocation.ToString();
txtResponse.Text = "Getting weather data";
txtResponse.Text = await WeatherRepository.Instance.GetWeatherInfoString(MyLocation);
//var response = JObject.Parse(txtResponse.Text);
//var days = (JArray) response["response"][0]["durations"];
var weatherInfo = WeatherRepository.Instance.GetWeatherInfo(txtResponse.Text);
//var weatherCodePrimary =
}
示例4: FavoriteDetailPage
public FavoriteDetailPage()
{
InitializeComponent();
var res = App.My.getNavigationParameter();
if (res != null)
{
this.current = (Location)res;
this.LocationInfo.Text = "" + current.ToString();
this.latitude.Text = "Latitude: " + current.Latitude;
this.longitude.Text = "Longitude: " + current.Longitude;
this.description.Text = "" + current.Description;
}
}
示例5: btnSave_Click
//.........这里部分代码省略.........
// Only allow one number to have SMS selected
if ( smsSelected )
{
phoneNumber.IsMessagingEnabled = false;
}
else
{
phoneNumber.IsMessagingEnabled = cbSms.Checked;
smsSelected = cbSms.Checked;
}
phoneNumber.IsUnlisted = cbUnlisted.Checked;
phoneNumberTypeIds.Add( phoneNumberTypeId );
History.EvaluateChange(
changes,
string.Format( "{0} Phone", DefinedValueCache.GetName( phoneNumberTypeId ) ),
oldPhoneNumber,
phoneNumber.NumberFormattedWithCountryCode );
}
}
}
}
// Remove any blank numbers
var phoneNumberService = new PhoneNumberService( rockContext );
foreach ( var phoneNumber in person.PhoneNumbers
.Where( n => n.NumberTypeValueId.HasValue && !phoneNumberTypeIds.Contains( n.NumberTypeValueId.Value ) )
.ToList() )
{
History.EvaluateChange(
changes,
string.Format( "{0} Phone", DefinedValueCache.GetName( phoneNumber.NumberTypeValueId ) ),
phoneNumber.ToString(),
string.Empty );
person.PhoneNumbers.Remove( phoneNumber );
phoneNumberService.Delete( phoneNumber );
}
History.EvaluateChange( changes, "Email", person.Email, tbEmail.Text );
person.Email = tbEmail.Text.Trim();
var newEmailPreference = rblEmailPreference.SelectedValue.ConvertToEnum<EmailPreference>();
History.EvaluateChange( changes, "Email Preference", person.EmailPreference, newEmailPreference );
person.EmailPreference = newEmailPreference;
if ( person.IsValid )
{
if ( rockContext.SaveChanges() > 0 )
{
if ( changes.Any() )
{
HistoryService.SaveChanges(
rockContext,
typeof( Person ),
Rock.SystemGuid.Category.HISTORY_PERSON_DEMOGRAPHIC_CHANGES.AsGuid(),
person.Id,
changes );
}
if ( orphanedPhotoId.HasValue )
{
BinaryFileService binaryFileService = new BinaryFileService( rockContext );
var binaryFile = binaryFileService.Get( orphanedPhotoId.Value );
if ( binaryFile != null )
示例6: ShowReadonlyDetails
/// <summary>
/// Shows the readonly details.
/// </summary>
/// <param name="location">The location.</param>
private void ShowReadonlyDetails( Location location )
{
SetEditMode( false );
hfLocationId.SetValue( location.Id );
if ( string.IsNullOrWhiteSpace( location.Name ) )
{
lReadOnlyTitle.Text = location.ToString().FormatAsHtmlTitle();
}
else
{
lReadOnlyTitle.Text = location.Name.FormatAsHtmlTitle();
}
hlInactive.Visible = !location.IsActive;
if ( location.LocationTypeValue != null )
{
hlType.Text = location.LocationTypeValue.Value;
hlType.Visible = true;
}
else
{
hlType.Visible = false;
}
string imgTag = GetImageTag( location.ImageId, 150, 150 );
if ( location.ImageId.HasValue )
{
string imageUrl = ResolveRockUrl( String.Format( "~/GetImage.ashx?id={0}", location.ImageId.Value ) );
lImage.Text = string.Format( "<a href='{0}'>{1}</a>", imageUrl, imgTag );
}
else
{
lImage.Text = imgTag;
}
DescriptionList descriptionList = new DescriptionList();
if ( location.ParentLocation != null )
{
descriptionList.Add( "Parent Location", location.ParentLocation.Name );
}
if ( location.LocationTypeValue != null )
{
descriptionList.Add( "Location Type", location.LocationTypeValue.Value );
}
if ( location.PrinterDevice != null )
{
descriptionList.Add( "Printer", location.PrinterDevice.Name );
}
string fullAddress = location.GetFullStreetAddress().ConvertCrLfToHtmlBr();
if ( !string.IsNullOrWhiteSpace( fullAddress ) )
{
descriptionList.Add( "Address", fullAddress );
}
lblMainDetails.Text = descriptionList.Html;
location.LoadAttributes();
Rock.Attribute.Helper.AddDisplayControls( location, phAttributes );
phMaps.Controls.Clear();
var mapStyleValue = DefinedValueCache.Read( GetAttributeValue( "MapStyle" ) );
if ( mapStyleValue == null )
{
mapStyleValue = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.MAP_STYLE_ROCK );
}
if ( mapStyleValue != null )
{
string mapStyle = mapStyleValue.GetAttributeValue( "StaticMapStyle" );
if ( !string.IsNullOrWhiteSpace( mapStyle ) )
{
if ( location.GeoPoint != null )
{
string markerPoints = string.Format( "{0},{1}", location.GeoPoint.Latitude, location.GeoPoint.Longitude );
string mapLink = System.Text.RegularExpressions.Regex.Replace( mapStyle, @"\{\s*MarkerPoints\s*\}", markerPoints );
mapLink = System.Text.RegularExpressions.Regex.Replace( mapLink, @"\{\s*PolygonPoints\s*\}", string.Empty );
mapLink += "&sensor=false&size=350x200&zoom=13&format=png";
phMaps.Controls.Add( new LiteralControl ( string.Format( "<div class='group-location-map'><img src='{0}'/></div>", mapLink ) ) );
}
if ( location.GeoFence != null )
{
string polygonPoints = "enc:" + location.EncodeGooglePolygon();
string mapLink = System.Text.RegularExpressions.Regex.Replace( mapStyle, @"\{\s*MarkerPoints\s*\}", string.Empty );
mapLink = System.Text.RegularExpressions.Regex.Replace( mapLink, @"\{\s*PolygonPoints\s*\}", polygonPoints );
mapLink += "&sensor=false&size=350x200&format=png";
phMaps.Controls.Add( new LiteralControl( string.Format( "<div class='group-location-map'><img src='{0}'/></div>", mapLink ) ) );
}
}
//.........这里部分代码省略.........
示例7: ShowEditDetails
/// <summary>
/// Shows the edit details.
/// </summary>
/// <param name="location">The location.</param>
private void ShowEditDetails( Location location )
{
if ( location.Id == 0 )
{
lReadOnlyTitle.Text = ActionTitle.Add( Location.FriendlyTypeName ).FormatAsHtmlTitle();
hlInactive.Visible = false;
}
else
{
if ( string.IsNullOrWhiteSpace( location.Name ) )
{
lReadOnlyTitle.Text = location.ToString().FormatAsHtmlTitle();
}
else
{
lReadOnlyTitle.Text = location.Name.FormatAsHtmlTitle();
}
}
SetEditMode( true );
imgImage.BinaryFileId = location.ImageId;
imgImage.NoPictureUrl = System.Web.VirtualPathUtility.ToAbsolute( "~/Assets/Images/no-picture.svg?" );
tbName.Text = location.Name;
cbIsActive.Checked = location.IsActive;
acAddress.SetValues( location );
ddlPrinter.SetValue( location.PrinterDeviceId );
geopPoint.SetValue( location.GeoPoint );
geopFence.SetValue( location.GeoFence );
cbGeoPointLocked.Checked = location.IsGeoPointLocked ?? false;
Guid mapStyleValueGuid = GetAttributeValue( "MapStyle" ).AsGuid();
geopPoint.MapStyleValueGuid = mapStyleValueGuid;
geopFence.MapStyleValueGuid = mapStyleValueGuid;
var rockContext = new RockContext();
var locationService = new LocationService( rockContext );
var attributeService = new AttributeService( rockContext );
ddlLocationType.BindToDefinedType( DefinedTypeCache.Read( Rock.SystemGuid.DefinedType.LOCATION_TYPE.AsGuid() ), true );
gpParentLocation.Location = location.ParentLocation ?? locationService.Get( location.ParentLocationId ?? 0 );
// LocationType depends on Selected ParentLocation
if ( location.Id == 0 && ddlLocationType.Items.Count > 1 )
{
// if this is a new location
ddlLocationType.SelectedIndex = 0;
}
else
{
ddlLocationType.SetValue( location.LocationTypeValueId );
}
location.LoadAttributes( rockContext );
BuildAttributeEdits( location, true );
}
示例8: Verify
/// <summary>
/// Performs Address Verification on the provided <see cref="Rock.Model.Location" />.
/// </summary>
/// <param name="location">A <see cref="Rock.Model.Location" /> to verify.</param>
/// <param name="reVerify">if set to <c>true</c> [re verify].</param>
public void Verify( Location location, bool reVerify )
{
string inputLocation = location.ToString();
// Create new context to save service log without affecting calling method's context
var rockContext = new RockContext();
Model.ServiceLogService logService = new Model.ServiceLogService( rockContext );
// Try each of the verification services that were found through MEF
foreach ( var service in Rock.Address.VerificationContainer.Instance.Components )
{
if ( service.Value.Value.IsActive )
{
string result;
bool success = service.Value.Value.VerifyLocation( location, reVerify, out result );
if ( !string.IsNullOrWhiteSpace( result ) )
{
// Log the results of the service
Model.ServiceLog log = new Model.ServiceLog();
log.LogDateTime = RockDateTime.Now;
log.Type = "Location Verify";
log.Name = service.Value.Metadata.ComponentName;
log.Input = inputLocation;
log.Result = result.Left( 200 );
log.Success = success;
logService.Add( log );
}
}
}
rockContext.SaveChanges();
}
示例9: ParsePersonField
/// <summary>
/// Parses the person field.
/// </summary>
/// <param name="field">The field.</param>
/// <returns></returns>
private object ParsePersonField( RegistrationTemplateFormField field )
{
switch ( field.PersonFieldType )
{
case RegistrationPersonFieldType.FirstName:
{
var tbFirstName = phRegistrantControls.FindControl( "tbFirstName" ) as RockTextBox;
string value = tbFirstName != null ? tbFirstName.Text : null;
return string.IsNullOrWhiteSpace( value ) ? null : value;
}
case RegistrationPersonFieldType.LastName:
{
var tbLastName = phRegistrantControls.FindControl( "tbLastName" ) as RockTextBox;
string value = tbLastName != null ? tbLastName.Text : null;
return string.IsNullOrWhiteSpace( value ) ? null : value;
}
case RegistrationPersonFieldType.Campus:
{
var cpHomeCampus = phRegistrantControls.FindControl( "cpHomeCampus" ) as CampusPicker;
return cpHomeCampus != null ? cpHomeCampus.SelectedCampusId : null;
}
case RegistrationPersonFieldType.Address:
{
var location = new Location();
var acAddress = phRegistrantControls.FindControl( "acAddress" ) as AddressControl;
if ( acAddress != null )
{
acAddress.GetValues( location );
return string.IsNullOrWhiteSpace( location.ToString() ) ? null : location.ToJson();
}
break;
}
case RegistrationPersonFieldType.Email:
{
var tbEmail = phRegistrantControls.FindControl( "tbEmail" ) as EmailBox;
string value = tbEmail != null ? tbEmail.Text : null;
return string.IsNullOrWhiteSpace( value ) ? null : value;
}
case RegistrationPersonFieldType.Birthdate:
{
var bpBirthday = phRegistrantControls.FindControl( "bpBirthday" ) as BirthdayPicker;
return bpBirthday != null ? bpBirthday.SelectedDate : null;
}
case RegistrationPersonFieldType.Gender:
{
var ddlGender = phRegistrantControls.FindControl( "ddlGender" ) as RockDropDownList;
return ddlGender != null ? ddlGender.SelectedValueAsInt() : null;
}
case RegistrationPersonFieldType.MaritalStatus:
{
var ddlMaritalStatus = phRegistrantControls.FindControl( "ddlMaritalStatus" ) as RockDropDownList;
return ddlMaritalStatus != null ? ddlMaritalStatus.SelectedValueAsInt() : null;
}
case RegistrationPersonFieldType.MobilePhone:
{
var phoneNumber = new PhoneNumber();
var ppMobile = phRegistrantControls.FindControl( "ppMobile" ) as PhoneNumberBox;
if ( ppMobile != null )
{
phoneNumber.CountryCode = PhoneNumber.CleanNumber( ppMobile.CountryCode );
phoneNumber.Number = PhoneNumber.CleanNumber( ppMobile.Number );
return string.IsNullOrWhiteSpace( phoneNumber.Number ) ? null : phoneNumber.ToJson();
}
break;
}
case RegistrationPersonFieldType.HomePhone:
{
var phoneNumber = new PhoneNumber();
var ppHome = phRegistrantControls.FindControl( "ppHome" ) as PhoneNumberBox;
if ( ppHome != null )
{
phoneNumber.CountryCode = PhoneNumber.CleanNumber( ppHome.CountryCode );
phoneNumber.Number = PhoneNumber.CleanNumber( ppHome.Number );
return string.IsNullOrWhiteSpace( phoneNumber.Number ) ? null : phoneNumber.ToJson();
}
break;
}
case RegistrationPersonFieldType.WorkPhone:
{
var phoneNumber = new PhoneNumber();
var ppWork = phRegistrantControls.FindControl( "ppWork" ) as PhoneNumberBox;
if ( ppWork != null )
{
phoneNumber.CountryCode = PhoneNumber.CleanNumber( ppWork.CountryCode );
phoneNumber.Number = PhoneNumber.CleanNumber( ppWork.Number );
//.........这里部分代码省略.........
示例10: SymbolRelatedToPreviousError
/// <summary>
/// In most error cases is very useful to have information about symbol that caused the error.
/// Call this method before you call Report.Error when it makes sense.
/// </summary>
public void SymbolRelatedToPreviousError (Location loc, string symbol)
{
SymbolRelatedToPreviousError (loc.ToString ());
}
示例11: InternalErrorException
public InternalErrorException (Exception e, Location loc)
: base (loc.ToString (), e)
{
}
示例12: ShowReadonlyDetails
/// <summary>
/// Shows the readonly details.
/// </summary>
/// <param name="location">The location.</param>
private void ShowReadonlyDetails( Location location )
{
SetEditMode( false );
hfLocationId.SetValue( location.Id );
if ( string.IsNullOrWhiteSpace( location.Name ) )
{
lReadOnlyTitle.Text = location.ToString().FormatAsHtmlTitle();
}
else
{
lReadOnlyTitle.Text = location.Name.FormatAsHtmlTitle();
}
hlInactive.Visible = !location.IsActive;
if ( location.LocationTypeValue != null )
{
hlType.Text = location.LocationTypeValue.Name;
hlType.Visible = true;
}
else
{
hlType.Visible = false;
}
DescriptionList descriptionList = new DescriptionList();
string fullAddress = location.GetFullStreetAddress();
if ( !string.IsNullOrWhiteSpace( fullAddress ) )
{
descriptionList.Add( "Address", fullAddress );
}
if ( location.ParentLocation != null )
{
descriptionList.Add( "Parent Location", location.ParentLocation.Name );
}
if ( location.PrinterDevice != null)
{
descriptionList.Add( "Printer", location.PrinterDevice.Name );
}
lblMainDetails.Text = descriptionList.Html;
location.LoadAttributes();
Rock.Attribute.Helper.AddDisplayControls( location, phAttributes );
// Get all the location locations and location all those that have a geo-location into either points or polygons
var dict = new Dictionary<string, object>();
if ( location.GeoPoint != null )
{
var pointsDict = new Dictionary<string, object>();
pointsDict.Add( "latitude", location.GeoPoint.Latitude );
pointsDict.Add( "longitude", location.GeoPoint.Longitude );
dict.Add( "point", pointsDict );
}
if ( location.GeoFence != null )
{
var polygonDict = new Dictionary<string, object>();
polygonDict.Add( "polygon_wkt", location.GeoFence.AsText() );
polygonDict.Add( "google_encoded_polygon", location.EncodeGooglePolygon() );
dict.Add( "polygon", polygonDict );
}
phMaps.Controls.Clear();
phMaps.Controls.Add( new LiteralControl( GetAttributeValue( "MapHTML" ).ResolveMergeFields( dict ) ) );
btnSecurity.Visible = location.IsAuthorized( Authorization.ADMINISTRATE, CurrentPerson );
btnSecurity.Title = location.Name;
btnSecurity.EntityId = location.Id;
}
示例13: onLocationReceived
private void onLocationReceived(Location current)
{
this.LocationInfo.Text = current.ToString();
this.current = current;
}
示例14: AddFunctionProfile
public void AddFunctionProfile(Location location, string functionName, TimeSpan elapsed) {
if(FunctionHistory == null) {
FunctionHistory = new List<FunctionProfile>();
}
FunctionHistory.Add(new FunctionProfile { Location = location.ToString(), FunctionName = functionName, Elapsed = elapsed });
}
示例15: Verify
/// <summary>
/// Performs Address Verification on the provided <see cref="Rock.Model.Location" />.
/// </summary>
/// <param name="location">A <see cref="Rock.Model.Location" /> to verify.</param>
/// <param name="reVerify">if set to <c>true</c> [re verify].</param>
public bool Verify( Location location, bool reVerify )
{
bool success = false;
// Do not reverify any locked locations
if ( location == null || ( location.IsGeoPointLocked.HasValue && location.IsGeoPointLocked.Value ) )
{
return false;
}
string inputLocation = location.ToString();
// Create new context to save service log without affecting calling method's context
var rockContext = new RockContext();
Model.ServiceLogService logService = new Model.ServiceLogService( rockContext );
bool standardized = location.StandardizeAttemptedDateTime.HasValue && !reVerify;
bool geocoded = location.GeocodeAttemptedDateTime.HasValue && !reVerify;
bool anyActiveStandardizationService = false;
bool anyActiveGeocodingService = false;
// Save current values for situation when first service may successfully standardize or geocode, but not both
// In this scenario the first service's values should be preserved
string street1 = location.Street1;
string street2 = location.Street2;
string city = location.City;
string county = location.County;
string state = location.State;
string country = location.Country;
string postalCode = location.PostalCode;
string barcode = location.Barcode;
DbGeography geoPoint = location.GeoPoint;
// Try each of the verification services that were found through MEF
foreach ( var service in Rock.Address.VerificationContainer.Instance.Components )
{
var component = service.Value.Value;
if ( component != null &&
component.IsActive && (
( !standardized && component.SupportsStandardization ) ||
( !geocoded && component.SupportsGeocoding ) ) )
{
string resultMsg = string.Empty;
var result = component.Verify( location, out resultMsg );
if ( !standardized && component.SupportsStandardization )
{
anyActiveStandardizationService = true;
// Log the service and result
location.StandardizeAttemptedServiceType = service.Value.Metadata.ComponentName;
location.StandardizeAttemptedResult = resultMsg;
// As long as there wasn't a connection error, update the attempted datetime
if ( ( result & Address.VerificationResult.ConnectionError ) != Address.VerificationResult.ConnectionError )
{
location.StandardizeAttemptedDateTime = RockDateTime.Now;
}
// If location was successfully geocoded, update the timestamp
if ( ( result & Address.VerificationResult.Standardized ) == Address.VerificationResult.Standardized )
{
location.StandardizedDateTime = RockDateTime.Now;
standardized = true;
// Save standardized address in case another service is called for geocoding
street1 = location.Street1;
street2 = location.Street2;
city = location.City;
county = location.County;
state = location.State;
country = location.Country;
postalCode = location.PostalCode;
barcode = location.Barcode;
}
}
else
{
// Reset the address back to what it was originally or after previous service successfully standardized it
location.Street1 = street1;
location.Street2 = street2;
location.City = city;
location.County = county;
location.State = state;
location.Country = country;
location.PostalCode = postalCode;
location.Barcode = barcode;
}
if ( !geocoded && component.SupportsGeocoding )
{
anyActiveGeocodingService = true;
// Log the service and result
location.GeocodeAttemptedServiceType = service.Value.Metadata.ComponentName;
//.........这里部分代码省略.........