private async void btnIR_Learn_Click(object sender, EventArgs e) { if (RMDevice == null) { return; } btnIR_Learn.Enabled = false; await RMDevice.EnterIRLearningModeAsync(); HelperMy.Notification(Color.RoyalBlue, "IR Kızılötesi Öğrenme modu etkinleştirildi."); }
private async void btnLearnCancel_Click(object sender, EventArgs e) { if (RMDevice == null) { return; } btnIR_Learn.Enabled = btnRF_Learn.Enabled = true; await RMDevice.ExitLearningModeAsync(); HelperMy.Notification(Color.RoyalBlue, "Öğrenme modundan çıkıldı."); }
private async void btnConnect_Click(object senderBtn, EventArgs eBtn) { btnConnect.Enabled = false; if (cmbDevices.Items.Count > 0) { try { DiscoverClient.Dispose(); DiscoverClient = null; } catch (Exception) { } } if (cmbDevices.Items.Count == 0) { if (DiscoverClient == null) { DiscoverClient = new Client(); DiscoverClient.DeviceHandler += Client_DeviceHandler; } HelperMy.Notification(Color.Gray, "Cihazlar aranıyor..."); await DiscoverClient.DiscoverAsync(); btnConnect.Text = "Tarama Yap"; } else if (cmbDevices.SelectedItem is RMDevice secim) { HelperMy.Notification(Color.Gray, "Bağlantı kuruluyor..."); RMDevice = secim as RMDevice; if (!RMDevice.IsEventsReady) { RMDevice.OnDeviceReady += RMDevice_OnDeviceReady; RMDevice.OnTemperature += RMDevice_OnTemperature; RMDevice.OnRawData += RMDevice_OnRawData; RMDevice.OnRawRFDataFirst += RMDevice_OnRawRFDataFirst; RMDevice.OnRawRFDataSecond += RMDevice_OnRawRFDataSecond; RMDevice.OnSentDataCallback += RMDevice_OnSentDataCallback; RMDevice.IsEventsReady = true; } await RMDevice.AuthorizeAsync(); KomutYukle(); btnMenuOgren.Enabled = cmbKomutListe.Enabled = btnIR_Learn.Enabled = btnRF_Learn.Enabled = btnLearnCancel.Enabled = btnKomutGonder.Enabled = btnKomutlariKaydet.Enabled = btnIceAktar.Enabled = true; btnConnect.Text = "Bağlanıldı"; } else { HelperMy.Notification(Color.Red, "Yazılıma uyumlu cihaz tespit edilemedi!"); } btnConnect.Enabled = true; }
private async void btnRF_Learn_Click(object sender, EventArgs e) { if (RMDevice == null) { return; } btnRF_Learn.Enabled = false; await RMDevice.EnterRFLearningModeAsync(); HelperMy.Notification(Color.RoyalBlue, "RF Frekans Öğrenme modu etkinleştirildi."); HelperMy.Notification(Color.Yellow, "RF Frekans Tarama [1/2]"); HelperMy.Notification(Color.Yellow, "[Düğmeye basılı tutunuz!]"); }
private async void btnKomutGonder_Click(object sender, EventArgs e) { var selected = cmbKomutListe.SelectedItem; if (selected == null || RMDevice == null) { return; } var command = (selected as Command).Code.HexToBytes(); if (txtIRCount.Text.IsNumeric() && txtIRCount.Text != "1") { command[1] = (byte)(Convert.ToByte(txtIRCount.Text) - 1); } await RMDevice.SendRemoteCommandAsync(command); HelperMy.Notification(Color.White, "Komut gönderildi : {0}", selected); }
private void btnIceAktar_Click(object sender, EventArgs e) { HelperMy.Notification(Color.RoyalBlue, "Broadlink eControl uygulamasındaki verileri içe aktarma"); HelperMy.Notification(Color.White, "1) Uygulamadaki menüden 'Paylaş' butonuna tıklayınız."); HelperMy.Notification(Color.White, "2) 'Ağdaki başka bir telefon ile paylaşın' butonuna tıklayınız."); HelperMy.Notification(Color.White, "3) 'İptal' butonuna tıklayınız."); HelperMy.Notification(Color.White, "4) Telefon hafızasında bulunan aşağıdaki dosyaları bilgisayarınıza kopyalayınız."); HelperMy.Notification(Color.White, "\tKlasör : /broadlink/newremote/SharedData"); HelperMy.Notification(Color.White, "\t* jsonDevice"); HelperMy.Notification(Color.White, "\t* jsonButton"); HelperMy.Notification(Color.White, "\t* jsonIrCode"); HelperMy.Notification(Color.White, "\t* jsonSubIr"); var model = NET.SharedData.CodeInfo.GetSharedData(); if (model == null || model.Length == 0) { HelperMy.Notification(Color.Red, "Veri bulunamadı!"); return; } if (Commands == null) { Commands = new List <Command>(); } foreach (var item in model) { if (Commands.FirstOrDefault(c => c.ID == item.Id.ToString()) is Command cmd) { cmd.Name = item.ToString(); cmd.Code = item.Code; } else { Commands.Add(new Command { ID = item.Id.ToString(), Key = item.ToString().FriendlyUrl(), Name = item.ToString(), Code = item.Code }); } } RefreshCmbKomutListe(); }