using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using QC.QMSLPhone;
using QRCT_modem_RF_Debug_tool;

namespace QFDT_Components;

public partial class PCF_WCN36XX_CFG : UserControl, IComponentConnector
{
	private string m_currentID;

	public Phone phone;

	private List<WCN36xx_TxScenario> scenarioList;

	public PCF_WCN36XX_CFG()
	{
		m_currentID = null;
		scenarioList = null;
		scenarioList = new List<WCN36xx_TxScenario>();
		InitializeComponent();
		InitUI();
	}

	private void InitUI()
	{
		WLAN_cbxWayToLaunchProcess.Items.Clear();
		WLAN_cbxWayToLaunchProcess.Items.Add(WayToStartWlanAppEnum.ADB_COMMANDS);
		WLAN_cbxWayToLaunchProcess.Items.Add(WayToStartWlanAppEnum.DIAG_FTM_AP_UTILITY);
		WLAN_cbxWayToLaunchProcess.SelectedItem = WayToStartWlanAppEnum.DIAG_FTM_AP_UTILITY;
		WLAN_cbxBBtype.Items.Clear();
		WLAN_cbxBBtype.Items.Add(BaseBandSupportedType.Pronto);
		WLAN_cbxBBtype.Items.Add(BaseBandSupportedType.Riva);
		WLAN_cbxBBtype.SelectedItem = BaseBandSupportedType.Riva;
		WLAN_lbxScenarioList.Items.Clear();
		WCN36xx_cboPwrCtrlMode.Items.Clear();
		WCN36xx_cboPwrCtrlMode.Items.Add("OPEN LOOP");
		WCN36xx_cboPwrCtrlMode.Items.Add("CLPC");
		WCN36xx_cboPwrCtrlMode.Items.Add("SCPC");
		WCN36xx_cboPwrCtrlMode.Items.Add("AUTO");
		WCN36xx_cboPwrCtrlMode.Items.Add("AUTO-SAR");
		WCN36xx_sTxOpenLoopGain.Visibility = Visibility.Collapsed;
		WCN36xx_sTargetPwr.Visibility = Visibility.Visible;
	}

	public void updateUI(string chipID)
	{
		m_currentID = chipID;
		UpdatePwrCtrlVisibilityAccordingToChip();
		UpdateChanAccordingToChip();
		updateModeAccordingToChanAndChip();
		UpdateRateAccordingToModeAndChipAndBBtype();
		updatePwrCtrlTargetVisibility();
		defaultSetup();
	}

	private void UpdatePwrCtrlVisibilityAccordingToChip()
	{
		if (m_currentID == "WCN1314" || m_currentID == "WCN1312")
		{
			WCN36xx_cbClosedLoop.Visibility = Visibility.Visible;
			WCN36xx_cboPwrCtrlMode.Visibility = Visibility.Collapsed;
		}
		else if (m_currentID == "WCN3610/15/20" || m_currentID == "WCN3660/A/B" || m_currentID == "WCN3680/B")
		{
			WCN36xx_cbClosedLoop.Visibility = Visibility.Collapsed;
			WCN36xx_cboPwrCtrlMode.Visibility = Visibility.Visible;
		}
	}

	private void updatePwrCtrlTargetVisibility()
	{
		WCN36xx_sTxOpenLoopGain.Visibility = Visibility.Collapsed;
		WCN36xx_sTargetPwr.Visibility = Visibility.Visible;
		if (WCN36xx_cbClosedLoop.Visibility == Visibility.Visible)
		{
			if (WCN36xx_cbClosedLoop.IsChecked == false)
			{
				WCN36xx_sTxOpenLoopGain.Visibility = Visibility.Visible;
				WCN36xx_sTargetPwr.Visibility = Visibility.Collapsed;
			}
		}
		else if (WCN36xx_cboPwrCtrlMode.Visibility == Visibility.Visible && WCN36xx_cboPwrCtrlMode.SelectedItem != null && WCN36xx_cboPwrCtrlMode.SelectedItem.ToString() == "OPEN LOOP")
		{
			WCN36xx_sTxOpenLoopGain.Visibility = Visibility.Visible;
			WCN36xx_sTargetPwr.Visibility = Visibility.Collapsed;
		}
	}

