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 virtual void DisplayErrorView() { if (ErrorView != null) { HostPane.Add(ErrorView); } }
public virtual View CreateJsonView(string json) { var view = new TextView() { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill() }; string formattedJson = json.Replace("\r", ""); view.Text = ustring.Make(formattedJson); view.ReadOnly = true; // Set the colorscheme to make it stand out view.ColorScheme = Colors.Dialog; // Add HostPane.Add(view); HostPane.LayoutSubviews(); HostPane.Clear(); HostPane.SetNeedsDisplay(); HostPane.Title = "Raw Data"; return(view); }
public virtual void ClearClass(View view) { // Remove existing class, if any if (view != null) { HostPane.Remove(view); HostPane.Clear(); } }
public override void Setup() { ConfigureLeftPane(GetName()); ConfigureSettingsPane(); Dictionary <string, dynamic> dataItemList = null; Dictionary <string, string> displayItemList = null; try { if (STClient.GetAllCapabilities().Items?.Count > 0) { dataItemList = STClient.GetAllCapabilities().Items .OrderBy(t => t.Id) .Select(t => new KeyValuePair <string, dynamic>(t.Id, t)) .ToDictionary(t => t.Key, t => t.Value); displayItemList = STClient.GetAllCapabilities().Items .OrderBy(o => o.Id) .Select(t => new KeyValuePair <string, string>(t.Id, t.Id)) .ToDictionary(t => t.Key, t => t.Value); } } catch (SmartThingsNet.Client.ApiException exp) { ShowErrorMessage($"Error {exp.ErrorCode}{Environment.NewLine}{exp.Message}"); } catch (Exception exp) { ShowErrorMessage($"Error {exp.Message}"); } ConfigureWindows <CapabilitySummary>(displayItemList, dataItemList, false, false); if (ClassListView != null) { ClassListView.Enter += (args) => { if (_componentFrame != null) { HostPane.Remove(_componentFrame); _componentFrame = null; } if (_componentList != null) { HostPane.Remove(_componentList); _componentList = null; } if (_capabilityPresentationJsonView != null) { HostPane.Remove(_capabilityPresentationJsonView); _capabilityPresentationJsonView = null; } }; } }
public virtual void RefreshScreen() { ErrorView = null; STClient.ResetData(); Top.Clear(); HostPane.Clear(); ClassListView.Clear(); LeftPane.Clear(); SettingsPane.Clear(); Setup(); Application.Refresh(); }
public void ConfigureJsonPane() { JsonView = new TextView() { X = 0, Y = 0, Width = Dim.Fill(), Height = Dim.Fill(), }; JsonView.ReadOnly = true; // Set the colorscheme to make it stand out JsonView.ColorScheme = Colors.Dialog; HostPane.Add(JsonView); }
private void ConfigureComponentsStatusPane(Device selectedDevice) { _componentFrame = new FrameView() { X = 0, Y = 0, Height = Dim.Fill(), Width = Dim.Fill(), Title = "main", ColorScheme = Colors.TopLevel }; _componentList = new ListView(selectedDevice.Components.FirstOrDefault().Capabilities.Select(c => c.Id).ToList()); _componentList.X = 0; _componentList.Y = 0; _componentList.Width = Dim.Percent(30); _componentList.Height = Dim.Fill(); _componentList.AllowsMarking = false; _componentList.ColorScheme = Colors.TopLevel; _componentList.SelectedItemChanged += (args) => { _selectedCapabilityIndex = args.Item; GetComponentStatus(selectedDevice, args.Item); }; _capabilitiesStatusJsonView = new TextView() { Y = 0, X = Pos.Right(_componentList), Width = Dim.Fill(), Height = Dim.Fill(), ReadOnly = true, ColorScheme = Colors.Dialog, }; _componentFrame.Add(_componentList, _capabilitiesStatusJsonView); HostPane.Add(_componentFrame); _componentList.SetFocus(); GetComponentStatus(selectedDevice, 0); HostPane.ColorScheme = Colors.TopLevel; }
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); } } }
private void ToggleComponentStatus() { if (SelectedItem != null) { if (_componentFrame != null) { HostPane.Remove(_componentFrame); HostPane.Remove(_componentList); HostPane.Remove(_capabilitiesStatusJsonView); _componentFrame = null; _componentList = null; _capabilitiesStatusJsonView = null; ClassListView.SetFocus(); } else { Device selectedDevice = (Device)SelectedItem; ConfigureComponentsStatusPane(selectedDevice); } } }