Ejemplo n.º 1
0
        public void AddProjects()
        {
            var temp = new Temp1();

            temp.projectId = projectId;
            NavigationService.Navigate(typeof(Views.ProjectManagement.AddProjects), temp);
        }
Ejemplo n.º 2
0
 public void ClickItemList(object sender, ItemClickEventArgs e)
 {
     if (e.ClickedItem != null)
     {
         var obj = new Temp1();
         obj.task = ((Tasks)e.ClickedItem);
         NavigationService.Navigate(typeof(Views.ProjectManagement.AddTask), obj);
     }
 }
        public string GetValue(string selectedSetting)
        {
            FridgeSettings setting = (FridgeSettings)Enum.Parse(typeof(FridgeSettings), selectedSetting, true);

            switch (setting)
            {
            case FridgeSettings.Temp1:
                return(Temp1.ToString());

            case FridgeSettings.Temp2:
                return(Temp2.ToString());

            default:
                return("");
            }
        }
Ejemplo n.º 4
0
        private void loadLists()
        {
            ObservableCollection <Temp2> tColl = new ObservableCollection <Temp2>();
            Temp1 t1 = new Temp1();

            t1.Text1 = "DataContext1";
            t1.Text2 = "DataContext2";
            tColl.Add(new Temp2()
            {
                Image = "", Data = "Item1"
            });
            tColl.Add(new Temp2()
            {
                Image = "", Data = "Item2"
            });
            DataContextStack.DataContext = t1;
            lst2.ItemsSource             = tColl;
        }
        public string GetValue(string selectedSetting)
        {
            CookerSettings setting = (CookerSettings)Enum.Parse(typeof(CookerSettings), selectedSetting, true);

            switch (setting)
            {
            case CookerSettings.Temp1:
                return(Temp1.ToString());

            case CookerSettings.Temp2:
                return(Temp2.ToString());

            case CookerSettings.Temp3:
                return(Temp3.ToString());

            case CookerSettings.Temp4:
                return(Temp4.ToString());

            default:
                return("");
            }
        }
Ejemplo n.º 6
0
        private void ParsingData(string rxData)
        {
            int    Temp1, Temp2;
            string nodeID      = "";
            string groupID     = "";
            string command     = "";
            string temperature = "";
            string humidity    = "";
            string co2         = "";
            string movement    = "";
            string datalength  = "";
            string device      = "";

            DateTime t      = DateTime.Now;
            string   format = "yyyy-MM-dd HH:mm:ss";

            try {
                nodeID     = rxData.Substring(5, 4);
                groupID    = rxData.Substring(10, 4);
                datalength = rxData.Substring(15, 2);
                device     = rxData.Substring(17, 2);
                command    = rxData.Substring(19, 2);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            if (device == "11") // Device Check
            {
                if (command == "10" || command == "11")
                {
                    // 설정 정보 요청/변경 || 설정 정보 응답
                    if (datalength == "07") // Length Check
                    {
                    }
                    else
                    {
                        Console.WriteLine("Setting Info Data ERROR!!");
                    }
                }

                else if (command == "21")
                {
                    // 센서 정보 응답
                    if (datalength == "0A") // Length Check
                    {
                        // Temperature
                        Temp1       = Convert.ToInt32(rxData.Substring(21, 2), 16);
                        Temp2       = Convert.ToInt32(rxData.Substring(23, 2), 16);
                        temperature = Temp1.ToString() + "." + Temp2.ToString();

                        // Humidity Setting
                        Temp1    = Convert.ToInt32(rxData.Substring(25, 2), 16);
                        Temp2    = Convert.ToInt32(rxData.Substring(27, 2), 16);
                        humidity = Temp1.ToString() + "." + Temp2.ToString();

                        // CO2 Setting
                        Temp1 = Convert.ToInt32(rxData.Substring(29, 4), 16);
                        co2   = Temp1.ToString();

                        // Movement Setting
                        movement = rxData.Substring(33, 2);

                        /*
                         * if (rxData.Substring(33, 2) == "01")
                         * {
                         *  movement = "Motion Detected";
                         * }
                         * else
                         * {
                         *  movement = "No Motion Detected";
                         * }*/

                        // DataBase Insert
                        insertData(t.ToString(format), nodeID, groupID, temperature, humidity, co2, movement);
                    }

                    else
                    {
                        Console.WriteLine("Sensor Info Data ERROR!!");
                    }
                }

                else if (command == "31")
                {
                    // 움직임 정보 푸시
                    if (datalength == "04") // Length Check
                    {
                        if (rxData.Substring(21, 2) == "00")
                        {
                            Console.WriteLine("No Motion Detected");
                        }
                        else
                        {
                            Console.WriteLine("Motion Detected");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Movement Info Data ERROR!!");
                    }
                }

                else if (command == "E0")
                {
                    // 리포트 설정
                    if (datalength == "08") // Length Check
                    {
                    }
                    else
                    {
                        Console.WriteLine("Report Info Data ERROR!!");
                    }
                }
            }
        }
Ejemplo n.º 7
0
    void Update()
    {
        //basic shot
        if (canshootint >= 1F)
        {
            canshootbool = true;
        }
        canshootint += Time.deltaTime;

        //mode change
        if (Input.GetKeyDown(KeyCode.J))
        {
            if (mode != 0)
            {
                mode--;
            }
        }
        if (Input.GetKeyDown(KeyCode.K))
        {
            if (mode != 2)
            {
                mode++;
            }
        }
        type.text = types[mode];

        // type 0
        if (Input.GetKeyDown(KeyCode.U) && canshootbool)
        {
            if (mode == 0)
            {
                //create hte bullet object
                GameObject Temp;
                //make it in the scene
                Temp = Instantiate(Bullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
                //rotate for simple fire
                Temp.transform.Rotate(Vector3.left * 90);
                //give it a rigid body
                Rigidbody TempBody;
                //"push" it so it goes, no gravity
                TempBody = Temp.GetComponent <Rigidbody>();
                TempBody.AddForce(transform.forward * Force);
                Destroy(Temp, 1.0f);
            }
            if (mode == 1)
            {
                //create hte bullet object
                GameObject Temp1;
                //make it in the scene
                Temp1 = Instantiate(FBullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
                //rotate for simple fire
                Temp1.transform.Rotate(Vector3.left * 90);
                //give it a rigid body
                Rigidbody TempBody;
                //"push" it so it goes, no gravity
                TempBody = Temp1.GetComponent <Rigidbody>();
                TempBody.AddForce(transform.forward * Force);
                Destroy(Temp1, 1.0f);
            }
            if (mode == 2)
            {
                //create hte bullet object
                GameObject Temp;
                //make it in the scene
                Temp = Instantiate(BBullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
                //rotate for simple fire
                Temp.transform.Rotate(Vector3.left * 90);
                //give it a rigid body
                Rigidbody TempBody;
                //"push" it so it goes, no gravity
                TempBody = Temp.GetComponent <Rigidbody>();
                TempBody.AddForce(transform.forward * Force);
                Destroy(Temp, 1.0f);
            }

            canshootbool = false;
            canshootint  = 0F;
        }
        //Fast and long range
        if (Input.GetKeyDown(KeyCode.I) && canshootbool)
        {
            if (mode == 0)
            {
                //create hte bullet object
                GameObject Temp;
                //make it in the scene
                Temp = Instantiate(Bullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
                //rotate for simple fire
                Temp.transform.Rotate(Vector3.left * 90);
                //give it a rigid body
                Rigidbody TempBody;
                //"push" it so it goes, no gravity
                TempBody = Temp.GetComponent <Rigidbody>();
                TempBody.AddForce(transform.forward * Force * 3);
                Destroy(Temp, 1.0f);
            }
            if (mode == 1)
            {
                //create hte bullet object
                GameObject Temp;
                //make it in the scene
                Temp = Instantiate(FBullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
                //rotate for simple fire
                Temp.transform.Rotate(Vector3.left * 90);
                //give it a rigid body
                Rigidbody TempBody;
                //"push" it so it goes, no gravity
                TempBody = Temp.GetComponent <Rigidbody>();
                TempBody.AddForce(transform.forward * Force * 3);
                Destroy(Temp, 1.0f);
            }
            if (mode == 2)
            {
                //create hte bullet object
                GameObject Temp;
                //make it in the scene
                Temp = Instantiate(BBullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
                //rotate for simple fire
                Temp.transform.Rotate(Vector3.left * 90);
                //give it a rigid body
                Rigidbody TempBody;
                //"push" it so it goes, no gravity
                TempBody = Temp.GetComponent <Rigidbody>();
                TempBody.AddForce(transform.forward * Force * 3);
                Destroy(Temp, 1.0f);
            }

            canshootbool = false;
            canshootint  = 0F;
        }
        //shotgun
        if (Input.GetKeyDown(KeyCode.O) && canshootbool)
        {
            if (mode == 0)
            {
                int        x = 0;
                GameObject Temp;
                for (; x < 3; x++)
                {
                    //make it in the scene
                    Temp = Instantiate(Bullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
                    //rotate for simple fire
                    Temp.transform.Rotate(Vector3.left * (60 + (30 * x)));
                    //give it a rigid body
                    Rigidbody TempBody;
                    //"push" it so it goes, no gravity
                    TempBody = Temp.GetComponent <Rigidbody>();
                    TempBody.AddForce(transform.forward * Force);
                    Destroy(Temp, .3f);

                    canshootbool = false;
                    canshootint  = 0F;
                }
                x = 0;
            }
            if (mode == 1)
            {
                int        x = 0;
                GameObject Temp;
                for (; x < 3; x++)
                {
                    //make it in the scene
                    Temp = Instantiate(FBullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
                    //rotate for simple fire
                    Temp.transform.Rotate(Vector3.left * (60 + (30 * x)));
                    //give it a rigid body
                    Rigidbody TempBody;
                    //"push" it so it goes, no gravity
                    TempBody = Temp.GetComponent <Rigidbody>();
                    TempBody.AddForce(transform.forward * Force);
                    Destroy(Temp, .3f);

                    canshootbool = false;
                    canshootint  = 0F;
                }
                x = 0;
            }
            if (mode == 2)
            {
                int        x = 0;
                GameObject Temp;
                for (; x < 3; x++)
                {
                    //make it in the scene
                    Temp = Instantiate(BBullet, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
                    //rotate for simple fire
                    Temp.transform.Rotate(Vector3.left * (60 + (30 * x)));
                    //give it a rigid body
                    Rigidbody TempBody;
                    //"push" it so it goes, no gravity
                    TempBody = Temp.GetComponent <Rigidbody>();
                    TempBody.AddForce(transform.forward * Force);
                    Destroy(Temp, .3f);

                    canshootbool = false;
                    canshootint  = 0F;
                }
                x = 0;
            }
        }

        //circle

        /*
         * if (Input.GetKeyDown(KeyCode.P) && canshootbool)
         * {
         *  //create hte bullet object
         *  GameObject Temp;
         *  //make it in the scene
         *  //Temp = Instantiate(Big, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject;
         *  //rotate for simple fire
         *  Temp.transform.Rotate(Vector3.left * 90);
         *  //give it a rigid body
         *  Rigidbody TempBody;
         *  //"push" it so it goes, no gravity
         *  TempBody = Temp.GetComponent<Rigidbody>();
         *  TempBody.AddForce(transform.forward * Force);
         *  Destroy(Temp, 10.0f);
         *
         *  canshootbool = false;
         *  canshootint = 0F;
         * }*/
    }