	private void WCN36xx_cboPwrCtrlMode_selectionChanged(object sender, SelectionChangedEventArgs e)
	{
		updatePwrCtrlTargetVisibility();
	}

	private void WCN36xx_cbClosedLoop_IsChecked(object sender, RoutedEventArgs e)
	{
		updatePwrCtrlTargetVisibility();
	}

	private void UpdateChanAccordingToChip()
	{
		string text = null;
		if (WCN36xx_cboTxPacketChan.SelectedItem != null)
		{
			text = WCN36xx_cboTxPacketChan.SelectedItem.ToString();
		}
		WCN36xx_cboTxPacketChan.Items.Clear();
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_1(2412)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_2(2417)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_3(2422)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_4(2427)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_5(2432)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_6(2437)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_7(2442)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_8(2447)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_9(2452)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_10(2457)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_11(2462)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_12(2467)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_13(2472)");
		WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_14(2484)");
		if (m_currentID == "WCN3660/A/B" || m_currentID == "WCN3680/B")
		{
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_36(5180)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_40(5200)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_44(5220)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_48(5240)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_52(5260)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_56(5280)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_60(5300)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_64(5320)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_100(5500)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_104(5520)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_108(5540)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_112(5560)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_116(5580)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_120(5600)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_124(5620)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_128(5640)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_132(5660)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_136(5680)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_140(5700)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_144(5720)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_149(5745)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_153(5765)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_157(5785)");
			WCN36xx_cboTxPacketChan.Items.Add("RF_CHAN_161(5805)");
		}
		if (text != null && WCN36xx_cboTxPacketChan.Items.Contains(text))
		{
			WCN36xx_cboTxPacketChan.SelectedItem = text;
		}
		else
		{
			WCN36xx_cboTxPacketChan.SelectedItem = "RF_CHAN_1(2412)";
		}
	}

	private void WCN36xx_cbxBBtype_selectionChanged(object sender, SelectionChangedEventArgs e)
	{
		UpdateRateAccordingToModeAndChipAndBBtype();
	}

	private void WCN36xx_cboTxPacketChan_selectionChanged(object sender, SelectionChangedEventArgs e)
	{
		updateModeAccordingToChanAndChip();
	}

	private void WCN36xx_cboTxPacketMode_selectionChanged(object sender, SelectionChangedEventArgs e)
	{
		UpdateRateAccordingToModeAndChipAndBBtype();
	}

