Esempio n. 1
0
        private void OnMenuItem(object sender, EventArgs e)
        {
            string[] arr  = sender.ToString().Split(':');
            string   name = arr[arr.Length - 1];

            string[] tmp = name.Split(' ');

            string deviceName = "";

            for (int i = 0; i < tmp.Length - 1; i++)
            {
                if (i != 0)
                {
                    deviceName += " " + tmp[i];
                }
                else
                {
                    deviceName += tmp[i];
                }
            }
            deviceName = deviceName.Substring(1, deviceName.Length - 1);

            string action = "turn" + tmp[tmp.Length - 1];
            int    id     = Telldus.GetId(deviceName);

            Telldus.DeviceAction(id, action);

            System.Diagnostics.Debug.Write(id);
        }
Esempio n. 2
0
        private void metroGrid1_DoubleClick(object sender, EventArgs e)
        {
            string name    = GetSelected();
            string action1 = "turnon";
            string action2 = "turnoff";
            int    id      = Telldus.GetId(name);

            Save.SaveDevice(name + " on", id, action1);
            Save.SaveDevice(name + " off", id, action2);

            Save.GetDevices();
            metroGrid2.DataSource = Save.GetNoIdDevices();
        }