public ContainerListView() { this.InitializeComponent(); this.viewModel = new ContainerListViewModel(); this.DataContext = viewModel; }
public async Task <IList <ContainerListViewModel> > List(int limit, bool showAll) { var containerModels = new List <ContainerListViewModel>(); using (var client = this.dockerClientFactory.Create()) { var dockerContainers = await client.Containers.ListContainersAsync(new ContainersListParameters() { All = showAll, Limit = limit }); foreach (var container in dockerContainers) { var ipAddresses = FindNetworkIPAddress(container.NetworkSettings.Networks); var model = new ContainerListViewModel { ID = container.ID, Image = container.Image, Names = container.Names, Ports = container.Ports, State = container.State, IPAddresses = ipAddresses, }; containerModels.Add(model); } } return(containerModels); }