public DockerContainerItemDetailViewModel(SiteItem siteItem, DockerContainerItem dockerContainerItem) { Title = $"容器[{dockerContainerItem?.Name}] - {siteItem.Name}"; SiteItem = siteItem; DockerContainerItem = dockerContainerItem; RefreshCommand = new Command(async() => await ExecuteRefreshCommand()); StartCommand = new Command(async() => await ExecuteStartCommand()); StopCommand = new Command(async() => await ExecuteStopCommand()); RestartCommand = new Command(async() => await ExecuteRestartCommand()); }
public static async Task StopContainer(HttpClient client, SiteItem siteItem, DockerContainerItem dockerContainerItem) { var url = $"{siteItem.Url}/api/v1/Container/{dockerContainerItem.Id}/Stop"; var response = await client.PutAsync(url, null); try { response.EnsureSuccessStatusCode(); } catch (Exception ex) { var message = await response.Content.ReadAsStringAsync(); throw new ApplicationException(message, ex); } }
public DockerContainerItemDetailPage(SiteItem siteItem, DockerContainerItem dockerContainerItem) { InitializeComponent(); viewModel = new DockerContainerItemDetailViewModel(siteItem, dockerContainerItem); BindingContext = viewModel; }