224 lines
7.5 KiB
C#
224 lines
7.5 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Drawing;
|
|||
|
using System.Globalization;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Safedispatch_4_0.Radio
|
|||
|
{
|
|||
|
public class Recording
|
|||
|
{
|
|||
|
|
|||
|
public Image callTypeImage
|
|||
|
{
|
|||
|
get { return GetImageFromCallTypeAndDirection(_callType, _callDirection); }
|
|||
|
}
|
|||
|
|
|||
|
private CallType _callType;
|
|||
|
public CallType callType
|
|||
|
{
|
|||
|
get { return this._callType; }
|
|||
|
set
|
|||
|
{
|
|||
|
this._callType = value;
|
|||
|
_callTypeDirectionFilter = this._callType.ToString().Replace('_', ' ') + " " +
|
|||
|
(this._callDirection == CallDirection.INCOMING ? "RECEIVED" : "MADE");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private CallDirection _callDirection;
|
|||
|
public CallDirection callDirection
|
|||
|
{
|
|||
|
get { return this._callDirection; }
|
|||
|
set
|
|||
|
{
|
|||
|
this._callDirection = value;
|
|||
|
_callTypeDirectionFilter = this._callType.ToString().Replace('_', ' ') + " " +
|
|||
|
(this._callDirection == CallDirection.INCOMING ? "RECEIVED" : "MADE");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private string _callTypeDirectionFilter { get; set; }
|
|||
|
public string CallTypeDirectionFilter { get { return _callTypeDirectionFilter; } }
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private string _initial { get; set; }
|
|||
|
public string Initial { get { return _initial; } }
|
|||
|
|
|||
|
private string _username { get; set; }
|
|||
|
public string username {
|
|||
|
get
|
|||
|
{
|
|||
|
return _username;
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
this._username = value;
|
|||
|
_initial = (username.Length > 0 ? username[0].ToString() : "");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private String _from;
|
|||
|
public String From
|
|||
|
{
|
|||
|
get { return _from; }
|
|||
|
set { this._from = value; }
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private String _to;
|
|||
|
public String To
|
|||
|
{
|
|||
|
get { return _to; }
|
|||
|
set { this._to = value; }
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public int duration { get; set; }
|
|||
|
|
|||
|
|
|||
|
private String _gw_and_radioID;
|
|||
|
public String Gw_and_radioID
|
|||
|
{
|
|||
|
get { return _gw_and_radioID; }
|
|||
|
set { _gw_and_radioID = value; }
|
|||
|
}
|
|||
|
|
|||
|
private String gatewayName = "";
|
|||
|
public String GatewayName
|
|||
|
{
|
|||
|
get { return gatewayName; }
|
|||
|
set { gatewayName = value; }
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private DateTime _dateTimeStart { get; set; }
|
|||
|
public DateTime DateTimeStart { get { return _dateTimeStart; } }
|
|||
|
|
|||
|
private DateTime _dateStart { get; set; }
|
|||
|
public DateTime DateStart { get { return _dateStart; } }
|
|||
|
|
|||
|
private double _dateUnix70;
|
|||
|
public double dateUnix70
|
|||
|
{
|
|||
|
get { return _dateUnix70; }
|
|||
|
set
|
|||
|
{
|
|||
|
this._dateUnix70 = value;
|
|||
|
DateTime now = DateTime.Now;
|
|||
|
DateTime unixNow = DateTime.UtcNow;
|
|||
|
TimeSpan sp = now - unixNow;
|
|||
|
|
|||
|
DateTime thatTime = ((new DateTime(1970, 1, 1, 0, 0, 0)).AddSeconds(this._dateUnix70)).AddSeconds(sp.TotalSeconds);
|
|||
|
_dateTimeStart = DateTime.ParseExact(thatTime.ToString("MM:dd:yyyy HH:mm:ss"), "MM:dd:yyyy HH:mm:ss", CultureInfo.CurrentCulture);
|
|||
|
_dateStart = _dateTimeStart.Date;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private DateTime _dateEnd { get; set; }
|
|||
|
public DateTime DateEnd { get { return _dateEnd; } }
|
|||
|
|
|||
|
private DateTime _dateTimeEnd { get; set; }
|
|||
|
public DateTime DateTimeEnd
|
|||
|
{
|
|||
|
get { return _dateTimeEnd; }
|
|||
|
set
|
|||
|
{
|
|||
|
_dateTimeEnd = value;
|
|||
|
_dateEnd = new DateTime(_dateTimeEnd.Year, _dateTimeEnd.Month, _dateTimeEnd.Day, 0,0,0);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
private Int64 _recID { get; set; }
|
|||
|
public Int64 RecID
|
|||
|
{
|
|||
|
get { return _recID; }
|
|||
|
set
|
|||
|
{
|
|||
|
this._recID = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private string _file_Name { get; set; }
|
|||
|
public string File_Name
|
|||
|
{
|
|||
|
get { return _file_Name; }
|
|||
|
set
|
|||
|
{
|
|||
|
this._file_Name = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public Recording()
|
|||
|
{
|
|||
|
_callType = CallType.GROUP_CALL;
|
|||
|
_callDirection = CallDirection.INCOMING;
|
|||
|
username = "unknown";
|
|||
|
duration = 0;
|
|||
|
dateUnix70 = DateTime.Now.Subtract(new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
|
|||
|
}
|
|||
|
|
|||
|
private static Image GetImageFromCallTypeAndDirection(CallType callType, CallDirection callDirection)
|
|||
|
{
|
|||
|
Image toReturnImage = Dispatcher.Properties.Resources.r_call_dispatcher;
|
|||
|
switch(callType)
|
|||
|
{
|
|||
|
case CallType.ALL_CALL: toReturnImage = (callDirection == CallDirection.INCOMING ?
|
|||
|
Dispatcher.Properties.Resources.r_call_received_all : Dispatcher.Properties.Resources.r_call_made_all); break;
|
|||
|
case CallType.GROUP_CALL: toReturnImage = (callDirection == CallDirection.INCOMING ?
|
|||
|
Dispatcher.Properties.Resources.r_call_received_group : Dispatcher.Properties.Resources.r_call_made_group); break;
|
|||
|
case CallType.PRIVATE_CALL: toReturnImage = (callDirection == CallDirection.INCOMING ?
|
|||
|
Dispatcher.Properties.Resources.r_call_received_private : Dispatcher.Properties.Resources.r_call_made_private); break;
|
|||
|
case CallType.DISPATCHER_CALL: toReturnImage = (callDirection == CallDirection.INCOMING ?
|
|||
|
Dispatcher.Properties.Resources.r_call_received_dispatcher : Dispatcher.Properties.Resources.r_call_made_dispatcher); break;
|
|||
|
case CallType.REMOTE_MONITORING: toReturnImage = (callDirection == CallDirection.INCOMING ?
|
|||
|
Dispatcher.Properties.Resources.r_call_received_remote : Dispatcher.Properties.Resources.r_call_made_remote); break;
|
|||
|
default: toReturnImage = Dispatcher.Properties.Resources.r_call_dispatcher; break;
|
|||
|
}
|
|||
|
|
|||
|
return toReturnImage;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public enum CallType { ALL_CALL = 1, GROUP_CALL = 3, PRIVATE_CALL = 4, DISPATCHER_CALL = 2, REMOTE_MONITORING = 5, PRIVATE_TO_PRIVATE = 6 };
|
|||
|
public enum CallDirection { INCOMING, OUTGOING };
|
|||
|
|
|||
|
|
|||
|
public class CallTypeBindingList : BindingList<String>
|
|||
|
{
|
|||
|
public CallTypeBindingList()
|
|||
|
{
|
|||
|
this.Add(MainForm2.returnLNGString("prvCallM"));
|
|||
|
this.Add(MainForm2.returnLNGString("grpCallM"));
|
|||
|
this.Add(MainForm2.returnLNGString("allCallM"));
|
|||
|
this.Add(MainForm2.returnLNGString("dispCallM"));
|
|||
|
this.Add(MainForm2.returnLNGString("prvCallR"));
|
|||
|
this.Add(MainForm2.returnLNGString("grpCallR"));
|
|||
|
this.Add(MainForm2.returnLNGString("allCallR"));
|
|||
|
this.Add(MainForm2.returnLNGString("dispCallR"));
|
|||
|
this.Add(MainForm2.returnLNGString("remotemonitor"));
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
public CallTypeBindingList()
|
|||
|
{
|
|||
|
this.Add("Private call made");
|
|||
|
this.Add("Group call made");
|
|||
|
this.Add("All call made");
|
|||
|
this.Add("Dispatcher call made");
|
|||
|
this.Add("Private call received");
|
|||
|
this.Add("Group call received");
|
|||
|
this.Add("All call received");
|
|||
|
this.Add("Dispatcher call received");
|
|||
|
this.Add("Remote Monitor");
|
|||
|
}*/
|
|||
|
}
|
|||
|
}
|