Exemplo n.º 1
0
 public AddElement()
 {
     this.InitializeComponent();
     /* Register the URL textbox with an on-screen keyboard control. Note that currently this
      * keyboard does not support inputting into browser controls 
      */
     SIP_AddressBar.RegisterEditControl(roomName);
     SIP_AddressBar.RegisterHost(this);
     h = Home.myHouse;
     DeviceSensors = new List<Sensor>();
     ListSource = App.ListSource;
     Rooms = App._listRooms;
     listrooms.DataContext = this.DataContext;
     FillListIcons();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Saves the current home configuration
        /// </summary>
        /// <param name="MyHome">Provide home object to be save for later use</param>
        public static async void SaveHome(House MyHome)
        {
            MemoryStream _MemoryStream = new MemoryStream();
            DataContractSerializer Serializer = new DataContractSerializer(typeof(House));
            Serializer.WriteObject(_MemoryStream, MyHome);

            StorageFile _File = await ApplicationData.Current.LocalFolder.CreateFileAsync("House.bin", CreationCollisionOption.ReplaceExisting);

            using (Stream fileStream = await _File.OpenStreamForWriteAsync())
            {
                _MemoryStream.Seek(0, SeekOrigin.Begin);
                await _MemoryStream.CopyToAsync(fileStream);
                await fileStream.FlushAsync();
                fileStream.Dispose();
            }
        }
Exemplo n.º 3
0
        private async void InitHouse()
        {
            //lista de rooms
            myHouse = await House.LoadHome();

            if (myHouse.isFirstTime)
            {
                //Adicionar Lista de Imagens de Sensores e Aposentos
                App.sensors.Add("Luz", "ms-appx:///Assets/Icons/bright-lightbulb Branco.png");
                App.sensors.Add("Tomada", "ms-appx:///Assets/Icons/electric-plug Branco.png");
                App.sensors.Add("Porta", "ms-appx:///Assets/Icons/Door Branco.png");
                App.sensors.Add("Computador", "ms-appx:///Assets/Icons/computer Branco.png");
                App.sensors.Add("Umidade", "ms-appx:///Assets/Icons/Humidity Branco.png");
                App.sensors.Add("Movimento", "ms-appx:///Assets/Icons/eye Branco.png");
                App.sensors.Add("Biometria", "ms-appx:///Assets/Icons/fingerprint Branco.png");
                App.sensors.Add("Fogo", "ms-appx:///Assets/Icons/fire Branco.png");
                App.sensors.Add("VideoGame", "ms-appx:///Assets/Icons/gamepad-controller Branco.png");
                App.sensors.Add("Telefone", "ms-appx:///Assets/Icons/old-typical-phone Branco.png");
                App.sensors.Add("Temperatura", "ms-appx:///Assets/Icons/Temperature Branco.png");
                App.sensors.Add("Ventilador", "ms-appx:///Assets/Icons/fan Branco.png");
                App.sensors.Add("Chuva", "ms-appx:///Assets/Icons/umbrella Branco.png");

                App.spaces.Add("Banheiro", "ms-appx:///Assets/Icons/toilet Branco.png");
                App.spaces.Add("Cozinha", "ms-appx:///Assets/Icons/restaurant-eating-tools Branco.png");
                App.spaces.Add("Suite Master", "ms-appx:///Assets/Icons/crown Branco.png");
                App.spaces.Add("Área de Serviço", "ms-appx:///Assets/Icons/wiping-swipe-for-floors Branco.png");
                App.spaces.Add("Sala de Jantar", "ms-appx:///Assets/Icons/table Branco.png");
                App.spaces.Add("Sala de Estar", "ms-appx:///Assets/Icons/books-stack-of-three Branco.png");
                App.spaces.Add("Quarto", "ms-appx:///Assets/Icons/bed Branco.png");
                App.spaces.Add("Quarto Crianças", "ms-appx:///Assets/Icons/baby-crib-bedroom-furniture Branco.png");
                App.spaces.Add("Varanda", "ms-appx:///Assets/Icons/Varanda Branco.png");
                App.spaces.Add("Escritório", "ms-appx:///Assets/Icons/computer Branco.png");

                //

                myHouse.Rooms.Clear();
                #region [ adicionando rooms na mao apenas a primeira vez]
                Room r2 = new Room();
                r2.Name = "Quarto Casal";
                r2.ImagePath = App.spaces["Suite Master"];
                myHouse.Rooms.Add(r2);

                Room r3 = new Room();
                r3.Name = "Quarto Crianças";
                r3.ImagePath = App.spaces["Quarto Crianças"];
                myHouse.Rooms.Add(r3);

                Room r4 = new Room();
                r4.Name = "Banheiro Casal";
                r4.ImagePath = App.spaces["Banheiro"];
                myHouse.Rooms.Add(r4);

                Room r5 = new Room();
                r5.Name = "Banheiro";
                r5.ImagePath = App.spaces["Banheiro"];
                myHouse.Rooms.Add(r5);

                Room r6 = new Room();
                r6.Name = "Cozinha";
                r6.ImagePath = App.spaces["Cozinha"];
                myHouse.Rooms.Add(r6);

                Room r7 = new Room();
                r7.Name = "Área de Serviço";
                r7.ImagePath = App.spaces["Área de Serviço"];
                myHouse.Rooms.Add(r7);

                Room r8 = new Room();
                r8.Name = "Sala de Jantar";
                r8.ImagePath = App.spaces["Sala de Jantar"];
                myHouse.Rooms.Add(r8);

                Room r9 = new Room();
                r9.Name = "Sala de Estar";
                r9.ImagePath = App.spaces["Sala de Estar"];
                myHouse.Rooms.Add(r9);

                Room r10 = new Room();
                r10.Name = "Escritório";
                r10.ImagePath = App.spaces["Escritório"];
                myHouse.Rooms.Add(r10);

                myHouse.isFirstTime = false;

                House.SaveHome(myHouse);
                #endregion
            }
            UpdateList();
        }
Exemplo n.º 4
0
        private void Processor_PointerMoved(object sender, TouchPanels.PointerEventArgs e)
        {
            WriteStatus(e, "Moved");
            if (currentScrollItem != null)
            {
                double dx = e.Position.X - lastPosition.X;
                double dy = e.Position.Y - lastPosition.Y;
                if (!currentScrollItem.HorizontallyScrollable) dx = 0;
                if (!currentScrollItem.VerticallyScrollable) dy = 0;

                Windows.UI.Xaml.Automation.ScrollAmount h = Windows.UI.Xaml.Automation.ScrollAmount.NoAmount;
                Windows.UI.Xaml.Automation.ScrollAmount v = Windows.UI.Xaml.Automation.ScrollAmount.NoAmount;
                if (dx < 0) h = Windows.UI.Xaml.Automation.ScrollAmount.SmallIncrement;
                else if (dx > 0) h = Windows.UI.Xaml.Automation.ScrollAmount.SmallDecrement;
                if (dy < 0) v = Windows.UI.Xaml.Automation.ScrollAmount.SmallIncrement;
                else if (dy > 0) v = Windows.UI.Xaml.Automation.ScrollAmount.SmallDecrement;
                currentScrollItem.Scroll(h, v);
            }
            lastPosition = e.Position;
        }