	private void WCN36xx_lboScenarioList_selectionChanged(object sender, SelectionChangedEventArgs e)
	{
		if (WLAN_lbxScenarioList.SelectedItem == null)
		{
			return;
		}
		WCN36xx_TxScenario wCN36xx_TxScenario = (WCN36xx_TxScenario)WLAN_lbxScenarioList.SelectedItem;
		string chanText = WCN36xxStatic.getChanText(wCN36xx_TxScenario.chan);
		WlanConst.SetSelectedItem(WCN36xx_cboTxPacketChan, chanText);
		WlanConst.SetSelectedItem(WCN36xx_cboTxPacketMode, wCN36xx_TxScenario.mode);
		RateEnumEntry rateInstance = WCN36xxStatic.getRateInstance(m_currentID, (BaseBandSupportedType)WLAN_cbxBBtype.SelectedItem, wCN36xx_TxScenario.mode, wCN36xx_TxScenario.rate);
		WlanConst.SetSelectedItem(WCN36xx_cboTxPacketRate, rateInstance);
		if (wCN36xx_TxScenario.power_ctrl_mode == "OpenLoop" || wCN36xx_TxScenario.power_ctrl_mode == "ClosedLoop")
		{
			WCN36xx_cbClosedLoop.Visibility = Visibility.Visible;
			WCN36xx_cboPwrCtrlMode.Visibility = Visibility.Collapsed;
			if (wCN36xx_TxScenario.power_ctrl_mode == "OpenLoop")
			{
				WCN36xx_cbClosedLoop.IsChecked = false;
				WCN36xx_sTxOpenLoopGain.Visibility = Visibility.Visible;
				WCN36xx_sTargetPwr.Visibility = Visibility.Collapsed;
				WCN36xx_txtRFGain.Text = wCN36xx_TxScenario.rfGain.ToString();
				WCN36xx_txtDigitalGain.Text = wCN36xx_TxScenario.DigGain.ToString();
			}
			else if (wCN36xx_TxScenario.power_ctrl_mode == "ClosedLoop")
			{
				WCN36xx_cbClosedLoop.IsChecked = true;
				WCN36xx_sTxOpenLoopGain.Visibility = Visibility.Collapsed;
				WCN36xx_sTargetPwr.Visibility = Visibility.Visible;
				WCN36xx_txtTxPower.Text = wCN36xx_TxScenario.TargetPower.ToString();
			}
		}
		else
		{
			WCN36xx_cbClosedLoop.Visibility = Visibility.Collapsed;
			WCN36xx_cboPwrCtrlMode.Visibility = Visibility.Visible;
			WCN36xx_cboPwrCtrlMode.SelectedItem = wCN36xx_TxScenario.power_ctrl_mode;
			if (wCN36xx_TxScenario.power_ctrl_mode == "OPEN LOOP")
			{
				WCN36xx_sTxOpenLoopGain.Visibility = Visibility.Visible;
				WCN36xx_sTargetPwr.Visibility = Visibility.Collapsed;
				WCN36xx_txtRFGain.Text = wCN36xx_TxScenario.rfGain.ToString();
				WCN36xx_txtDigitalGain.Text = wCN36xx_TxScenario.DigGain.ToString();
			}
			else
			{
				WCN36xx_sTxOpenLoopGain.Visibility = Visibility.Collapsed;
				WCN36xx_sTargetPwr.Visibility = Visibility.Visible;
				WCN36xx_txtTxPower.Text = wCN36xx_TxScenario.TargetPower.ToString();
			}
		}
	}

	private void updateModeAccordingToChanAndChip()
	{
		string text = null;
		if (WCN36xx_cboTxPacketMode.SelectedItem != null)
		{
			text = WCN36xx_cboTxPacketMode.SelectedItem.ToString();
		}
		WCN36xx_cboTxPacketMode.Items.Clear();
		if (!WCN36xxStatic.Is5GChannelSelected(WCN36xx_cboTxPacketChan))
		{
			WCN36xx_cboTxPacketMode.Items.Add("11b");
		}
		WCN36xx_cboTxPacketMode.Items.Add("11a/g");
		WCN36xx_cboTxPacketMode.Items.Add("11n");
		if (m_currentID == "WCN3680/B")
		{
			WCN36xx_cboTxPacketMode.Items.Add("11ac");
		}
		if (WCN36xx_cboTxPacketMode.Items.Contains(text))
		{
			WCN36xx_cboTxPacketMode.SelectedItem = text;
		}
		else
		{
			WCN36xx_cboTxPacketMode.SelectedItem = "11a/g";
		}
	}

