本文整理汇总了C#中System.Globalization.Message.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Message.Add方法的具体用法?C# Message.Add怎么用?C# Message.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Globalization.Message
的用法示例。
在下文中一共展示了Message.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSymbolAsync
// Request geometry and new message to the layer
private async void AddSymbolAsync(SymbolViewModel symbolViewModel)
{
try
{
Dictionary<string, string> values = (Dictionary<string, string>)symbolViewModel.Model.Values;
string geometryControlType = values["GeometryType"];
DrawShape requestedShape = DrawShape.Point;
switch (geometryControlType)
{
case "Point":
requestedShape = DrawShape.Point;
break;
case "Line":
requestedShape = DrawShape.Polyline;
break;
case "Polygon":
requestedShape = DrawShape.Polygon;
break;
case "Circle":
requestedShape = DrawShape.Circle;
break;
case "Rectangular":
requestedShape = DrawShape.Rectangle;
break;
default:
await new MessageDialog("Selected symbol is not supported in this sample", "Symbol Dictionary Search Sample").ShowAsync();
return;
}
while (true)
{
Esri.ArcGISRuntime.Geometry.Geometry geometry = null;
try
{
geometry = await MyMapView.Editor.RequestShapeAsync(requestedShape, null, null);
}
catch { }
if (geometry == null)
return;
// Create a new message
Message msg = new Message();
// Set the ID and other parts of the message
msg.Id = Guid.NewGuid().ToString();
msg.Add("_type", "position_report");
msg.Add("_action", "update");
msg.Add("_wkid", MyMapView.SpatialReference.Wkid.ToString());
msg.Add("sic", _selectedSymbol.SymbolID);
msg.Add("uniquedesignation", "1");
// Construct the Control Points based on the geometry type of the drawn geometry.
switch (requestedShape)
{
case DrawShape.Point:
MapPoint point = geometry as MapPoint;
msg.Add("_control_points", point.X.ToString(CultureInfo.InvariantCulture) + "," + point.Y.ToString(CultureInfo.InvariantCulture));
break;
case DrawShape.Polygon:
Polygon polygon = geometry as Polygon;
string cpts = string.Empty;
foreach (var pt in polygon.Parts[0].GetPoints())
cpts += ";" + pt.X.ToString(CultureInfo.InvariantCulture) + "," + pt.Y.ToString(CultureInfo.InvariantCulture);
msg.Add("_control_points", cpts);
break;
case DrawShape.Polyline:
Polyline polyline = geometry as Polyline;
cpts = string.Empty;
foreach (var pt in polyline.Parts[0].GetPoints())
cpts += ";" + pt.X.ToString(CultureInfo.InvariantCulture) + "," + pt.Y.ToString(CultureInfo.InvariantCulture);
msg.Add("_control_points", cpts);
break;
}
// Process the message
if (!_messageLayer.ProcessMessage(msg))
await new MessageDialog("Failed to process message.", "Symbol Dictionary Search Sample").ShowAsync();
btnClearMap.IsEnabled = true;
}
}
catch (Exception ex)
{
var _x = new MessageDialog(ex.Message, "Symbol Dictionary Search Sample").ShowAsync();
}
}
开发者ID:jordanparfitt,项目名称:arcgis-runtime-samples-dotnet,代码行数:89,代码来源:SymbolDictionarySearchSample.xaml.cs
示例2: AddSymbolAsync
// Request geometry and new message to the layer
private async Task AddSymbolAsync(DrawShape requestedShape)
{
try
{
// Keep adding messages until next symbol is selected
while (true)
{
var geometry = await mapView.Editor.RequestShapeAsync(requestedShape, null, null);
// Create a new message
Message msg = new Message();
// Set the ID and other parts of the message
msg.Id = Guid.NewGuid().ToString();
msg.Add("_type", "position_report");
msg.Add("_action", "update");
msg.Add("_wkid", "3857");
msg.Add("sic", _selectedSymbol.SymbolID);
msg.Add("uniquedesignation", "1");
// Construct the Control Points based on the geometry type of the drawn geometry.
switch (requestedShape)
{
case DrawShape.Point:
MapPoint point = geometry as MapPoint;
msg.Add("_control_points", point.X.ToString(CultureInfo.InvariantCulture) + "," + point.Y.ToString(CultureInfo.InvariantCulture));
break;
case DrawShape.Polygon:
Polygon polygon = geometry as Polygon;
string cpts = string.Empty;
foreach (var pt in polygon.Rings[0])
cpts += ";" + pt.X.ToString(CultureInfo.InvariantCulture) + "," + pt.Y.ToString(CultureInfo.InvariantCulture);
msg.Add("_control_points", cpts);
break;
case DrawShape.Polyline:
Polyline polyline = geometry as Polyline;
cpts = string.Empty;
foreach (var pt in polyline.Paths[0])
cpts += ";" + pt.X.ToString(CultureInfo.InvariantCulture) + "," + pt.Y.ToString(CultureInfo.InvariantCulture);
msg.Add("_control_points", cpts);
break;
}
// Process the message
if (!_messageLayer.ProcessMessage(msg))
await new MessageDialog("Failed to process message.", "Symbol Dictionary Search Sample").ShowAsync();
}
}
catch (TaskCanceledException taskCanceledException)
{
// Requsting geometry was canceled.
}
catch (Exception ex)
{
var _ = new MessageDialog(ex.Message, "Symbol Dictionary Search Sample").ShowAsync();
}
}
开发者ID:KrisFoster44,项目名称:arcgis-runtime-samples-dotnet,代码行数:58,代码来源:SymbolDictionarySearchSample.xaml.cs
示例3: AddSymbolAsync
// Request geometry and new message to the layer
private async void AddSymbolAsync(DrawShape requestedShape)
{
try
{
// Keep adding messages until next symbol is selected
while (true)
{
Esri.ArcGISRuntime.Geometry.Geometry geometry = null;
try
{
geometry = await MyMapView.Editor.RequestShapeAsync(requestedShape, null, null);
}
catch { }
if (geometry == null)
return;
// Create a new message
Message msg = new Message();
// Set the ID and other parts of the message
msg.Id = Guid.NewGuid().ToString();
msg.Add("_type", "position_report");
msg.Add("_action", "update");
msg.Add("_wkid", MyMapView.SpatialReference.Wkid.ToString());
msg.Add("sic", _selectedSymbol.SymbolID);
msg.Add("uniquedesignation", "1");
// Construct the Control Points based on the geometry type of the drawn geometry.
switch (requestedShape)
{
case DrawShape.Point:
MapPoint point = geometry as MapPoint;
msg.Add("_control_points", point.X.ToString(CultureInfo.InvariantCulture) + "," + point.Y.ToString(CultureInfo.InvariantCulture));
break;
case DrawShape.Polygon:
Polygon polygon = geometry as Polygon;
string cpts = string.Empty;
foreach (var pt in polygon.Parts[0].GetPoints())
cpts += ";" + pt.X.ToString(CultureInfo.InvariantCulture) + "," + pt.Y.ToString(CultureInfo.InvariantCulture);
msg.Add("_control_points", cpts);
break;
case DrawShape.Polyline:
Polyline polyline = geometry as Polyline;
cpts = string.Empty;
foreach (var pt in polyline.Parts[0].GetPoints())
cpts += ";" + pt.X.ToString(CultureInfo.InvariantCulture) + "," + pt.Y.ToString(CultureInfo.InvariantCulture);
msg.Add("_control_points", cpts);
break;
}
// Process the message
if (!_messageLayer.ProcessMessage(msg))
MessageBox.Show("Failed to process message.");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Symbol Dictionary Search Sample");
}
}
开发者ID:jordanparfitt,项目名称:arcgis-runtime-samples-dotnet,代码行数:63,代码来源:SymbolDictionarySearchSample.xaml.cs