예제 #1
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            var options    = new ControllerOptions();
            var controller = new Core.Controller(options);

            controller.RunAsync(taskInstance);
        }
예제 #2
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            var hostname = global::System.Net.Dns.GetHostName();

            Type configurationType;

            if (hostname == "HA4IoT-Main")
            {
                configurationType = typeof(Main.Configuration);
            }
            else if (hostname == "HA4IoT-Cellar")
            {
                configurationType = typeof(Cellar.Configuration);
            }
            else
            {
                return;
            }

            var options = new ControllerOptions
            {
                ConfigurationType = configurationType
            };

            var controller = new Core.Controller(options);

            controller.RunAsync(taskInstance);
        }
예제 #3
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            var options = new ControllerOptions
            {
                StatusLedNumber = LedGpio
            };

            var controller = new Core.Controller(options);
            controller.RunAsync(taskInstance);
        }
예제 #4
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            var options = new ControllerOptions
            {
                StatusLedNumber = LedGpio
            };

            var controller = new Core.Controller(options);

            controller.RunAsync(taskInstance);
        }
예제 #5
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            var options = new ControllerOptions
            {
                StatusLedGpio     = 22, // Replace this with a port which contains a LED for status indication (optional).
                ConfigurationType = typeof(Configuration)
            };

            var controller = new Core.Controller(options);

            controller.RunAsync(taskInstance);
        }
예제 #6
0
        public void Run(IBackgroundTaskInstance taskInstance)
        {
            //var configurationType = typeof(Cellar.Configuration);
            var configurationType = typeof(Main.Configuration);

            var options = new ControllerOptions
            {
                StatusLedGpio     = 22,
                ConfigurationType = configurationType
            };

            var controller = new Core.Controller(options);

            controller.RunAsync(taskInstance);
        }
예제 #7
0
 static void Main(string[] args)
 {
     var options = new Options();
     if (CommandLineParser.Default.ParseArguments(args, options))
     {
         var webClient = new Core.WebClient();
         var controller = new Core.Controller(webClient, new Uri("https://" + options.Host));
         switch (options.Command)
         {
             case Command.GetPowerState:
                 System.Console.WriteLine("PowerStatus: " + controller.GetPowerState());
                 break;
             case Command.PowerOn:
                 controller.PowerOn();
                 break;
         }
     }
 }
예제 #8
0
        public MainPage()
        {
            InitializeComponent();

            Log.Instance = new TextBoxLogger(LogTextBox);

            var options = new ControllerOptions
            {
                ConfigurationType = typeof(Initializer),
                ContainerConfigurator = new ContainerConfigurator(this),
                HttpServerPort = 1025
            };

            _controller = new Core.Controller(options);
            
            // The app is only available from other machines. https://msdn.microsoft.com/en-us/library/windows/apps/Hh780593.aspx
            StoragePathTextBox.Text = StoragePath.Root;
            AppPathTextBox.Text = StoragePath.AppRoot;
        }
예제 #9
0
        public MainPage()
        {
            InitializeComponent();

            Log.Instance = new TextBoxLogger(LogTextBox);

            var options = new ControllerOptions
            {
                ConfigurationType     = typeof(Initializer),
                ContainerConfigurator = new ContainerConfigurator(this),
                HttpServerPort        = 1025
            };

            _controller = new Core.Controller(options);

            // The app is only available from other machines. https://msdn.microsoft.com/en-us/library/windows/apps/Hh780593.aspx
            StoragePathTextBox.Text = StoragePath.Root;
            AppPathTextBox.Text     = StoragePath.AppRoot;
        }
예제 #10
0
        static void Main(string[] args)
        {
            var options = new Options();

            if (CommandLineParser.Default.ParseArguments(args, options))
            {
                var webClient  = new Core.WebClient();
                var controller = new Core.Controller(webClient, new Uri("https://" + options.Host));
                switch (options.Command)
                {
                case Command.GetPowerState:
                    System.Console.WriteLine("PowerStatus: " + controller.GetPowerState());
                    break;

                case Command.PowerOn:
                    controller.PowerOn();
                    break;
                }
            }
        }
예제 #11
0
        public MainPage()
        {
            InitializeComponent();

            Log.LogEntryPublished += (s, e) =>
            {
                string message =
                    $"[{e.LogEntry.Id}] [{e.LogEntry.Timestamp}] [{e.LogEntry.Source}] [{e.LogEntry.ThreadId}] [{e.LogEntry.Severity}]: {e.LogEntry.Message}";
                if (!string.IsNullOrEmpty(e.LogEntry.Exception))
                {
                    message += Environment.NewLine;
                    message += e.LogEntry.Exception;
                }

                LogTextBox.Dispatcher.RunAsync(
                    CoreDispatcherPriority.Normal,
                    () =>
                {
                    LogTextBox.Text += message + Environment.NewLine;
                }).AsTask().Wait();
            };

            var options = new ControllerOptions
            {
                ConfigurationType     = typeof(Configuration),
                ContainerConfigurator = new ContainerConfigurator(this),
                HttpServerPort        = 1025
            };

            var controller = new Core.Controller(options);

            // The app is only available from other machines. https://msdn.microsoft.com/en-us/library/windows/apps/Hh780593.aspx
            StoragePathTextBox.Text       = StoragePath.StorageRoot;
            AppPathTextBox.Text           = StoragePath.AppRoot;
            ManagementAppPathTextBox.Text = StoragePath.ManagementAppRoot;

            controller.RunAsync();
        }