Пример #1
0
 public virtual void ClearClass(View view)
 {
     // Remove existing class, if any
     if (view != null)
     {
         HostPane.Remove(view);
         HostPane.Clear();
     }
 }
Пример #2
0
        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;
                    }
                };
            }
        }
Пример #3
0
 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);
         }
     }
 }
Пример #4
0
 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);
         }
     }
 }