예제 #1
0
        public MainPage()
        {
            this.InitializeComponent();

            webCam = WebCam.Create();
            webCam.StartLiveStreamAsync(liveStreamElement);  // display camera's live stream in UI
            imgurClient = new ImgurApi();

            keypad = new KeyPad();
            Debug.WriteLine("keypad created");
            keypad.OnPress += UpdateApartmentTextBoxAsync;  // UI
            keypad.OnRing  += HandleVisitorAsync;
            keypad.OnReset += ResetApartmentTextBoxAsync;   // UI

            doorLock = DoorLock.Create();

            httpClient   = new HttpClient();
            baseUri      = "https://prod-07.northeurope.logic.azure.com:443/workflows/b6551691604a461db4a0c06801cf0df3/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=xcu2NJIVZXpy-AxTEP3tkk-Gei_P08uoyOP-hpr7RNc";
            httpResponse = new HttpResponseMessage();

            deviceClient = DeviceClient.Create(iotHubUri, new DeviceAuthenticationWithRegistrySymmetricKey(deviceId, deviceKey), TransportType.Mqtt);

            // wait for a visitor to enter an apartment number
            Task a = Task.Run(() => {
                while (true)
                {
                    resetEvent.Reset();
                    keypad.GetAparmentNumber();
                    resetEvent.WaitOne();
                }
            }
                              );
        }
예제 #2
0
        public MainPage()
        {
            this.InitializeComponent();
            webCam = WebCam.Create();
            webCam.StartLiveStreamAsync(liveStreamElement);  // display camera's live stream in UI

            keypad          = new KeyPad();
            keypad.OnPress += UpdateApartmentTextBoxAsync;  // UI
            keypad.OnRing  += HandleVisitorAsync;
            keypad.OnReset += ResetApartmentTextBoxAsync;   // UI

            doorLock = DoorLock.Create();

            httpClient   = new HttpClient();
            baseUri      = "https://intellidoorfunctionapp.azurewebsites.net/api/open?code=pZcJ7JYaB/mUL873qU4ge8AFTPhZvr0ZJ2vTrIrXQdTI3WOD7zBQ5A==";
            httpResponse = new HttpResponseMessage();

            // wait for a visitor to enter an apartment number
            Task a = Task.Run(() => {
                while (true)
                {
                    resetEvent.Reset();
                    keypad.GetAparmentNumber();
                    resetEvent.WaitOne();
                }
            }
                              );
        }