using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Telerik.WinControls.UI; using System.Threading; using System.Collections; using Telerik.WinControls; using SafeMobileLib; namespace Safedispatch_4_0 { public partial class dispFrom : ShapeNew { private Int32 backtoPlayRow = -1; private String wordOnline = ""; private String wordOffline = ""; private ArrayList vehicleListNames; private ConvertDT convDT = new ConvertDT(); private String msgLimit; private void setLanguage() { btPTT.Text = MainForm2.returnLNGString("ptt"); btPTTdisp.Text = MainForm2.returnLNGString("ptt"); tabItem1.Text = MainForm2.returnLNGString("disp"); cbPatch.Text = MainForm2.returnLNGString("patch"); lbCallID.Text = MainForm2.returnLNGString("callerID") + ":"; lbStat.Text = MainForm2.returnLNGString("SMSStatus") + ":"; lbAssingKey.Text = MainForm2.returnLNGString("hotkey") + ":"; tbRecord.Text = MainForm2.returnLNGString("rec"); ckShowLogin.Text = MainForm2.returnLNGString("showuser"); RecordingList.Columns[0].HeaderText = "";//colum0 RecordingList.Columns[2].HeaderText = MainForm2.returnLNGString("colum0"); RecordingList.Columns[3].HeaderText = MainForm2.returnLNGString("start"); RecordingList.Columns[4].HeaderText = MainForm2.returnLNGString("stop"); wordOnline = MainForm2.returnLNGString("online"); wordOffline = MainForm2.returnLNGString("offline"); msgLimit = MainForm2.returnLNGString("endtimegreate"); dtFrom.Culture = MainForm2.culture; dtTo.Culture = MainForm2.culture; dtFrom.CustomFormat = dtTo.CustomFormat = Utils.getDayCustomFormat(MainForm2.is24hours, MainForm2.DayFirst); //if (MainForm2.is24hours) //{ // if (MainForm2.DayFirst) // { // dtFrom.CustomFormat = "dd/MM/yyyy HH:mm"; // dtTo.CustomFormat = "dd/MM/yyyy HH:mm"; // } // else // { // dtFrom.CustomFormat = "MM/dd/yyyy HH:mm"; // dtTo.CustomFormat = "MM/dd/yyyy HH:mm"; // } //} //else //{ // if (MainForm2.DayFirst) // { // dtFrom.CustomFormat = "dd/MM/yyyy hh:mm tt"; // dtTo.CustomFormat = "dd/MM/yyyy hh:mm tt"; // } // else // { // dtFrom.CustomFormat = "MM/dd/yyyy hh:mm tt"; // dtTo.CustomFormat = "MM/dd/yyyy hh:mm tt"; // } //} //SMSStatus } public dispFrom(MainForm2 _mainparent, RadioControl _parent, Int32 _userID, Int32 _ID, String _Name) { InitializeComponent(); // set theme for the Message Box RadMessageBox.SetThemeName("TelerikMetroBlue"); lbChanel.AutoSize = false; lbChanel.Size = new System.Drawing.Size(215, 22); ckShowLogin.AutoSize = false; ckShowLogin.Size = new Size(66, 99); switch (MainForm2.radioType) { case RADIOTYPE.MOTO: //this.ThemeName = "Breeze"; //ThemeResolutionService.ApplyThemeToControlTree(this, "Breeze"); //this.ThemeName = "Windows8"; //ThemeResolutionService.ApplyThemeToControlTree(this, "Windows8"); //this.newtab2.Size = new Size(newtab2.Width, 170); this.ScreenPanel.Size = new Size(ScreenPanel.Width, 78); btPTTdisp.ForeColor = Color.White; break; case RADIOTYPE.HYT: //this.ThemeName = "office2010"; //this.Size = new Size(this.Width, 350); this.newtab2.Size = new Size(newtab2.Width, 175);//175 this.ScreenPanel.Location = new Point(this.ScreenPanel.Location.X,this.ScreenPanel.Location.Y+10);//115 this.ScreenPanel.Size = new Size(ScreenPanel.Width,115);//115 btCollapse.Image = global::Dispatcher.Properties.Resources.plusOR; this.RecordingList.TableElement.CellSpacing = -1; this.RecordingList.TableElement.RowSpacing = -1; this.lbAssingKey.ForeColor = MainForm2.HarTextColor; this.lbCallID.ForeColor = MainForm2.HarTextColor; this.lbIDValue.ForeColor = MainForm2.HarTextColor; this.lbStat.ForeColor = MainForm2.HarTextColor; this.cbVoicePriority.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.ckDataFilter.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.ckUnitName.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.lbFrom.ForeColor = MainForm2.HarTextColor; this.lbTo.ForeColor = MainForm2.HarTextColor; //this.lbStat.Location = new Point(lbStat.Location.X, lbStat.Location.Y + 2); //this.lbCallID.Location = new Point(lbCallID.Location.X, lbCallID.Location.Y + 2); this.cbPatch.TextElement.ForeColor = MainForm2.HarTextColor; this.ckName.TextElement.ForeColor = MainForm2.HarTextColor; this.ckShowLogin.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; //this.newtab2.SelectedPage.BackColor = Color.FromArgb(255, 182, 83); break; case RADIOTYPE.HARRIS: //this.ThemeName = "Office2010Black"; this.newtab2.Size = new Size(newtab2.Width, 175); this.ScreenPanel.Size = new Size(ScreenPanel.Width,115); btCollapse.Image = global::Dispatcher.Properties.Resources.plusGR; this.RecordingList.TableElement.CellSpacing = -1; this.RecordingList.TableElement.RowSpacing = -1; this.lbAssingKey.ForeColor = MainForm2.HarTextColor; this.lbCallID.ForeColor = MainForm2.HarTextColor; this.lbIDValue.ForeColor = MainForm2.HarTextColor; this.lbStat.ForeColor = MainForm2.HarTextColor; this.cbPatch.TextElement.ForeColor = MainForm2.HarTextColor; this.ckName.TextElement.ForeColor = MainForm2.HarTextColor; this.ckShowLogin.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.cbVoicePriority.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.ckDataFilter.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.ckUnitName.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.lbFrom.ForeColor = MainForm2.HarTextColor; this.lbTo.ForeColor = MainForm2.HarTextColor; break; case RADIOTYPE.ATLAS: //this.ThemeName = "Office2010Black"; this.newtab2.Size = new Size(newtab2.Width, 175); this.ScreenPanel.Size = new Size(ScreenPanel.Width, 115); btCollapse.Image = global::Dispatcher.Properties.Resources.plusGE; //ATLASCHANGE nu situ this.RecordingList.TableElement.CellSpacing = -1; this.RecordingList.TableElement.RowSpacing = -1; this.lbAssingKey.ForeColor = MainForm2.HarTextColor; this.lbCallID.ForeColor = MainForm2.HarTextColor; this.lbIDValue.ForeColor = MainForm2.HarTextColor; this.lbStat.ForeColor = MainForm2.HarTextColor; this.cbPatch.TextElement.ForeColor = MainForm2.HarTextColor; this.ckName.TextElement.ForeColor = MainForm2.HarTextColor; this.ckShowLogin.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.cbVoicePriority.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.ckDataFilter.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.ckUnitName.ButtonElement.TextElement.ForeColor = MainForm2.HarTextColor; this.lbFrom.ForeColor = MainForm2.HarTextColor; this.lbTo.ForeColor = MainForm2.HarTextColor; break; case RADIOTYPE.SIMOCO: //depends on design break; } this.ProgVolum.IndicatorElement1.DrawFill = true; this.ProgVolum.IndicatorElement1.BackColor3 = System.Drawing.SystemColors.ControlLight; this.ProgVolum.IndicatorElement1.BackColor4 = System.Drawing.Color.White; this.ProgVolum.IndicatorElement1.BackColor = System.Drawing.Color.LightGray; this.ProgVolum.IndicatorElement1.BackColor2 = System.Drawing.SystemColors.ControlLight; dtFrom.CustomFormat = dtTo.CustomFormat = Utils.getDayCustomFormat(MainForm2.is24hours, MainForm2.DayFirst); //if (MainForm2.is24hours) //{ // if (MainForm2.DayFirst) // { // dtFrom.CustomFormat = "dd/MM/yyyy HH:mm"; // dtTo.CustomFormat = "dd/MM/yyyy HH:mm"; // } // else // { // dtFrom.CustomFormat = "MM/dd/yyyy HH:mm"; // dtTo.CustomFormat = "MM/dd/yyyy HH:mm"; // } //} //else //{ // if (MainForm2.DayFirst) // { // dtFrom.CustomFormat = "dd/MM/yyyy hh:mm tt"; // dtTo.CustomFormat = "dd/MM/yyyy hh:mm tt"; // } // else // { // dtFrom.CustomFormat = "MM/dd/yyyy hh:mm tt"; // dtTo.CustomFormat = "MM/dd/yyyy hh:mm tt"; // } //} dtFrom.Value = DateTime.Now; dtTo.Value = DateTime.Now; //tabItem1.IsSelected = true; try { setLanguage(); typeRadio = false; ckName.Text = _Name; ID = _ID; userID = _userID; radID = 0; gwandradID = ""; myIP = String.Format("224.20.{0}.1", userID); ((Telerik.WinControls.Primitives.BorderPrimitive)(this.btCollapse.GetChildAt(2))).ForeColor = System.Drawing.Color.Transparent; ((Telerik.WinControls.Primitives.BorderPrimitive)(this.btSound.GetChildAt(2))).ForeColor = System.Drawing.Color.Transparent; ((Telerik.WinControls.Primitives.BorderPrimitive)(this.imgstat.GetChildAt(2))).ForeColor = System.Drawing.Color.Transparent; parent = _parent; mainparent = _mainparent; //BtONOFF.Text = "ON"; PTT_disable(); smdbObj = new SMdb_access(); CheckUserOnOrOFF(); if (MainForm2.LimitedUser) //tbRecord.Visibility = Telerik.WinControls.ElementVisibility.Collapsed; newtab2.Pages.Remove(tbRecord); vehicleListNames = new ArrayList(); foreach (User obj in MainForm2.UsersList) vehicleListNames.Add(obj); vehicleListNames.Sort(new UserComparer()); cbUnitName.DataSource = vehicleListNames; cbUnitName.DisplayMember = "UserName"; if (cbUnitName.Items.Count > 1) cbUnitName.SelectedIndex = 0; } catch (Exception ex) { SM.Debug("dispFrom constructor phase1:" + ex.ToString()); } //load sound settings try { ArrayList tmpSound = smdbObj.GetSoundCards(userID); if (tmpSound.Count > 0) { txAssingKey.Text = tmpSound[2].ToString(); } else { txAssingKey.Text = ""; } txAssingKey.MaxLength = 1; } catch (Exception ex) { SM.Debug("Unable to load sound settings." + ex.ToString()); } try { //iniVoiceComponents(listPlayBDevices, listRecBDevices); StartRadioBus(myIP); checkMessage.RunWorkerAsync(); ChangeState(); } catch (Exception ex) { SM.Debug("dispFrom constructor phase2:" + ex.ToString()); } } private void CheckUserOnOrOFF() { try { if (smdbObj.CheckUserStatus(userID, MainForm2.MyConString)) TurnON(); else TurnOFF(); } catch (Exception ex) { SM.Debug("Unable to check in DB if is only or offline:" + ex.ToString()); } } public void TurnON() { try { lbChanel.Text = wordOnline; //ScreenPanel.BackgroundImage = global::Dispatcher.Properties.Resources.screen_light2_on; ScreenPanel.BackgroundImage = global::Dispatcher.Properties.Resources.screenON; isON = true; isEnabled = true; PTTclicked = false; PTT_enable(); } catch (Exception ex) { SM.Debug("TurnON:" + ex.ToString()); } } public void TurnOFF() { try { lbChanel.Text = wordOffline; //ScreenPanel.BackgroundImage = global::Dispatcher.Properties.Resources.screen_light2; ScreenPanel.BackgroundImage = global::Dispatcher.Properties.Resources.screenOFF; isON = false; isEnabled = false; PTT_disable(); PTTclicked = false; this.imgstat.Image = global::Dispatcher.Properties.Resources.red_status; } catch (Exception ex) { SM.Debug("TurnON:" + ex.ToString()); } } private void radCheckBoxElement1_ToggleStateChanged(object sender, StateChangedEventArgs args) { try { if (!ForceUnCheck) { Selected = ckName.IsChecked; foreach (ShapeNew obj in parent.RadioForms) if (obj.ID != ID) if (obj.Selected) { obj.ForceUnCheck = true; obj.Selected = false; if (obj.typeRadio) ((radioFrom)obj).ckName.IsChecked = false; else ((dispFrom)obj).ckName.IsChecked = false; } } else ForceUnCheck = false; } catch (Exception ex) { SM.Debug("radCheckBoxElement1_ToggleStateChanged:"+ex.ToString()); } } private void btCollapse_Click(object sender, EventArgs e) { ChangeState(); } public Boolean ChangeState() { try { if (Collapse) { //this.Size = new Size(this.Size.Width, 225); switch (MainForm2.radioType) { case RADIOTYPE.MOTO: this.Size = new Size(this.Size.Width, 225); btCollapse.Image = global::Dispatcher.Properties.Resources.minus; break; case RADIOTYPE.HYT: this.Size = new Size(this.Size.Width, 195); this.ScreenPanel.Location = new Point(ScreenPanel.Location.X, 14); this.ScreenPanel.Size = new Size(ScreenPanel.Size.Width, 83); this.btPTT.Size = new Size(btPTT.Size.Width, 78); btCollapse.Image = global::Dispatcher.Properties.Resources.minusOR; break; case RADIOTYPE.HARRIS: this.Size = new Size(this.Size.Width, 195); this.ScreenPanel.Location = new Point(ScreenPanel.Location.X, 14); this.ScreenPanel.Size = new Size(ScreenPanel.Size.Width, 83); this.btPTT.Size = new Size(btPTT.Size.Width, 78); btCollapse.Image = global::Dispatcher.Properties.Resources.minusGR; break; case RADIOTYPE.ATLAS: this.Size = new Size(this.Size.Width, 195); this.ScreenPanel.Location = new Point(ScreenPanel.Location.X, 14); this.ScreenPanel.Size = new Size(ScreenPanel.Size.Width, 83); this.btPTT.Size = new Size(btPTT.Size.Width, 78); btCollapse.Image = global::Dispatcher.Properties.Resources.minusGE; //ATLASCHANGE not sure break; case RADIOTYPE.SIMOCO: // old we don't need change break; } } else { this.Size = new Size(this.Size.Width, 27); switch (MainForm2.radioType) { case RADIOTYPE.MOTO: btCollapse.Image = global::Dispatcher.Properties.Resources.plus; break; case RADIOTYPE.HYT: btCollapse.Image = global::Dispatcher.Properties.Resources.plusOR; break; case RADIOTYPE.HARRIS: btCollapse.Image = global::Dispatcher.Properties.Resources.plusGR; break; case RADIOTYPE.ATLAS: btCollapse.Image = global::Dispatcher.Properties.Resources.plusGE; //ATLASCHANGE not sure break; case RADIOTYPE.SIMOCO: // old we don't need change break; } } Collapse = !Collapse; } catch (Exception ex) { SM.Debug("ChangeState:"+ex.ToString()); } return Collapse; } private void BtONOFF_Click(object sender, EventArgs e) { CheckUserOnOrOFF(); } private void btSound_Click(object sender, EventArgs e) { try { if (VoiceON) { btSound.Image = global::Dispatcher.Properties.Resources.speakerofftest; VoiceON = false; MainForm2.ProrityIP = ""; } else { btSound.Image = global::Dispatcher.Properties.Resources.speakeron; VoiceON = true; } } catch (Exception ex) { SM.Debug("btSound_Click:"+ex.ToString()); } } private void btPTT_MouseDown(object sender, MouseEventArgs e) { try { SendPTT(String.Format("224.20.{0}.1", MainForm2.userIDX)); } catch (Exception ex) { SM.Debug("btPTT_MouseDown:"+ex.ToString()); } } public void SendPTT(String IP) { try { if (isON) { PTTclicked = true; parent.GeneralPTTclick = true; String Totrans = String.Format("#201#{0}#{1}#", userID, IP); WatchList.Add(mainparent.Send_UDP_cmd(Totrans, 10000, 0)); } } catch (Exception ex) { SM.Debug("SendPTT:" + ex.ToString()); } } public void StopPTT(String IP) { try { PTTclicked = false; parent.GeneralPTTclick = false; String Totrans = String.Format("#211#{0}#{1}#", userID, IP); mainparent.Send_UDP_cmd(Totrans, 0, 0); lbStatus.Text = ""; } catch (Exception ex) { SM.Debug("SendPTT:" + ex.ToString()); } } private void btPTT_MouseUp(object sender, MouseEventArgs e) { try { StopPTT(String.Format("224.20.{0}.1", MainForm2.userIDX)); } catch (Exception ex) { SM.Debug("btPTT_MouseUp:" + ex.ToString()); } } private void checkMessage_DoWork(object sender, DoWorkEventArgs e) { try { BackgroundWorker worker = sender as BackgroundWorker; e.Result = Computation(worker, e); } catch (Exception ex) { SM.Debug("Ex:"+ex.ToString()); } } private void checkMessage_ProgressChanged(object sender, ProgressChangedEventArgs e) { try { Int32 dataInt = e.ProgressPercentage; Int32 type = dataInt % 1000; Int32 Id = dataInt / 1000; switch (type) { case 201: lbStatus.Text = ckName.Text + " talking"; PTT_disable(); CheckPatchON(false); RecivedData = true; if (!ShapeNew.receiving_hash.Contains(currentID)) { ShapeNew.receiving_hash.Add(currentID); } break; case 211: lbStatus.Text = ""; RecivedData = false; MainForm2.ProrityIP = ""; parent.SendProrityOFF(PersonalIP); if (ShapeNew.receiving_hash.Contains(currentID)) { ShapeNew.receiving_hash.Remove(currentID); } PTT_enable(); CheckPatchOFF(false); break; case 221: lbStatus.Text = MainForm2.returnLNGString("ready") + " " + ckName.Text; break; } } catch (Exception ex) { SM.Debug("checkMessage_ProgressChanged:" + ex.ToString()); } } long Computation(BackgroundWorker worker, DoWorkEventArgs e) { while (true) { try { foreach (String obj in WatchList) { if (mainparent.Listcmd[obj] == null) ClearList.Add(obj); else { if (!((TimerAndResp)mainparent.Listcmd[obj]).wait) { if (((TimerAndResp)mainparent.Listcmd[obj]).Respose) { Int64 tmp = ((TimerAndResp)mainparent.Listcmd[obj]).intval * 1000 + ((TimerAndResp)mainparent.Listcmd[obj]).typeID; worker.ReportProgress((Int32)tmp); } mainparent.Listcmd.Remove(obj); ClearList.Add(obj); } } } foreach (String obj in ClearList) WatchList.Remove(obj); ClearList.Clear(); } catch (Exception ex) { SM.Debug("Error on radio list" + ex.ToString()); } Thread.Sleep(1); if (MainForm2.ClosingApp) { e.Cancel = true; return 1; } } } private void btnSaveRadioSettings_Click(object sender, EventArgs e) { try { // smdbObj.SaveSoundCardinDB(userID, listPlayBDevices.SelectedText, listRecBDevices.SelectedText, txAssingKey.Text); } catch (Exception ex) { SM.Debug("Unable to save settings in DB:" + ex.ToString()); } } private void UpdatePTT_ALL_enable(Boolean enable) { try { if (enable) { btPTT.Enabled = true; btPTTdisp.Enabled = true; ProgVolum.Value1 = ProgVolum.Maximum - 0 + ProgVolum.Minimum; this.imgstat.Image = global::Dispatcher.Properties.Resources.green_status; lbStatus.Text = ""; ProgVolum.Value1 = ProgVolum.Maximum - 0 + ProgVolum.Minimum; isEnabled = true; } else { btPTT.Enabled = false; btPTTdisp.Enabled = false; this.imgstat.Image = global::Dispatcher.Properties.Resources.yellow_status; isEnabled = false; } } catch (Exception ex) { SM.Debug("UpdatePTT_ALL_enable:" + ex.ToString()); } } public delegate void UpdatePTT_ALL_enableCallBack(Boolean enable); public void PTT_enable() { try { this.Invoke(new UpdatePTT_ALL_enableCallBack(this.UpdatePTT_ALL_enable), true); } catch (Exception ex) { SM.Debug("PTT_enable:"+ex.ToString()); } } public void PTT_disable() { try { this.Invoke(new UpdatePTT_ALL_enableCallBack(this.UpdatePTT_ALL_enable), false); } catch (Exception ex) { SM.Debug("PTT_disable:" + ex.ToString()); } } private void cbPatch_ToggleStateChanged(object sender, StateChangedEventArgs args) { try { if (cbPatch.IsChecked) { MainForm2.PatchList.Add(new patchobj(myIP, this)); isPatch = true; } else { patchobj tmprem = null; foreach (patchobj obj in MainForm2.PatchList) if (obj.ip == myIP) { tmprem = obj; break; } if (tmprem != null) MainForm2.PatchList.Remove(tmprem); isPatch = false; } } catch (Exception ex) { SM.Debug("cbPatch_ToggleStateChanged:" + ex.ToString()); } } public void KeyDown(Int32 valuekey) { try { if ((((Char)valuekey).ToString() == txAssingKey.Text.ToUpper()) && (ReadyfornewKEY)) { ReadyfornewKEY = false; SendPTT(String.Format("224.20.{0}.1", MainForm2.userIDX)); if (isON) PTT_disable(); } } catch (Exception ex) { SM.Debug("KeyDown:"+ex.ToString()); } } public void KeyUP(Int32 valuekey) { try { if (((Char)valuekey).ToString() == txAssingKey.Text.ToUpper()) { ReadyfornewKEY = true; if (isON) PTT_enable(); StopPTT(String.Format("224.20.{0}.1", MainForm2.userIDX)); } } catch (Exception ex) { SM.Debug("KeyUP:" + ex.ToString()); } } private void btPTTdisp_MouseDown(object sender, MouseEventArgs e) { try { SendPTT(String.Format("224.20.{0}.1", MainForm2.userIDX)); MAKESTOPBOOL = false; } catch (Exception ex) { SM.Debug("btPTTdisp_MouseDown:"+ex.ToString()); } } private volatile Boolean MAKESTOPBOOL = true; private void btPTTdisp_Click(object sender, EventArgs e) { try { if (!MAKESTOPBOOL) { StopPTT(String.Format("224.20.{0}.1", MainForm2.userIDX)); MAKESTOPBOOL = true; } } catch (Exception ex) { SM.Debug("btPTTdisp_Click:" + ex.ToString()); } } private void RecordingList_CellClick(object sender, GridViewCellEventArgs e) { try { if ((e.ColumnIndex == 0) && (e.RowIndex >= 0) && (!MainForm2.PlayingFile)) { backtoPlayRow = e.RowIndex; parent.PlayFile(Convert.ToInt32(RecordingList.SelectedRows[0].Cells[1].Value), (Int32)((Convert.ToInt64(RecordingList.SelectedRows[0].Cells[6].Value) - Convert.ToInt64(RecordingList.SelectedRows[0].Cells[5].Value)) / 10000)); RecordingList.Rows[e.RowIndex].Cells[0].Value = global::Dispatcher.Properties.Resources.stop; RecordingList.Refresh(); } } catch (Exception ex) { SM.Debug("Error on click:" + ex.ToString()); if ((MainForm2.radioType == RADIOTYPE.HARRIS) || (MainForm2.radioType == RADIOTYPE.ATLAS)) ((RadLabel)RadMessageBox.Instance.Controls[1]).LabelElement.ForeColor = MainForm2.HarTextColor; RadMessageBox.Show(MainForm2.returnLNGString("unplayFile"), MainForm2.returnLNGString("war"), MessageBoxButtons.OK, RadMessageIcon.Error); } } public void BackToPlay() { try { if (backtoPlayRow != -1) { RecordingList.Rows[backtoPlayRow].Cells[0].Value = global::Dispatcher.Properties.Resources.play; RecordingList.Refresh(); } backtoPlayRow = -1; ProgVolum.Value1 = ProgVolum.Maximum - 0 + ProgVolum.Minimum; } catch (Exception ex) { SM.Debug("Unable to get back volume:" + ex.ToString()); } } int n = -1; Boolean withoutRefresh = false; public void populateRecList(ArrayList recArray) { try { Boolean havedate = false; RecordingList.Columns[3].SortOrder = RadSortOrder.None; foreach (Recording rs in recArray) { if (ckShowLogin.Checked) { if ((rs.gwID == 0) && (((rs.subID == MainForm2.userIDX) && (rs.radioGWID == userID)) || ((rs.subID == userID) && (rs.radioGWID == MainForm2.userIDX)))) { havedate = true; break; } } else if ((rs.gwID == 0) && (rs.subID == userID)) { havedate = true; break; } } //int n = -1; if (havedate) { if (!ckShowLogin.Checked) { RecordingList.Rows.Clear(); n = -1; } else if (!withoutRefresh) { withoutRefresh = true; RecordingList.Rows.Clear(); n = -1; } else { withoutRefresh = false; } RecordingList.Columns[0].HeaderText = ""; foreach (Recording rs in recArray) if (ckShowLogin.Checked) { if ((rs.gwID == 0) && (((rs.subID == MainForm2.userIDX) && (rs.radioGWID == userID)) || ((rs.subID == userID) && (rs.radioGWID == MainForm2.userIDX)))) { n++; RecordingList.Rows.AddNew(); RecordingList.Rows[n].Cells[0].Value = global::Dispatcher.Properties.Resources.play; RecordingList.Rows[n].Cells[1].Value = rs.id; if (rs.subID == userID) RecordingList.Rows[n].Cells[2].Value = ckName.Text; else if (rs.subID == MainForm2.userIDX) RecordingList.Rows[n].Cells[2].Value = MainForm2.userLog; else RecordingList.Rows[n].Cells[2].Value = "Unknow"; RecordingList.Rows[n].Cells[3].Value = rs.startDateTime; RecordingList.Rows[n].Cells[4].Value = rs.endDateTime; RecordingList.Rows[n].Cells[5].Value = rs.startDateTime.ToUniversalTime().Ticks; RecordingList.Rows[n].Cells[6].Value = rs.endDateTime.ToUniversalTime().Ticks; } } else { if ((rs.gwID == 0) && (rs.subID == userID)) { n++; RecordingList.Rows.AddNew(); RecordingList.Rows[n].Cells[0].Value = global::Dispatcher.Properties.Resources.play; RecordingList.Rows[n].Cells[1].Value = rs.id; RecordingList.Rows[n].Cells[2].Value = ckName.Text; RecordingList.Rows[n].Cells[3].Value = rs.startDateTime; RecordingList.Rows[n].Cells[4].Value = rs.endDateTime; RecordingList.Rows[n].Cells[5].Value = rs.startDateTime.ToUniversalTime().Ticks; RecordingList.Rows[n].Cells[6].Value = rs.endDateTime.ToUniversalTime().Ticks; } } RecordingList.Columns[3].SortOrder = RadSortOrder.Descending; RecordingList.Refresh(); RecordingList.TableElement.ScrollToRow(0); } } catch (Exception ex) { SM.Debug("populateRecList erorr:"+ex.ToString()); } } /* private void radTabStrip1_TabSelected(object sender, TabEventArgs args) { try { if (newtab2.SelectedPage.Name == "tbRecord") ChangeList(); } catch (Exception ex) { SM.Debug("radTabStrip1_TabSelected:"+ex.ToString()); } }*/ public void AddRow() { RecordingList.Rows.AddNew(); } private void ChangeList(Int32 imei, Int64 startTime, Int64 stopTime) { try { if (!RadioControl.TCPstarted) { parent.StartTCP(); Thread.Sleep(100); } if (RadioControl.TCPstarted) { Int64 tmp = imei; Byte Imei_1 = (Byte)(tmp / (256 * 256 * 256)); tmp = tmp % (256 * 256 * 256); Byte Imei_2 = (Byte)(tmp / (256 * 256)); tmp = tmp % (256 * 256); Byte Imei_3 = (Byte)(tmp / 256); Byte Imei_4 = (Byte)(tmp % 256); tmp = startTime; Byte startTime_1 = (Byte)(tmp / (256 * 256 * 256)); tmp = tmp % (256 * 256 * 256); Byte startTime_2 = (Byte)(tmp / (256 * 256)); tmp = tmp % (256 * 256); Byte startTime_3 = (Byte)(tmp / 256); Byte startTime_4 = (Byte)(tmp % 256); tmp = stopTime; Byte stopTime_1 = (Byte)(tmp / (256 * 256 * 256)); tmp = tmp % (256 * 256 * 256); Byte stopTime_2 = (Byte)(tmp / (256 * 256)); tmp = tmp % (256 * 256); Byte stopTime_3 = (Byte)(tmp / 256); Byte stopTime_4 = (Byte)(tmp % 256); parent.tcp.Send(new byte[] { 0, 2, 0, (byte)userID, Imei_1, Imei_2, Imei_3, Imei_4, startTime_1, startTime_2, startTime_3, startTime_4, stopTime_1, stopTime_2, stopTime_3, stopTime_4 }); if (ckShowLogin.Checked) parent.tcp.Send(new byte[] { 0, 2, 0, (byte)MainForm2.userIDX, Imei_1, Imei_2, Imei_3, Imei_4, startTime_1, startTime_2, startTime_3, startTime_4, stopTime_1, stopTime_2, stopTime_3, stopTime_4 }); } } catch (Exception ex) { SM.Debug("Error on sent tcp cmd: " + ex.ToString()); } } private void ckShowLogin_ToggleStateChanged(object sender, StateChangedEventArgs args) { ChangeList(0,0,0); } public void BackVolum(Int32 volum) { try { if ((volum > 50) && (volum < 10000)) ProgVolum.Value1 = ProgVolum.Maximum - (Int32)((volum - 50) / 100) + ProgVolum.Minimum; else ProgVolum.Value1 = ProgVolum.Maximum - 0 + ProgVolum.Minimum; } catch(Exception ex) { SM.Debug("BackVolum:"+ex.ToString()); } } private void btPTTdisp_LostMouseCapture(object sender, MouseEventArgs e) { try { if (!MAKESTOPBOOL) { StopPTT(String.Format("224.20.{0}.1", MainForm2.userIDX)); MAKESTOPBOOL = true; } } catch (Exception ex) { SM.Debug("btPTTdisp_LostMouseCapture:" + ex.ToString()); } } private void dispFrom_FormClosing(object sender, FormClosingEventArgs e) { smdbObj.SaveSoundCardinDB(userID, "", "", txAssingKey.Text); } private void newtab2_SelectedPageChanged(object sender, EventArgs e) { try { if (newtab2.SelectedPage.Name == "tbRecord") ChangeList(0,0,0); } catch (Exception ex) { SM.Debug("radTabStrip1_TabSelected:" + ex.ToString()); } } private void dispFrom_Load(object sender, EventArgs e) { } private void ckUnitName_ToggleStateChanged(object sender, StateChangedEventArgs args) { if (this.ckUnitName.Checked) this.cbUnitName.Enabled = true; else this.cbUnitName.Enabled = false; } private void ckDataFilter_ToggleStateChanged(object sender, StateChangedEventArgs args) { if (ckDataFilter.Checked) { dtFrom.Enabled = true; dtTo.Enabled = true; } else { dtFrom.Enabled = false; dtTo.Enabled = false; } } private void btFilter_Click(object sender, EventArgs e) { Int32 imei = 0; Int64 startTime = 0; Int64 stopTime = 0; Boolean Valid = true; if (ckUnitName.Checked) imei = (((RadListDataItem)cbUnitName.Items[cbUnitName.SelectedIndex]).Value as User).Id; if (ckDataFilter.Checked) { if (convDT.GetSecondsFromDT(dtFrom.Value) > convDT.GetSecondsFromDT(dtTo.Value)) { if ((MainForm2.radioType == RADIOTYPE.HARRIS) || (MainForm2.radioType == RADIOTYPE.ATLAS)) ((RadLabel)RadMessageBox.Instance.Controls[1]).LabelElement.ForeColor = MainForm2.HarTextColor; RadMessageBox.Show(msgLimit); Valid = false; } if (Valid) { startTime = convDT.GetSecondsFromDT(dtFrom.Value); stopTime = convDT.GetSecondsFromDT(dtTo.Value); } } if (Valid) ChangeList(imei, startTime, stopTime); } private void btPTT_Click(object sender, EventArgs e) { } } }