Ejemplo n.º 1
0
        private void listBox4_MouseClick(object sender, MouseEventArgs e)
        {
            if (listBox4.SelectedIndex > -1)
            {
                Konke.PluginInfo pi = listBox4.SelectedItem as Konke.PluginInfo;
                if (pi != null)
                {
                    switch (pi.module)
                    {
                    case Konke.PluginType.tp_module:
                        textBox3.Text = GetEnviromentInfo(pi);
                        break;

                    case Konke.PluginType.ir_module:
                    case Konke.PluginType.rf_module:
                        List <Konke.IRemoter> irs = control.GetIRemoters(control.UserID);
                        StringBuilder         sb  = new StringBuilder();
                        foreach (Konke.IRemoter ir in irs)
                        {
                            if (ir is Konke.ACRemoter)
                            {
                                Konke.ACRemoter ar = ir as Konke.ACRemoter;
                                string          s  = GetACRemoterInfo(ar);
                                if (sb.Length == 0)
                                {
                                    sb.Append(s);
                                }
                                else
                                {
                                    sb.Append(Environment.NewLine + s);
                                }
                            }
                            else
                            {
                                Konke.Remoter r = ir as Konke.Remoter;
                                string        s = GetRemoterInfo(r);
                                if (sb.Length == 0)
                                {
                                    sb.Append(s);
                                }
                                else
                                {
                                    sb.Append(Environment.NewLine + s);
                                }
                            }
                        }
                        textBox3.Text = sb.ToString();
                        break;

                    case Konke.PluginType.rt_module:
                        textBox3.Text = GetLatestHumanInfo(pi.kid);
                        break;

                    case Konke.PluginType.vd_module:
                    case Konke.PluginType.yg_module:
                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private string GetACRemoterInfo(Konke.ACRemoter r)
 {
     if (!string.IsNullOrEmpty(r.baseOrder))
     {
         return(r.baseOrder + ":" + r.range);
     }
     return("");
 }
Ejemplo n.º 3
0
 private void ControlACRemoter(string order)
 {
     if (order == "")
     {
         MessageBox.Show("请输入控制命令!");
         textBox4.Focus();
         textBox4.SelectAll();
         return;
     }
     //string userid;
     //string kid;
     //if (listBox1.SelectedIndex > -1)
     //{
     //    Konke.MiniK device = listBox1.SelectedItem as Konke.MiniK;
     //    if (device != null)
     //    {
     //        userid = device.user_id;
     //        kid = device.kid;
     //    }
     //}
     //else
     //{
     //    MessageBox.Show("请选定一个设备!");
     //    listBox1.Focus();
     //    return;
     //}
     if (listBox3.SelectedIndex > -1)
     {
         Konke.ACRemoter r = listBox3.SelectedItem as Konke.ACRemoter;
         if (r != null)
         {
             Konke.ACState state = Konke.ACState.FromString(order);
             if (control.ACRemote(r.userid, r.kid, r.rt, r.baseOrder, state))
             {
                 MessageBox.Show("控制成功!");
             }
             else
             {
                 MessageBox.Show("控制失败!");
             }
         }
         else
         {
             MessageBox.Show("请选择一个空调遥控器!");
         }
     }
     else
     {
         MessageBox.Show("请选择一个遥控器!");
     }
 }
Ejemplo n.º 4
0
 private void listBox3_MouseClick(object sender, MouseEventArgs e)
 {
     if (listBox3.SelectedIndex > -1)
     {
         Konke.IRemoter r = listBox3.SelectedItem as Konke.IRemoter;
         if (r != null)
         {
             if (r is Konke.ACRemoter)
             {
                 Konke.ACRemoter acr = r as Konke.ACRemoter;
                 textBox5.Text = acr.range.ToString();
             }
             else if (r is Konke.Remoter)
             {
                 Konke.Remoter re = r as Konke.Remoter;
                 if (re.orders.Count > 0)
                 {
                     textBox4.Text = re.orders[0].order;
                 }
             }
         }
     }
 }