	private void UpdateRateAccordingToModeAndChipAndBBtype()
	{
		bool flag = false;
		RateEnumEntry rateEnumEntry = new RateEnumEntry(null, -1, -1, -1, 0, BaseBandSupportedType.Both, null);
		if (WCN36xx_cboTxPacketRate.SelectedItem != null)
		{
			flag = true;
			rateEnumEntry.mode = ((RateEnumEntry)WCN36xx_cboTxPacketRate.SelectedItem).mode;
			rateEnumEntry.comboString = ((RateEnumEntry)WCN36xx_cboTxPacketRate.SelectedItem).comboString;
			rateEnumEntry.bandWidth = ((RateEnumEntry)WCN36xx_cboTxPacketRate.SelectedItem).bandWidth;
			rateEnumEntry.wcn131xEnum = ((RateEnumEntry)WCN36xx_cboTxPacketRate.SelectedItem).wcn131xEnum;
			rateEnumEntry.wcn3660Enum = ((RateEnumEntry)WCN36xx_cboTxPacketRate.SelectedItem).wcn3660Enum;
			rateEnumEntry.wcn3680Enum = ((RateEnumEntry)WCN36xx_cboTxPacketRate.SelectedItem).wcn3680Enum;
			rateEnumEntry.type = ((RateEnumEntry)WCN36xx_cboTxPacketRate.SelectedItem).type;
		}
		WCN36xx_cboTxPacketRate.Items.Clear();
		string text = m_currentID;
		if (text == "WCN1312")
		{
			text = "WCN1314";
		}
		else if (text == "WCN3610/15/20")
		{
			text = "WCN3660/A/B";
		}
		int num = 20;
		string text2 = "";
		if (WCN36xx_cboTxPacketMode.SelectedItem != null)
		{
			text2 = WCN36xx_cboTxPacketMode.SelectedItem.ToString();
		}
		BaseBandSupportedType baseBandSupportedType = BaseBandSupportedType.Riva;
		if (WLAN_cbxBBtype.SelectedItem != null)
		{
			baseBandSupportedType = (BaseBandSupportedType)WLAN_cbxBBtype.SelectedItem;
		}
		int num2 = -1;
		int num3 = -1;
		foreach (RateEnumEntry item in WCN36xxStatic.rateTable)
		{
			if (item.bandWidth > num || !(item.mode == text2) || (item.type != baseBandSupportedType && item.type != BaseBandSupportedType.Both))
			{
				continue;
			}
			int num4 = 0;
			switch (text)
			{
			case "WCN1312":
			case "WCN1314":
				num4 = item.wcn131xEnum;
				break;
			case "WCN3660/A/B":
				num4 = item.wcn3660Enum;
				break;
			case "WCN3680/B":
				num4 = item.wcn3680Enum;
				break;
			}
			if (num4 >= 0)
			{
				WCN36xx_cboTxPacketRate.Items.Add(item);
				num2++;
				if (flag && item.mode == rateEnumEntry.mode && item.comboString == rateEnumEntry.comboString && item.bandWidth == rateEnumEntry.bandWidth && item.wcn131xEnum == rateEnumEntry.wcn131xEnum && item.wcn3660Enum == rateEnumEntry.wcn3660Enum && item.wcn3680Enum == rateEnumEntry.wcn3680Enum && item.type == rateEnumEntry.type)
				{
					num3 = num2;
				}
			}
		}
		if (num3 > -1)
		{
			WCN36xx_cboTxPacketRate.SelectedIndex = num3;
		}
		else
		{
			WCN36xx_cboTxPacketRate.SelectedIndex = 0;
		}
	}

	public void defaultSetup()
	{
		WLAN_cbxWayToLaunchProcess.SelectedIndex = 1;
		WLAN_cbxBBtype.SelectedIndex = 1;
		WCN36xx_cboTxPacketChan.SelectedItem = "RF_CHAN_1(2412)";
		WCN36xx_cboTxPacketMode.SelectedItem = "11a/g";
		if (WCN36xx_cboTxPacketRate.Items.Count > 0)
		{
			WCN36xx_cboTxPacketRate.SelectedIndex = 0;
		}
		WCN36xx_cbClosedLoop.IsChecked = true;
		WCN36xx_cboPwrCtrlMode.SelectedItem = "CLPC";
		WCN36xx_txtRFGain.Text = "0";
		WCN36xx_txtDigitalGain.Text = "0";
		WCN36xx_txtTxPower.Text = "10";
	}

