Ejemplo n.º 1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string str = OptionTxt.readTxt("C:\\clean.txt");

            OptionTxt.writeTxt(str);

            MessageBox.Show("清空完成");
        }
        public InformationInput()
        {
            InitializeComponent();
            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            list  = Analysain.FromJson(OptionTxt.readTxt("C:\\DATA.txt"));
            list2 = Analysain.FromJson(OptionTxt.readTxt("C:\\2.txt"));
            controller.Completed += qSerialPort_Completed;
        }
Ejemplo n.º 3
0
        public static StackPanel getView(string type, double waterHeater, double heating)
        {
            //double all = bulb_1 + bulb_2 + ac + waterHeater + 6.5 ;
            stackPanl = new StackPanel();
            setWH();
            setHeader();
            List <FoodMessage> list = Analysain.FromJson(OptionTxt.readTxt("C:\\2.txt"));

            // List<FoodMessage> list = new List<FoodMessage>();
            foreach (FoodMessage lists in list)
            {
                if (lists.foodType.Equals(type))
                {
                    setViewContent(lists.foodName, lists.foodNumber);
                }
                if (type.Equals("all") && !lists.foodName.Equals("00"))
                {
                    setViewContent(lists.foodName, lists.foodNumber);
                }
                if (type.Equals("over"))
                {
                    int x = MainWindow.futureDay - DateTime.Now.Day + (MainWindow.futureMonth - DateTime.Now.Month) * 30;
                    // MessageBox.Show(x.ToString());
                    if (x - lists.day <= 0 && !lists.foodName.Equals("00"))
                    {
                        // MessageBox.Show("OK");
                        setViewContent(lists.foodName, lists.foodNumber);
                        updateCloud(lists.foodName, lists.foodType);
                    }
                }
            }

            /*setViewContent("电灯Ⅰ", bulb_1);
             * setViewContent("电灯 Ⅱ", bulb_2);
             * setViewContent("空调", ac);
             * setViewContent("热水器", waterHeater);
             * setViewContent("电热水壶", 6.5); */
            // setEnd(all);

            // setPrice(all);
            return(stackPanl);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 设置暖气温度
        /// </summary>
        /// <param name="data"></param>
        public void dealWith(int temp)
        {
            List <FoodMessage> list2 = Analysain.FromJson(OptionTxt.readTxt("C:\\2.txt"));

            foreach (FoodMessage lists in list2)
            {
                if ((Int32.Parse(lists.foodNumber) >= temp))
                {
                    if ((Int32.Parse(lists.foodNumber) - temp <= 10) && !lists.foodName.Equals("00"))
                    {
                        MessageBox.Show(lists.foodName);
                        //jude(lists.foodName);
                        list2.Remove(lists);
                        deleteCloud(lists.foodName, lists.foodType);
                        jude(lists.foodName);
                        string str = JsonConvert.SerializeObject(list2);
                        OptionTxt.writeTxt(str);
                        break;
                    }
                }
                else
                {
                    if (Int32.Parse(lists.foodNumber) - temp >= -10 && !lists.foodName.Equals("00"))
                    {
                        MessageBox.Show(lists.foodName);
                        list2.Remove(lists);
                        deleteCloud(lists.foodName, lists.foodType);
                        jude(lists.foodName);
                        string str = JsonConvert.SerializeObject(list2);
                        OptionTxt.writeTxt(str);
                        break;
                    }
                }

                //  x++;
            }
        }