コード例 #1
0
        /// <summary>
        /// Helper that provides the default <see cref="Terminal.Gui.Window"/> implementation with a frame and
        /// label showing the name of the <see cref="Scenario"/> and logic to exit back to
        /// the Scenario picker UI.
        /// Override <see cref="Init(Toplevel)"/> to provide any <see cref="Terminal.Gui.Toplevel"/> behavior needed.
        /// </summary>
        /// <param name="top">The Toplevel created by the UI Catalog host.</param>
        /// <param name="colorScheme">The colorscheme to use.</param>
        /// <remarks>
        /// <para>
        /// Thg base implementation calls <see cref="Application.Init"/>, sets <see cref="Top"/> to the passed in <see cref="Toplevel"/>, creates a <see cref="Window"/> for <see cref="Win"/> and adds it to <see cref="Top"/>.
        /// </para>
        /// <para>
        /// Overrides that do not call the base.<see cref="Run"/>, must call <see cref="Application.Init "/> before creating any views or calling other Terminal.Gui APIs.
        /// </para>
        /// </remarks>
        public virtual void Init(Toplevel top, ColorScheme colorScheme, SmartThingsClient smartThingsClient)
        {
            Application.Init();

            Top = top;
            if (Top == null)
            {
                Top = Application.Top;
            }

            Win = new Window($"CTRL-Q to Close - Scenario: {GetName()}")
            {
                X           = 0,
                Y           = 0,
                Width       = Dim.Fill(),
                Height      = Dim.Fill(),
                ColorScheme = colorScheme,
            };
            Top.Add(Win);

            STClient = smartThingsClient;
        }
コード例 #2
0
 public DeviceHelper(SmartThingsClient smartThingsClient, Device device)
 {
     this.smartThingsClient = smartThingsClient;
     this.device            = device;
 }