private void ConfigureCapabilityPane(CapabilitySummary selectedCapability) { _componentFrame = new FrameView() { X = 0, Y = 0, Height = Dim.Fill(), Width = Dim.Fill(), Title = $"Capability Details", ColorScheme = Colors.TopLevel }; _capabilityPresentationJsonView = new TextView() { Y = 0, X = 0, Width = Dim.Fill(), Height = Dim.Fill(), ReadOnly = true, ColorScheme = Colors.Dialog, }; GetCapabilityPresentation(selectedCapability); _componentFrame.Add(_capabilityPresentationJsonView); HostPane.Add(_componentFrame); _capabilityPresentationJsonView.SetFocus(); HostPane.ColorScheme = Colors.TopLevel; }
public override void UpdateSettings <T>(object selectedItem) { CapabilitySummary capability = (CapabilitySummary)selectedItem; SettingsPane.RemoveAll(); var labelId = new Label("Id:") { X = 0, Y = 0 }; SettingsPane.Add(labelId); var deviceId = new TextField($"{capability.Id}") { X = Pos.Right(labelId) + 1, Y = 0, Width = 40 }; deviceId.ColorScheme = Colors.Base; deviceId.ReadOnly = true; SettingsPane.Add(deviceId); var labelDeviceLabel = new Label("Status:") { X = 0, Y = 1 }; SettingsPane.Add(labelDeviceLabel); var deviceLabel = new TextField($"{capability?.Status}") { X = Pos.Right(labelDeviceLabel) + 1, Y = 1, Width = 40 }; deviceLabel.ColorScheme = Colors.Base; deviceLabel.ReadOnly = true; SettingsPane.Add(deviceLabel); var labelType = new Label("Version:") { X = 0, Y = 2 }; SettingsPane.Add(labelType); var deviceType = new TextField($"{capability._Version}") { X = Pos.Right(labelType) + 1, Y = 2, Width = 40 }; deviceType.ColorScheme = Colors.Base; deviceType.ReadOnly = true; SettingsPane.Add(deviceType); }
/// <summary> /// Returns a <see cref="CapabilitySummary"/> collection containing a summary for every capability that a launcher contains. /// </summary> /// <param name="launcher">The <see cref="Launcher"/> to analyze.</param> public IEnumerable <CapabilitySummary> GetASummaryForAllCapabilities(Launcher launcher) { var capabilitySummaries = new List <CapabilitySummary>(); foreach (var capability in launcher.Capabilities) { var orbitType = capability.Trajectory.OrbitType; var lightest = capability.PayloadRange.Lightest; var heaviest = capability.PayloadRange.Heaviest; var summary = new CapabilitySummary(orbitType, new PayloadRange(lightest, heaviest)); capabilitySummaries.Add(summary); } return(capabilitySummaries); }
private void GetCapabilityPresentation(CapabilitySummary selectedCapability) { try { var capbility = STClient.GetCapability(selectedCapability.Id, selectedCapability.Version); if (capbility != null) { _capabilityPresentationJsonView.Text = FormatJson(capbility.ToJson()); } } catch (SmartThingsNet.Client.ApiException exp) { _capabilityPresentationJsonView.Text = $"Error: {exp.ErrorCode}"; } catch (Exception exp) { ShowErrorMessage($"Error {exp.Message}"); } }
private void ToggleCapability() { if (SelectedItem != null) { if (_componentFrame != null) { HostPane.Remove(_componentFrame); HostPane.Remove(_componentList); HostPane.Remove(_capabilityPresentationJsonView); _componentFrame = null; _componentList = null; _capabilityPresentationJsonView = null; ClassListView.SetFocus(); } else { CapabilitySummary selectedCapability = (CapabilitySummary)SelectedItem; ConfigureCapabilityPane(selectedCapability); } } }