我正在尝试获取隐式关联(在子网和route_tables之间),但是根据本文档api describe route tables,似乎只返回了显式关联。还有另一种查询和获取此信息的方法。
对于给定的subnet_id,我也需要显式和隐式关联。
到目前为止,我一直在使用class MainWindowVm
{
public MainWindowVm()
{
Game = new GameVm(20, 20);
}
public GameVm Game { get; }
}
class GameVm : ViewModel
{
public GameVm(int width, int height)
{
Width = width;
Height = height;
Entities = new ObservableCollection<GameEntity>();
Entities.Add(new SnakeHead() { X = 20, Y = 20 });
Entities.Add(new SnakeBody() { X = 30, Y = 20 });
Entities.Add(new SnakeBody() { X = 40, Y = 20 });
Entities.Add(new SnakeTail() { X = 40, Y = 30 });
Entities.Add(new Food() { X = 0, Y = 0 });
Entities.Add(new Food() { X = 60, Y = 20 });
Entities.Add(new Food() { X = 50, Y = 50 });
Entities.Add(new Food() { X = 10, Y = 80 });
}
public ObservableCollection<GameEntity> Entities { get; }
private int _width;
public int Width
{
get => _width;
set => SetValue(ref _width, value);
}
private int _height;
public int Height
{
get => _height;
set => SetValue(ref _height, value);
}
}
abstract class GameEntity : ViewModel
{
private int _x;
public int X
{
get => _x;
set => SetValue(ref _x, value);
}
private int _y;
public int Y
{
get => _y;
set => SetValue(ref _y, value);
}
}
abstract class SnakeSegment : GameEntity { }
class SnakeBody : SnakeSegment { }
class SnakeHead : SnakeSegment { }
class SnakeTail : SnakeSegment { }
class Food : GameEntity { }
和<Window x:Class="Snake.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Snake"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.DataContext>
<local:MainWindowVm />
</Window.DataContext>
<ItemsControl ItemsSource="{Binding Path=Game.Entities}">
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type local:SnakeHead}">
<TextBlock Text="%" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:SnakeBody}">
<TextBlock Text="#" />
</DataTemplate>
<DataTemplate DataType="{x:Type local:SnakeTail}">
<TextBlock Text="." />
</DataTemplate>
<DataTemplate DataType="{x:Type local:Food}">
<TextBlock Text="O" />
</DataTemplate>
</ItemsControl.Resources>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="Canvas.Top" Value="{Binding Path=X}" />
<Setter Property="Canvas.Left" Value="{Binding Path=Y}" />
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
</Window>
,但是这些都没有提供“链/路径”给我。
答案 0 :(得分:0)
我发现,如果没有显式路由关联,它将隐式采用主路由。因此,对于这种情况:
[vpc]->[route table]->[igw|natgw]