	private WCN36xx_TxScenario getScenarioFromUI()
	{
		WCN36xx_TxScenario curScenario = new WCN36xx_TxScenario();
		if (WCN36xx_cboTxPacketChan.SelectedItem != null && WCN36xxStatic.ChannelDict.Keys.Contains(WCN36xx_cboTxPacketChan.SelectedItem.ToString()))
		{
			curScenario.chan = WCN36xxStatic.ChannelDict[WCN36xx_cboTxPacketChan.SelectedItem.ToString()];
		}
		if (WCN36xx_cboTxPacketMode.SelectedItem != null)
		{
			curScenario.mode = WCN36xx_cboTxPacketMode.SelectedItem.ToString();
		}
		if (WCN36xx_cboTxPacketRate.SelectedItem != null)
		{
			curScenario.rate = WCN36xx_cboTxPacketRate.SelectedItem.ToString();
		}
		double result;
		int result2;
		if (WCN36xx_cbClosedLoop.Visibility == Visibility.Visible)
		{
			if (WCN36xx_cbClosedLoop.IsChecked == true)
			{
				curScenario.power_ctrl_mode = "ClosedLoop";
				if (double.TryParse(WCN36xx_txtTxPower.Text, out result))
				{
					curScenario.TargetPower = result;
				}
			}
			else
			{
				curScenario.power_ctrl_mode = "OpenLoop";
				if (int.TryParse(WCN36xx_txtRFGain.Text, out result2))
				{
					curScenario.rfGain = result2;
				}
				if (int.TryParse(WCN36xx_txtDigitalGain.Text, out result2))
				{
					curScenario.DigGain = result2;
				}
			}
		}
		else if (WCN36xx_cboPwrCtrlMode.Visibility == Visibility.Visible)
		{
			if (WCN36xx_cboPwrCtrlMode.SelectedItem != null)
			{
				curScenario.power_ctrl_mode = WCN36xx_cboPwrCtrlMode.SelectedItem.ToString();
			}
			if (curScenario.power_ctrl_mode == "OPEN LOOP")
			{
				if (int.TryParse(WCN36xx_txtRFGain.Text, out result2))
				{
					curScenario.rfGain = result2;
				}
				if (int.TryParse(WCN36xx_txtDigitalGain.Text, out result2))
				{
					curScenario.DigGain = result2;
				}
			}
			else if (double.TryParse(WCN36xx_txtTxPower.Text, out result))
			{
				curScenario.TargetPower = result;
			}
		}
		WCN36xxStatic.genWCN36xxScenarioName(ref curScenario);
		return curScenario;
	}

	private void UpdateScenarioListUI()
	{
		WLAN_lbxScenarioList.Items.Clear();
		for (int i = 0; i < scenarioList.Count; i++)
		{
			WLAN_lbxScenarioList.Items.Add(scenarioList[i]);
		}
	}

	private void AddScenarioToList()
	{
		try
		{
			WCN36xx_TxScenario scenarioFromUI = getScenarioFromUI();
			if (scenarioList.Count > 0)
			{
				bool flag = false;
				for (int i = 0; i < scenarioList.Count; i++)
				{
					if (scenarioList[i].scenarioDesc == scenarioFromUI.scenarioDesc)
					{
						flag = true;
					}
				}
				if (!flag)
				{
					scenarioList.Add(scenarioFromUI);
				}
			}
			else
			{
				scenarioList.Add(scenarioFromUI);
			}
			UpdateScenarioListUI();
		}
		catch (Exception ex)
		{
			MessageBox.Show("Add Scenario fail :" + ex.Message, "QFDT", MessageBoxButton.OK);
		}
	}

	private void btScenarioListAdd_Click(object sender, RoutedEventArgs e)
	{
		AddScenarioToList();
	}

