Esempio n. 1
0
 public HomeAutomationNetworkContext(RoomieEngine engine, ThreadPool threadPool, IDeviceHistory deviceHistory, INetworkHistory networkHistory)
 {
     _engine    = engine;
     ThreadPool = threadPool;
     //TODO: ninject?
     History  = new MasterHistory(deviceHistory, networkHistory);
     Triggers = new TriggerCollection();
 }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();
            _engine = new RoomieEngine();
            Events  = new ObservableCollection <RoomieEvent>();
            _engine.ScriptMessageSent  += engine_ScriptMessageSent;
            _engine.EngineStateChanged += _engine_EngineStateChanged;
            EventListing.ItemsSource    = Events;

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
        }
Esempio n. 3
0
        public WebHookEngine(RoomieEngine roomieController, string computerName, string apiBaseUrl, string accessKey, string encryptionKey)
        {
            this.roomieController = roomieController;
            this.computerName     = computerName;
            string threadPoolName = "Web Hook (to " + apiBaseUrl + ")";

            this.threadPool = roomieController.CreateThreadPool(threadPoolName);

            this.running = false;

            apiClient = new RoomieApiClient(apiBaseUrl, accessKey);
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            var engine = new RoomieEngine();

            setOutput(engine);
            //engine.TerminalMessageSent += new TerminalOutputEventHandler(controller_TerminalMessageSent);
            engine.Start();

            var line     = "";
            var input    = "";
            var xmlInput = new XmlDocument();

            //TODO: improve this.  Make the while loop directly depend on the engine's internal state.
            while (!input.Contains("Core.ShutDown"))
            {
                //TODO: pull reading from a text stream into Roomie.Desktop.Engine.RoomieEngine
                line = Console.ReadLine().Trim();
                if (!String.IsNullOrEmpty(line))
                {
                    if (input.Length > 0)
                    {
                        input += "\n";
                    }
                    input += line.TrimEnd('_');
                    //TODO: read multiple lines
                    if (!line.EndsWith("_"))
                    {
                        try
                        {
                            var script = ScriptCommandList.FromText(input);
                            engine.Threads.AddCommands(script);
                            Console.WriteLine("Command accepted.");
                            input = "";
                        }
                        catch (Exception exception)
                        {
                            Console.WriteLine("Error. " + exception.Message);
                        }
                    }
                }
                else
                {
                    if (input != "")
                    {
                        input = "";
                        Console.WriteLine("Input cleared.");
                    }
                }
            }
        }
Esempio n. 5
0
 protected override void OnStart(string[] args)
 {
     engine = new RoomieEngine();
     engine.Start();
 }
Esempio n. 6
0
 public SpeechResponder(RoomieEngine engine)
 {
     RegisteredCommands = new Dictionary <string, ScriptCommandList>();
     _speechRecognizer  = new NamedSpeechRecognizer(TimeSpan.FromSeconds(10), "Roomie");
     ThreadPool         = engine.CreateThreadPool("Speech Recognizer");
 }
Esempio n. 7
0
 static void setOutput(RoomieEngine engine)
 {
     var streamWriter = new RoomieEventTextStream(engine, Console.Out, new TimeSpan(hours: 0, minutes: 0, seconds: 30));
 }
Esempio n. 8
0
 public HomeAutomationNetworkContext(RoomieEngine engine, ThreadPool threadPool)
     : this(engine, threadPool, new DeviceHistory(), new NetworkHistory())
 {
 }