using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Collections; using System.Threading; using SafeMobileLib; using System.IO; using Telerik.WinControls; using CoreAudioApi; namespace Safedispatch_4_0 { public partial class RadioControl : UserControl { public volatile ArrayList RadioForms; public TcpClass tcp, tcpAudio; public static Boolean TCPstarted = false; private Int32 maxID = 0; private MainForm2 parent; private MemoryStream RecorderStream1 = null; private int bytesRecv = 0; private int bytes2BeRecv = 0; private string strDataRecv; private ShapeNew fromtoPlay = null; //voice device public int selectedOUTDevice; public string selectedOUTDeviceName = " "; public int selectedINDevice; public string selectedINDeviceName = " "; public ArrayList soundOUTDevices; public ArrayList soundINDevices; public volatile NewAudio nVOice; public SMdb_access smdbObj = null; public bool PTTclickedALL = false; public volatile bool GeneralPTTclick = false; private String waittoconect = ""; private Boolean LoadtabDone =false; private MMDevice device; public Int32 SizeofScreen = 0; public void StartTCP() { try { TCPstarted = tcp.Start(MainForm2.cfg.REC_IP, Convert.ToInt32(MainForm2.cfg.REC_port)); } catch (Exception ex) { SM.Debug("StartTCP:"+ex.ToString()); } } private void setLanguage() { btPTTALL.Text = MainForm2.returnLNGString("PTTAll"); if (MainForm2.Langidx!=1) //chinesee problem btnSettings.Text = MainForm2.returnLNGString("sett"); waittoconect = MainForm2.returnLNGString("waitvoice"); } private Boolean isConstructor = false; private void Constructor(MainForm2 _parent) { parent = _parent; InitializeComponent(); try { soundOUTDevices = new ArrayList(); soundINDevices = new ArrayList(); //radToolStripItem1.OverflowManager.DropDownButton.Enabled = false; setLanguage(); RadioForms = new ArrayList(); // parent.mainRadioForms = RadioForms; radScrollablePanel1.Visible = false; txProgStatus.Visible = true; VoiceProgBar.Visible = true; VoiceWaitPanel.Visible = true; VoiceProgBar.Value1 = 0; txProgStatus.Clear(); txProgStatus.Text = waittoconect; radToolStrip1.Enabled = false; isConstructor = true; } catch (Exception ex) { SM.Debug("RadioControl:" + ex.ToString()); } try { switch (MainForm2.radioType) { case RADIOTYPE.HYT: radSplitContainer1.BackColor = MainForm2.HyteraColor; VoiceWaitPanel.BackColor = MainForm2.HyteraColor; btnSettings.TextElement.ForeColor = Color.Black; btPTTALL.TextElement.ForeColor = Color.Black; break; case RADIOTYPE.HARRIS: radSplitContainer1.BackColor = MainForm2.HarrisColor; VoiceWaitPanel.BackColor = MainForm2.HarrisColor; btnSettings.TextElement.ForeColor = MainForm2.HarTextColor; btPTTALL.TextElement.ForeColor = MainForm2.HarTextColor; break; case RADIOTYPE.ATLAS: radSplitContainer1.BackColor = MainForm2.HarrisColor; VoiceWaitPanel.BackColor = MainForm2.HarrisColor; btnSettings.TextElement.ForeColor = MainForm2.HarTextColor; btPTTALL.TextElement.ForeColor = MainForm2.HarTextColor; break; case RADIOTYPE.REPEATER_TRBO: btPTTALL.Visibility = ElementVisibility.Hidden; break; case RADIOTYPE.SIMOCO: //old design break; } } catch (Exception ex) { SM.Debug("Error on change color constructor:" + ex.ToString()); } //VumeterPart try { MMDeviceEnumerator DevEnum = new MMDeviceEnumerator(); device = DevEnum.GetDefaultAudioEndpoint(EDataFlow.eRender, ERole.eMultimedia); device.AudioEndpointVolume.OnVolumeNotification += new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification); } catch (Exception ex) { SM.Debug("Error on init VUMeter:"+ex.ToString()); } MainForm2.RestartMEM += 50000000; SizeofScreen = radScrollablePanel1.Size.Height; } //not needed void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data) { if (this.InvokeRequired) { object[] Params = new object[1]; Params[0] = data; this.Invoke(new AudioEndpointVolumeNotificationDelegate(AudioEndpointVolume_OnVolumeNotification), Params); } else { //tbMaster.Value = (int)(data.MasterVolume * 100); } } public RadioControl(MainForm2 _parent) { Constructor(_parent); } public RadioControl(MainForm2 _parent,Boolean force_timer) { Constructor(_parent); LoadAfter200.Enabled = true; LoadAfter200.Start(); LoadtabDone = true; } ~RadioControl() { if(tcp!=null)tcp.Stop(); if(tcpAudio!=null)tcpAudio.Stop(); } public void iniVoiceComponents() { selectedOUTDevice = -1; selectedINDevice = -1; try { AudioDeviceName dName = new AudioDeviceName(); int i = 0; foreach (String stDName in dName.getOutDevices()) { sDevice dev; dev.index = i; dev.name = stDName.Trim(); soundOUTDevices.Add(dev); i++; } i = 0; foreach (String stDName in dName.getInDevices()) { sDevice dev; dev.index = i; dev.name = stDName.Trim(); soundINDevices.Add(dev); i++; } if (soundOUTDevices.Count > 0) { if (selectedOUTDevice < soundOUTDevices.Count) { bool found = false; foreach (sDevice dev in soundOUTDevices) { if (dev.name.Equals(selectedOUTDeviceName)) { found = true; selectedOUTDevice = dev.index; } } if (!found) { selectedOUTDevice = 0; } } else { selectedOUTDevice = 0; } } if (soundINDevices.Count > 0) { if (selectedINDevice < soundINDevices.Count) { bool found = false; foreach (sDevice dev in soundINDevices) { if (dev.name == selectedINDeviceName) { found = true; selectedINDevice = dev.index; } } if (!found) { selectedINDevice = 0; } } else { selectedINDevice = 0; } } } catch (Exception ex) { SM.Debug("ERROR in voice ini : " + ex.ToString()); } } public void StartnVoice() { try { if (nVOice != null) nVOice = null; if ((selectedINDevice != -1) && (selectedOUTDevice != -1)) { try { nVOice = new NewAudio(selectedINDevice, selectedOUTDevice); nVOice.OnVoiceRecv += new NewAudio.VoiceRecv(nVOice_OnNewDataRecv); MainForm2.nVoiceforClose = nVOice; } catch (Exception ex) { SM.Debug("Error to start voice for ALL call" + ex.ToString()); } } } catch (Exception ex) { SM.Debug("StartnVoice:" + ex.ToString()); } } void nVOice_OnNewDataRecv(byte[] data, int dataLen) { try { if ((PTTclickedALL) || (GeneralPTTclick)) { Console.WriteLine("Send data to UDP2"); MainForm2.udp4Voice.Send(data, dataLen); } } catch (Exception ex) { SM.Debug("nVOice_OnNewDataRecv:"+ex.ToString()); } } private void btmoveDown_Click(object sender, EventArgs e) { try { Int32 IDtochange = -1; foreach (ShapeNew obj in RadioForms) if ((obj.Selected) && (obj.ID != 0)) { IDtochange = obj.ID; break; } if (IDtochange != -1) changePosition(IDtochange, false); } catch (Exception ex) { SM.Debug("btmoveDown_Click:"+ex.ToString()); } } private void btmoveUP_Click(object sender, EventArgs e) { try { Int32 IDtochange = -1; foreach (ShapeNew obj in RadioForms) if ((obj.Selected) && (obj.ID != maxID)) { IDtochange = obj.ID; break; } if (IDtochange != -1) changePosition(IDtochange, true); } catch (Exception ex) { SM.Debug("btmoveUP_Click:" + ex.ToString()); } } public void PlayFile(Int64 IdToPlay,Int32 TimerInterval) { try { MainForm2.PlayingFile = true; MainForm2.PlayingFileCount= 0; UnableToPlay.Enabled = true; UnableToPlay.Start(); StopTimer.Interval = TimerInterval; StopTimer.Enabled = true; StopTimer.Start(); //System.Threading.Timer t1 = new System.Threading.Timer(SendStop, null, TimerInterval, System.Threading.Timeout.Infinite); //start audio thread bool start = tcpAudio.Start(MainForm2.cfg.REC_IP, Convert.ToInt32(MainForm2.cfg.REC_audio_port)); RecorderStream1 = new MemoryStream(); Int64 id = (Int64)IdToPlay; byte[] temp = BitConverter.GetBytes(id); byte[] buff = new byte[temp.Length + 1]; buff[0] = 1; int i = 1; foreach (byte b in temp) { buff[i] = b; i++; } tcpAudio.Send(buff); } catch (Exception ex) { SM.Debug("PlayFile:"+ex.ToString()); } } void tcpAudio_OnConnectionEnded() { try { //nVOice.DataArrived(RecorderStream1.ToArray()); nVOice.PlaySound(RecorderStream1.ToArray(), RecorderStream1.ToArray().Length); } catch (Exception ex) { SM.Debug("Conection ended error:"+ex.ToString()); } } private void UpdateList(ArrayList recArray) { try { foreach (ShapeNew obj in RadioForms) if (obj.typeRadio) ((radioFrom)obj).populateRecList(recArray); else ((dispFrom)obj).populateRecList(recArray); } catch (Exception ex) { SM.Debug("UpdateList:"+ex.ToString()); } } public delegate void UpdateListCallBack(ArrayList recArray); delegate void MsgRecvCallback(ArrayList recArray); public void MsgRecv(ArrayList recArray) { try { this.Invoke(new UpdateListCallBack(this.UpdateList), recArray); } catch(Exception ex) { SM.Debug("MsgRecv:"+ex.ToString()); } } private ArrayList DecodePack(string data) { ArrayList ret = new ArrayList(); try { string[] temp = data.Split('#'); SM.Debug("temp="+temp[1]); Recording tmp = null; for (int i = 1; i < temp.Length; i++) { string[] arStr = temp[i].Split(';'); if (arStr.Length == 9) { //tmp = new Recording(); tmp = new Recording(Convert.ToInt64(arStr[0]), 0, 0, DateTime.Parse(arStr[4]), DateTime.Parse(arStr[5]), "", Convert.ToInt32(arStr[1]), Convert.ToInt32(arStr[2]), Convert.ToInt32(arStr[3]), Convert.ToInt32(arStr[6]), Convert.ToInt32(arStr[7]), Convert.ToInt32(arStr[8])); ret.Add(tmp); } else { SM.Debug("Error in DecodePack Incomplet data : " + temp[i]); } } } catch (Exception ex) { SM.Debug("DecodePack:"+ex.ToString()); } return ret; } void tcpAudio_OnMessageRecv(byte[] data, int recv) { try { RecorderStream1.Write(data, 0, recv); MainForm2.PlayingFileCount++; if (MainForm2.PlayingFileCount == 2) { UnableToPlay.Stop(); UnableToPlay.Enabled = false; } } catch (Exception ex) { SM.Debug("tcpAudio_OnMessageRecv:" + ex.ToString()); } } void tcp_OnMessageRecv(byte[] data, int recv) { try { // nu merg unele inregistrari care au mai multe parti 128 si se termina in 3 //if (recv != 3) //{ string tempstrDataRecv = System.Text.Encoding.ASCII.GetString(data, 0, recv); if (tempstrDataRecv.Contains("$")) { if (tempstrDataRecv.IndexOf('$') == 0) { string[] temp = tempstrDataRecv.Split('$'); if (temp.Length == 3) { bytes2BeRecv = Convert.ToInt32(temp[1]); } bytesRecv += recv; strDataRecv += tempstrDataRecv; } else { string[] temp = tempstrDataRecv.Split('$'); bytesRecv += temp[0].Length; strDataRecv += temp[0]; if (bytesRecv == bytes2BeRecv) { ArrayList recArray = DecodePack(strDataRecv); bytesRecv = 0; strDataRecv = ""; MsgRecv(recArray); } if (temp.Length == 3) bytes2BeRecv = Convert.ToInt32(temp[1]); bytesRecv += temp[1].Length + temp[2].Length + 2; strDataRecv += "$" + temp[1] + "$" + temp[2]; if (bytesRecv == bytes2BeRecv) { ArrayList recArray = DecodePack(strDataRecv); bytesRecv = 0; strDataRecv = ""; MsgRecv(recArray); } } } else { bytesRecv += recv; strDataRecv += tempstrDataRecv; } if (bytesRecv == bytes2BeRecv) { ArrayList recArray = DecodePack(strDataRecv); bytesRecv = 0; strDataRecv = ""; MsgRecv(recArray); } //} } catch (Exception ex) { SM.Debug("Erorr on tcp_OnMessageRecv Radio control:" + ex.ToString()); } } private void InitListToPlay() { try { tcp = new TcpClass(); tcp.OnMessageRecv += new TcpClass.MessageRecv(tcp_OnMessageRecv); tcpAudio = new TcpClass(); tcpAudio.OnMessageRecv += new TcpClass.MessageRecv(tcpAudio_OnMessageRecv); tcpAudio.OnConnectionEnded += new TcpClass.ConnectionEnded(tcpAudio_OnConnectionEnded); try { TCPstarted = tcp.Start(MainForm2.cfg.REC_IP, Convert.ToInt32(MainForm2.cfg.REC_port)); foreach (ShapeNew obj in RadioForms) if (obj.typeRadio) { tcp.Send(new byte[] { 0, 1, (byte)obj.gwID, (byte)obj.radID, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); Thread.Sleep(100); } else { tcp.Send(new byte[] { 0, 2, 0, (byte)obj.userID, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }); Thread.Sleep(100); } } catch (Exception ex) { SM.Debug("Unable to force conect: " + ex.ToString()); } } catch (Exception ex) { SM.Debug("InitListToPlay:"+ex.ToString()); } } private void changePosition(Int32 ID, Boolean UP) { try { ShapeNew tmpfrm = new ShapeNew(); ArrayList tmpForms = new ArrayList(); foreach (ShapeNew obj in RadioForms) if ((UP) && (obj.ID >= ID)) { tmpfrm = obj; if (tmpfrm.ID == ID) tmpfrm.ID = ID + 1; else if (tmpfrm.ID == (ID + 1)) tmpfrm.ID = ID; tmpForms.Add(tmpfrm); radScrollablePanel1.PanelContainer.Controls.Remove(obj); } else if ((!UP) && (obj.ID >= (ID - 1))) { tmpfrm = obj; if (tmpfrm.ID == (ID - 1)) tmpfrm.ID = ID; else if (tmpfrm.ID == ID) tmpfrm.ID = ID - 1; tmpForms.Add(tmpfrm); radScrollablePanel1.PanelContainer.Controls.Remove(obj); } if (UP) { for (int i = ID; i <= maxID; i++) RadioForms.RemoveAt(ID); } else { for (int i = (ID - 1); i <= maxID; i++) RadioForms.RemoveAt(ID - 1); } tmpForms.Sort(new ShapeNewIDComparer()); foreach (ShapeNew obj in tmpForms) { obj.Dock = DockStyle.Top; radScrollablePanel1.PanelContainer.Controls.Add(obj); RadioForms.Add(obj); } } catch (Exception ex) { SM.Debug("changePosition:"+ex.ToString()); } } private void btnSettings_Click(object sender, EventArgs e) { try { PTTallSettingsForm f = new PTTallSettingsForm(); f.Show(); } catch (Exception ex) { SM.Debug("btnSettings_Click"+ex.ToString()); } } private void btPTTALL_Click(object sender, EventArgs e) { try { if (!MAKESTOPBOOL) { MAKESTOPBOOL = true; foreach (ShapeNew obj in RadioForms) { if (obj.isON) { obj.Send_PTT_ALL_OFF(); PTTclickedALL = false; } } Thread.Sleep(1000); } } catch (Exception ex) { SM.Debug("btPTTALL_Click:" + ex.ToString()); } } private void btPTTALL_MouseDown(object sender, MouseEventArgs e) { try { MAKESTOPBOOL = false; foreach (ShapeNew obj in RadioForms) { if (obj.isON) { PTTclickedALL = true; obj.Send_PTT_ALL_ON(); } } } catch (Exception ex) { SM.Debug("btPTTALL_Click:" + ex.ToString()); } } private volatile Boolean MAKESTOPBOOL = true; private void btPTTALL_LostMouseCapture(object sender, MouseEventArgs e) { try { if (!MAKESTOPBOOL) { MAKESTOPBOOL = true; foreach (ShapeNew obj in RadioForms) { if (obj.isON) { obj.Send_PTT_ALL_OFF(); PTTclickedALL = false; } } Thread.Sleep(1000); } } catch (Exception ex) { SM.Debug("btPTTALL_LostMouseCapture:" + ex.ToString()); } } public delegate void UpdateProgressBarCallBack(Int32 max); private void UpdateProgressBar(Int32 max) { try { if (max == -1) { VoiceProgBar.ProgressBarElement.PerformStepValue1(); VoiceProgBar.Update(); } else VoiceProgBar.Maximum = max; } catch (Exception ex) { SM.Debug("UpdateProgressBar:" + ex.ToString()); } } private volatile Int32 maxbar = 5; private void LoadStationWorker_DoWork(object sender, DoWorkEventArgs e) { try { if (MainForm2.UsersList.Count > 1) maxbar = maxbar + MainForm2.UsersList.Count - 1; VoiceProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), maxbar); LoadStationWorker.ReportProgress(1); InitListToPlay(); VoiceProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1); //parent.mainRadioForms = RadioForms; MainForm2.tcpforClose = tcp; MainForm2.tcpAudioforClose = tcpAudio; smdbObj = new SMdb_access(); } catch (Exception ex) { SM.Debug("LoadStationWorker_DoWork phase1:"+ex.ToString()); } try { ArrayList tmpSound = smdbObj.GetSoundCards(0); if (tmpSound.Count > 0) { selectedOUTDeviceName = tmpSound[0].ToString(); selectedINDeviceName = tmpSound[1].ToString(); if (tmpSound.Count > 2) MainForm2.KeyforPTTall = tmpSound[2].ToString(); else MainForm2.KeyforPTTall = ""; } else { selectedOUTDeviceName = ""; selectedINDeviceName = ""; } } catch (Exception ex) { SM.Debug("Unable to load sound settings." + ex.ToString()); } try { VoiceProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1); iniVoiceComponents(); VoiceProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1); StartnVoice(); VoiceProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1); parent.Send_UDP_cmd_sent_withOutID("#0.0#202#" + MainForm2.userIDX.ToString() + "#"); } catch (Exception ex) { SM.Debug("LoadStationWorker_DoWork phase2:" + ex.ToString()); } try { while (!radioListClear) { Thread.Sleep(10); } Boolean Thnotstart =true; while (Thnotstart) { Thread.Sleep(100); Thnotstart = false; foreach (ShapeNew obj in RadioForms) { if (obj.typeRadio) if (!((radioFrom)obj).threadStarted) Thnotstart = true; else if (!((radioFrom)obj).progressChecked) { VoiceProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1); ((radioFrom)obj).progressChecked = true; } } } } catch (Exception ex) { SM.Debug("LoadStationWorker_DoWork phase2:" + ex.ToString()); } } private volatile Boolean radioListClear = false; private void LoadStationWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) { try { radioFrom tmp; dispFrom tmp2; Int32 cnt = 0; DBgatewaysManager DBgw = new DBgatewaysManager(MainForm2.ServerDBip, MainForm2.Schema, MainForm2.UserDB, MainForm2.PassDB, MainForm2.PortDB); List listgw = DBgw.getAllGateways(); foreach (Gateway rad in listgw) { List listRadgw = DBgw.gelAllRadioGateways_forUser(rad.Id,MainForm2.userIDX); maxbar = maxbar + 2*listRadgw.Count; if (listRadgw.Count>0) VoiceProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), maxbar); foreach (RadioGateway radgw in listRadgw) { if (radgw.Gw_voice == 1) { tmp = new radioFrom(parent, this, rad.Id, radgw.Id, cnt, radgw.Ip); tmp.TopLevel = false; tmp.Visible = true; tmp.Dock = DockStyle.Top; tmp.lbRadName.Text = radgw.Ip; tmp.ckName.Text = rad.Ip; RadioForms.Add(tmp); maxID = cnt; cnt++; VoiceProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1); Thread.Sleep(10); } } } foreach (User obj in MainForm2.UsersList) { if (obj.Id != MainForm2.userIDX) { tmp2 = new dispFrom(parent, this, obj.Id, cnt, obj.UserName); tmp2.TopLevel = false; tmp2.Visible = true; tmp2.Dock = DockStyle.Top; tmp2.ckName.Text = obj.UserName; RadioForms.Add(tmp2); maxID = cnt; cnt++; VoiceProgBar.Invoke(new UpdateProgressBarCallBack(this.UpdateProgressBar), -1); Thread.Sleep(10); } } radioListClear = true; } catch (Exception ex) { SM.Debug("Error add the form in scrool panel:"+ex.ToString()); } } private void LoadStationWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { SM.Debug("Begin LoadStationWorker_RunWorkerCompleted"); try { foreach (ShapeNew obj in RadioForms) { if (obj.typeRadio) { radScrollablePanel1.PanelContainer.Controls.Add((radioFrom)obj); ((radioFrom)obj).FirstChanel(); ((radioFrom)obj).ChangeState(); ((radioFrom)obj).ChangeState(); } else { radScrollablePanel1.PanelContainer.Controls.Add((dispFrom)obj); ((dispFrom)obj).ChangeState(); ((dispFrom)obj).ChangeState(); } Thread.Sleep(10); } } catch (Exception ex) { SM.Debug("Error on refresh chanel:" + ex.ToString()); } try { txProgStatus.Visible = false; VoiceProgBar.Visible = false; VoiceWaitPanel.Visible = false; radScrollablePanel1.Visible = true; txProgStatus.Update(); VoiceWaitPanel.Update(); radToolStrip1.Enabled = true; LoadStationWorker.CancelAsync(); /* //populate all the vechicles with has_voice foreach(string objs in MainForm2.vehicleHT.Keys) ((Vehicle)MainForm2.vehicleHT[objs]).has_voice = true;*/ } catch (Exception ex) { SM.Debug("LoadStationWorker_RunWorkerCompleted:"+ex.ToString()); } SM.Debug("END LoadStationWorker_RunWorkerCompleted"); } private void splitPanel2_Resize(object sender, EventArgs e) { try { int diffHeight, diffWidth; Control control = (Control)sender; diffHeight = control.Size.Height / 2; diffWidth = control.Size.Width / 2; diffHeight = diffHeight - 50; diffWidth = diffWidth - 140; if ((diffHeight > 0) && (diffWidth > 0)) VoiceWaitPanel.Location = new System.Drawing.Point(diffWidth, diffHeight); } catch (Exception ex) { SM.Debug("splitPanel2_Resize:"+ex.ToString()); } } private void RadioControl_Load(object sender, EventArgs e) { try { SM.Debug("Enter on the RadioControl_Load"); if (isConstructor) { radScrollablePanel1.Update(); txProgStatus.Update(); VoiceProgBar.Update(); VoiceWaitPanel.Update(); splitPanel2.Update(); if (!LoadtabDone) { LoadAfter200.Enabled = true; LoadAfter200.Start(); } } isConstructor = false; } catch (Exception ex) { SM.Debug("RadioControl_Load:"+ex.ToString()); } } private void LoadAfter200_Tick(object sender, EventArgs e) { try { SM.Debug("Start worker with "); LoadStationWorker.RunWorkerAsync(); LoadAfter200.Stop(); LoadAfter200.Enabled = false; } catch (Exception ex) { SM.Debug("LoadAfter200_Tick:"+ex.ToString()); } } private void UnableToPlay_Tick(object sender, EventArgs e) { try { if (MainForm2.PlayingFile) { //RadMessageBox.Show(MainForm2.returnLNGString("unplayFile"), MainForm2.returnLNGString("war"), MessageBoxButtons.OK, RadMessageIcon.Error); foreach (ShapeNew obj in RadioForms) obj.SendPlayingComplet(); //MainForm2.PlayingFile =false; } UnableToPlay.Stop(); UnableToPlay.Enabled = false; } catch (Exception ex) { SM.Debug("UnableToPlay_Tick:" + ex.ToString()); } } private void StopTimer_Tick(object sender, EventArgs e) { try { if (MainForm2.PlayingFile) { foreach (ShapeNew obj in RadioForms) obj.SendPlayingComplet(); } StopTimer.Stop(); StopTimer.Enabled = false; } catch (Exception ex) { SM.Debug("Ex:" + ex.ToString()); } } private void VUMetertimer_Tick(object sender, EventArgs e) { foreach (ShapeNew obj in RadioForms) if (obj.RecivedData) obj.SendVolumeData((Int32)(device.AudioMeterInformation.MasterPeakValue * 10000)); } public void SendProrityOFF(String PersonalIP) { foreach (ShapeNew obj in RadioForms) if (PersonalIP.CompareTo(obj.PersonalIP) != 0) obj.SendPriorityOFF(); } } }