	private void RemoveScenarioFromList()
	{
		try
		{
			if (WLAN_lbxScenarioList.SelectedItem == null)
			{
				return;
			}
			string text = WLAN_lbxScenarioList.SelectedItem.ToString();
			for (int i = 0; i < scenarioList.Count; i++)
			{
				if (scenarioList[i].scenarioDesc == text)
				{
					scenarioList.Remove(scenarioList[i]);
				}
			}
			UpdateScenarioListUI();
		}
		catch (Exception ex)
		{
			MessageBox.Show("Remove Scenario fail :" + ex.Message, "QFDT", MessageBoxButton.OK);
		}
	}

	private void btScenarioListRemove_Click(object sender, RoutedEventArgs e)
	{
		RemoveScenarioFromList();
	}

	public void updateWCN36xxInfoForPCF(ref WCN36xxInfo wcn36xx)
	{
		WCN36xxStatic.updateWCN36xxInfo(ref wcn36xx, bValid: true, (WLAN_cbxWayToLaunchProcess.SelectedItem != null) ? WLAN_cbxWayToLaunchProcess.SelectedItem.ToString() : null, (WLAN_cbxBBtype.SelectedItem != null) ? WLAN_cbxBBtype.SelectedItem.ToString() : null, scenarioList);
	}

	public void SetupUI(WCN36xxInfo wcn36xx)
	{
		if (wcn36xx.WayToLaunchProcess == null)
		{
			WLAN_cbxWayToLaunchProcess.SelectedItem = null;
		}
		else if (wcn36xx.WayToLaunchProcess == WayToStartWlanAppEnum.ADB_COMMANDS.ToString())
		{
			WLAN_cbxWayToLaunchProcess.SelectedItem = WayToStartWlanAppEnum.ADB_COMMANDS;
		}
		else if (wcn36xx.WayToLaunchProcess == WayToStartWlanAppEnum.DIAG_FTM_AP_UTILITY.ToString())
		{
			WLAN_cbxWayToLaunchProcess.SelectedItem = WayToStartWlanAppEnum.DIAG_FTM_AP_UTILITY;
		}
		else
		{
			WLAN_cbxWayToLaunchProcess.SelectedItem = null;
		}
		if (wcn36xx.BasebandType == null)
		{
			WLAN_cbxBBtype.SelectedItem = null;
		}
		else if (wcn36xx.BasebandType == BaseBandSupportedType.Pronto.ToString())
		{
			WLAN_cbxBBtype.SelectedItem = BaseBandSupportedType.Pronto;
		}
		else if (wcn36xx.BasebandType == BaseBandSupportedType.Riva.ToString())
		{
			WLAN_cbxBBtype.SelectedItem = BaseBandSupportedType.Riva;
		}
		else
		{
			WLAN_cbxBBtype.SelectedItem = null;
		}
		scenarioList.Clear();
		if (wcn36xx.ScenarioList != null && wcn36xx.ScenarioList.Scenario != null && wcn36xx.ScenarioList.Scenario.Length > 0)
		{
			for (int i = 0; i < wcn36xx.ScenarioList.Scenario.Length; i++)
			{
				scenarioList.Add(wcn36xx.ScenarioList.Scenario[i].DeepCopy());
			}
		}
		UpdateScenarioListUI();
	}

	private void bnBBTypeImport_Click(object sender, RoutedEventArgs e)
	{
		if (phone != null && phone.IsPhoneConnected())
		{
			byte b = byte.MaxValue;
			int num = WCN36xxStatic.wlanIDDict[m_currentID];
			if (num != 0)
			{
				b = phone.GET_RETVALUE_FTM_WLAN_GEN6_START(num);
				if (b == byte.MaxValue || b == 0)
				{
					MessageBox.Show("Can't get baseband type,QLIB_FTM_WLAN_GEN6_START fail, please check ptt_socket_app status", "QFDT");
				}
				else if (b >= 2)
				{
					WLAN_cbxBBtype.SelectedItem = BaseBandSupportedType.Pronto;
				}
				else
				{
					WLAN_cbxBBtype.SelectedItem = BaseBandSupportedType.Riva;
				}
			}
		}
		else
		{
			MessageBox.Show("Phone handle fail!", "QFDT");
		}
	}
}
