-
Notifications
You must be signed in to change notification settings - Fork 0
/
MicroClientDoc.cpp
125 lines (95 loc) · 3.01 KB
/
MicroClientDoc.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
// MicroClientDoc.cpp : implementation of the CMicroClientDoc class
//
#include "stdafx.h"
#include "MicroClient.h"
#include "BaseAgent.h"
#include "DSetupDlg.h"
#include "MicroClientDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//FILE* fp;
/////////////////////////////////////////////////////////////////////////////
// CMicroClientDoc
IMPLEMENT_DYNCREATE(CMicroClientDoc, CDocument
)
BEGIN_MESSAGE_MAP(CMicroClientDoc, CDocument
)
//{{AFX_MSG_MAP(CMicroClientDoc)
ON_COMMAND(ID_CONNECT, OnConnect)
ON_UPDATE_COMMAND_UI(ID_CONNECT, OnUpdateConnect)
ON_COMMAND(ID_DISCONNECT, OnDisconnect)
ON_UPDATE_COMMAND_UI(ID_DISCONNECT, OnUpdateDisconnect)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMicroClientDoc construction/destruction
CMicroClientDoc::CMicroClientDoc() {
// TODO: add one-time construction code here
}
CMicroClientDoc::~CMicroClientDoc() {
}
BOOL CMicroClientDoc::OnNewDocument() {
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
m_pAgent = new CBaseAgent(this);
// fp=fopen("cht.doc","w");
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CMicroClientDoc serialization
void CMicroClientDoc::Serialize(CArchive &ar) {
if (ar.IsStoring()) {
// TODO: add storing code here
} else {
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CMicroClientDoc diagnostics
#ifdef _DEBUG
void CMicroClientDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CMicroClientDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CMicroClientDoc commands
void CMicroClientDoc::OnConnect() {
// TODO: Add your command handler code here
// m_pAgent->Connect();
DSetupDlg Dialog;//�������öԻ���
// ask the user for the name of the team and the server
Dialog.m_TeamName = _T("�ɶ�����ѧ");
Dialog.m_ServerName = _T("jack");
Dialog.m_Channel = 6000;//ÿ����Ĭ�ϵ�ͨ��ʹ��Ƶ��
// user can repeat with a different address
while (TRUE) {
// try to connect
if (m_pAgent->ConnectAgent(Dialog.m_TeamName, Dialog.m_ServerName, Dialog.m_Channel))
return;//TRUE;
if (Dialog.DoModal() != IDOK)
return;//FALSE;
}
m_pAgent->teamname = Dialog.m_TeamName;
}
void CMicroClientDoc::OnUpdateConnect(CCmdUI *pCmdUI) {
// TODO: Add your command update UI handler code here
//pCmdUI->
}
void CMicroClientDoc::OnDisconnect() {
// TODO: Add your command handler code here
// fclose(fp);
}
void CMicroClientDoc::OnUpdateDisconnect(CCmdUI *pCmdUI) {
// TODO: Add your command update UI handler code here
//pCmdUI->
}