// ************************************************************************** // AddGroup () // // Description: // Adds a group that was created during document load from disk or during a // cut and paste operation to the document. // // Parameters: // CKGroup *pGroup Pointer to group object // // Returns: // void // ************************************************************************** void CKDocument::AddGroup (CKGroup *pGroup) { // Get the currently selected server object: CKServer *pServer = GetSelectedServer (); ASSERT (pGroup != NULL); ASSERT (pServer != NULL); // Get current name of group: CString strName (pGroup->GetName ()); // Generate a unique name for the group: if (pServer->GenerateGroupName (strName)) pGroup->SetName (strName); // Add the group to the selected server: pServer->AddGroup (pGroup); // Start the group (add all OPC items): pGroup->Start (); // Notify all views that new group has been added: UpdateAllViews (NULL, HINT_ADD_GROUP, pGroup); // Set the document modified flag: SetModified (); }
void NetClientConfig::CreateConnection() { NetServerInfo* s = GetSelectedServer(); if (s) { NetAddr addr = s->addr; if (conn) { if (conn->GetServerAddr().IPAddr() != addr.IPAddr() || conn->GetServerAddr().Port() != addr.Port()) { conn->Logout(); DropConnection(); } } if (addr.IPAddr() && addr.Port() && !conn) { conn = new(__FILE__,__LINE__) NetLobbyClient; // (addr); } } else if (conn) { conn->Logout(); DropConnection(); } }
// ************************************************************************** // AddGroup () // // Description: // Allows for the addition of a new group to a server item. The group will // be attached the server's group list. // // Parameters: // none // // Returns: // void // ************************************************************************** void CKDocument::AddGroup () { // Get the currently selected server object: CKServer *pServer = GetSelectedServer (); ASSERT (pServer != NULL); // Create a group property sheet. Pass it a pointer to the currently // selected server so that it can add the new group to it. CKGroupPropertySheet psh (pServer); // Show as modal property sheet. If user hits "OK", we need to set // document modified flag. Property sheet object will add new group to // server object if "OK" is hit. if (psh.DoModal () == IDOK) { // Notify all views that new group has been added: UpdateAllViews (NULL, HINT_ADD_GROUP, psh.GetGroup ()); // Set document modified flag: SetModified (); } }