📄 form1.cs
字号:
E_CHG_CIDExBuf = 0x001f,
E_CHG_RxPhoNumBuf = 0x0020,
E_CHG_PolarRvrsCount = 0x0021,
E_SYS_RemotePickup = 0x0022,
E_CHG_FlashCount = 0x0023,
E_CHG_HookState = 0x0024,
E_CHG_ToneAnalyze = 0x0025,
E_OverallEnergy = 0x0026,
E_CHG_OvrlEnrgLevel = 0x0027,
E_CHG_BusyTone = 0x0028,
E_CHG_BusyToneEx = 0x0029,
E_CHG_VocFxFlag = 0x002a,
E_CHG_ToneValue = 0x002b,
E_CHG_RingEchoToneTime = 0x002c,
E_CHG_PeakFrq = 0x002d,
E_SYS_BargeIn = 0x002e,
E_SYS_NoSound = 0x002f,
E_SYS_TIMEOUT = 0x0030,
E_CHG_SpyState = 0x0031,
E_CHG_SpyLinkStatus = 0x0032,
E_RCV_DTR_AUDIO = 0x0033,
E_RCV_DTR_HOOK = 0x0034,
E_RCV_DTR_LAMP = 0x0035,
E_RCV_DTR_FKEY = 0x0036,
E_RCV_DTR_DKEY = 0x0037,
E_RCV_DTR_VOX = 0x0038,
E_RCV_DTR_DISPLAY = 0x0039,
E_RCV_DTR_DIRECTION = 0x003a,
E_RCV_DTR_RING = 0x003b,
E_CHG_CICRxPhoNumBuf = 0x003c,
E_CHG_CICState = 0x003d,
E_PROC_CICAutoDial = 0x003e,
E_RCV_Ss7IsupUtuinf = 0x003f,
E_CHG_Mtp2Status = 0x0040,
E_RCV_DSTDChannel = 0x0041,
MAX_EVENT_SIZE
};
public const int E_PROC_AutoDial = 0x0019;
//self-defined message
enum FaxMsg
{
E_MSG_FAX_IDLE = 0x0040, //fax channel gets idle event
E_MSG_SEND_FAX=0x0041, //
E_MSG_RCV_FAX=0x0042,
E_MSG_HAVETASK=0x0043, //have a fax task
E_MSG_OFFLINE=0x0044, //bus between fax channel and trunk channel is offline
};
enum AutoDial
{
DIAL_STANDBY = 0,
DIAL_DIALING = 1,
DIAL_ECHOTONE = 2,
DIAL_NO_DIALTONE = 3,
DIAL_BUSYTONE = 4,
DIAL_ECHO_NOVOICE = 5,
DIAL_NOVOICE = 6,
DIAL_VOICE = 7,
DIAL_VOICEF1 = 8,
DIAL_VOICEF2 = 9,
DIAL_NOANSWER = 10,
DIAL_FAILURE = 11,
DIAL_INVALID_PHONUM = 12,
};
[StructLayout(LayoutKind.Sequential)]public struct FAX_FILE_SCT
{
[MarshalAs(UnmanagedType.ByValTStr,SizeConst=256)]
public string szFileName;
public int nStartPage;
public int nEndPage;
public int nReserve1;
public int nReserve2;
};
FAX_FILE_SCT[] ffSCT=new FAX_FILE_SCT[50];
[StructLayout(LayoutKind.Sequential)]public struct EVENT_SET_INFO
{
public uint dwWorkMode;
public IntPtr lpHandlerParam;
public uint dwOutCondition;
public uint dwOutParamVal;
public uint dwUser;
};
[StructLayout(LayoutKind.Sequential )]public struct FAX_STRUCT
{
public bool bUseful; //channel seizure flag: FALSE- not seized TRUE-seized
public string szChErrMsg; //error message
public string szPage; //number of fax pages
public string szGetID; //ID of the receiver's fax machine
public int nDirection; //fax direction : 0-send 1-receive
public int nStep; //user-defined fax channel state
public int nAnswered; //check whether press start-up button : 0-no 1-yes
public string szRcvPathFile; //file name received(include path)
public string szSendFile; //file name to be sent
public string szSendPath; //path for sending fax file
public int nStartPage; //start page
public int nEndPage; //end page
public int nCheckEnd; //test execution result of faxing task
public int nTrunkCh; //trunk channel ID linked to fax channel
public int nHowFile; //modes of sending fax file: 0-single file 1-multi-file 2- multi-file with page number
public int nSCTNumber; //number of files in ffSCT format
public FAX_FILE_SCT[] pffSCT;
public int nAllBytes; //total number of bytes to be sent
public int nSendBytes; //number of bytes sent
public int nRcvBytes; //number of bytes received
};
FAX_STRUCT[] m_FaxCh=new FAX_STRUCT[500];
[StructLayout(LayoutKind.Sequential)]public struct FAX_TASK
{
public int nTrkCh; //trunk channel
public int nFaxCh; //fax channel
public string szCallNo; //called party number
public int nStartPage; //start page
public int nEndPage; //end page
//multi-file structure-see 'shpa3api.h' for detailed information
public FAX_FILE_SCT[] ffSCT; //[50];
//modes of sending fax file:
// 0-single file 1-multi-file 2- multi-file with page number
public int nHowFile;
// number of files in ffSCT format
public int nSCTNumber;
public string szSendFile; //file name sending
public string szSendPath; //path for sending file
}
[StructLayout(LayoutKind.Sequential)]public struct TRUNK_STRUCT
{
public bool bEnCalled; //enable or disenable calling: TRUE-enable FALSE-forbid
public bool bRecord; //recording or not : TRUE-record FALSE-not record
public int nCallFlag; //inbound or outbound call : 0-inbound 1-call outbound
public int nLineState; //channel state
public string szChErrMsg; //error message
public string szCallNo; //called party number
public string szCallerId; //calling party number
public char[] szDtmf; //DTMF received
public int nToFaxCh; //fax channel connected with trunk channel by bus
public int nStep; //user-defined trunk channel state
public int nAutoOrNot; //faxing mode: 0- automatic 1- manual
public bool bUseful; //channel seizure flag: FALSE- not seized TRUE-seized
public int nIndex; //Which number is the received DTMF?
public char szDtmfChose;//[1]; //stored the first received DTMF of "1" or "2"
public int nFirstDtmf; //check if it is the first received DTMF "1" or "2"
public int nTimer; //timer ID
public bool bLinked;
};
TRUNK_STRUCT[] m_TrkCh=new TRUNK_STRUCT[500];
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.ComboBox m_cmbTrkChNo;
private System.Windows.Forms.ComboBox m_cmbTrkCh;
private System.Windows.Forms.ComboBox m_cmbFaxChNo;
private System.Windows.Forms.ComboBox m_cmbFaxCh;
public bool m_bLog;
public bool m_bRecord;
public int m_nAutoOrNot = -1;
public string m_szAppendFile;
public int m_nTotalCh;
string path = "fax.log";
string path1="temp.log";
int m_nHowFile;
int nStartPage;
int nEndPage;
int nSCTNumber; //number of multi-file
Queue faxQueue;
IntPtr hwnd;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
m_szAppendFile="";
m_strAppendFile.Text="";
m_bRecord=false;
m_nHowFile=-1;
nStartPage = 1;
nEndPage = -1;
nSCTNumber=0;
//set up a vacant queue
faxQueue=new Queue();
if(!InitCtiBoard())
{
Dispose(true);
}
InitFaxChListCtrl(); //initialize fax channel list
InitTrunkChListCtrl(); //initialize trunk channel list
UpdateFaxChListCtrl(); //update fax channel list
UpdateTrunkChListCtrl();//update trunk channel list
radioButton2.Checked =true;
radioButton4.Checked =true;
radioButton6.Checked = true;
m_nHowFile = 0;
this.label12.Hide();
this.m_txtSendPath.Hide ();
this.m_btnSendPath .Hide();
this.m_ListBox.Hide();
this.m_BtnAdd.Hide();
this.m_BtnDel.Hide();
//set event_message programming mode
EVENT_SET_INFO EventSet=new EVENT_SET_INFO();
EventSet.dwWorkMode = (int)ShMsg.EVENT_MESSAGE;
EventSet.lpHandlerParam = this.Handle ;
SsmSetEvent(-1, -1, true, ref EventSet);
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new ElapsedEventHandler(OnTimer);
aTimer.Interval = 200;
aTimer.Enabled = true;
hwnd= this.Handle ;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if(SsmCloseCti() == -1)
MessageBox.Show("Fail to call SsmCloseCti");
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton3 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button3 = new System.Windows.Forms.Button();
this.m_strAppendFile = new System.Windows.Forms.TextBox();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.m_cmbFaxChNo = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.radioButton5 = new System.Windows.Forms.RadioButton();
this.radioButton4 = new System.Windows.Forms.RadioButton();
this.m_cmbTrkChNo = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.m_cmbTrkCh = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.button4 = new System.Windows.Forms.Button();
this.m_txtSetFaxID = new System.Windows.Forms.TextBox();
this.m_cmbFaxCh = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.m_TabCtrl = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.m_txtRcvFile = new System.Windows.Forms.TextBox();
this.m_txtRcvFile0 = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.button5 = new System.Windows.Forms.Button();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.button10 = new System.Windows.Forms.Button();
this.m_BtnDel = new System.Windows.Forms.Button();
this.m_BtnAdd = new System.Windows.Forms.Button();
this.m_ListBox = new System.Windows.Forms.ListBox();
this.m_txtEndPage = new System.Windows.Forms.TextBox();
this.label14 = new System.Windows.Forms.Label();
this.m_txtStartPage = new System.Windows.Forms.TextBox();
this.label13 = new System.Windows.Forms.Label();
this.m_btnSendPath = new System.Windows.Forms.Button();
this.m_txtSendPath = new System.Windows.Forms.TextBox();
this.label12 = new System.Windows.Forms.Label();
this.m_btnSendFile = new System.Windows.Forms.Button();
this.m_txtSendFile = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.radioButton8 = new System.Windows.Forms.RadioButton();
this.radioButton7 = new System.Windows.Forms.RadioButton();
this.radioButton6 = new System.Windows.Forms.RadioButton();
this.m_txtCallNo = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.m_cmbFaxCh1 = new System.Windows.Forms.ComboBox();
this.label9 = new System.Windows.Forms.Label();
this.m_cmbTrkCh1 = new System.Windows.Forms.ComboBox();
this.label8 = new System.Windows.Forms.Label();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.button14 = new System.Windows.Forms.Button();
this.button13 = new System.Windows.Forms.Button();
this.button12 = new System.Windows.Forms.Button();
this.FileShow = new System.Windows.Forms.Button();
this.m_txtTargetFile = new System.Windows.Forms.TextBox();
this.m_txtDataTime = new System.Windows.Forms.TextBox();
this.m_txtFaxSubject = new System.Windows.Forms.TextBox();
this.m_txtFaxTo = new System.Windows.Forms.TextBox();
this.m_txtFaxFrom = new System.Windows.Forms.TextBox();
this.m_txtTifName = new System.Windows.Forms.TextBox();
this.label20 = new System.Windows.Forms.Label();
this.label19 = new System.Windows.Forms.Label();
this.label18 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -