Esempio n. 1
0
        // Add a new group (a group is added only to the GUI, if no contact is put in it the group will be lost)
        private void addGroupToolStripMenuItem_Click(object sender, EventArgs e) {
            AddGroup dialog = new AddGroup();
            if(dialog.ShowDialog() == DialogResult.OK) {                
				Group newGroup = new Group(dialog.nameTextBox.Text);
				newGroup.ContextMenuStrip = gropupContextMenuStrip;
				contactsTreeView.Nodes.Add(newGroup);
            }
        }
Esempio n. 2
0
		// Update contact's information
		public void UpdateContact(String jid, String name, String group, Status status) {
			Console.WriteLine("Adding: " + jid + ", " + name+ ", " + group + ", " + status);

			// Find group
			Group groupNode;
			if(group == null)										// If no group is sent use default(0)
				groupNode = (Group)contactsTreeView.Nodes[0];
			else {															// Group is sent
				if(!contactsTreeView.Nodes.ContainsKey(group)) {			// If the group doesn't exists
					Group newGroup = new Group(group);
					newGroup.ContextMenuStrip = gropupContextMenuStrip;
					contactsTreeView.Nodes.Add(newGroup);					// Make one					
				}
				groupNode = (Group)contactsTreeView.Nodes[group];	// we have Group
			}

			// Find contact
			Contact contact;
			if(contacts.ContainsKey(jid)) {					// Such contact exists
				contact = contacts[jid];					// use it
				if(contact.Parent != groupNode) {			// We should change group
					contact.Remove();						// Remove from original
					groupNode.Nodes.Add(contact);			// Add to new
				}
			} else {
				contact = new Contact(jid);			// else make it
				contacts[jid] = contact;			// Put it in the dictionary

				// Set context menu
				if(status != Status.inviteSent && status != Status.inviteAccepted)
					contact.ContextMenuStrip = this.contactsContextMenuStrip;
				else
					contact.ContextMenuStrip = this.pendingContactContextMenuStrip;

				groupNode.Nodes.Add(contact);		// and add it to gui
			}			
			contact.Name = name;
			contact.Status = status;			
		}
Esempio n. 3
0
		// Update the gui to a connected state
		private void connectGUI() {
			this.stopConnectingGUI();

			// Enable contacts strip
			foreach(ToolStripItem item in this.contactsToolStrip.Items) {
				item.Enabled = true;
			}

			// Update visual components
			this.connectTrayMenuItem.Text = "Disconnect";
			this.connectTrayMenuItem.Image = global::Goodware.Jabber.GUI.Properties.Resources.disconnect;
			this.connectToolStripButton.Image = global::Goodware.Jabber.GUI.Properties.Resources.disconnect;
			this.connectToolStripButton.ToolTipText = "Disconnect";
			this.connectedStatus.Text = "Connected";
			this.connectedStatus.Image = global::Goodware.Jabber.GUI.Properties.Resources.connect;
			this.connectToolStripMenuItem.Text = "Disconnect";
			this.connectToolStripMenuItem.Image = global::Goodware.Jabber.GUI.Properties.Resources.disconnect;
			this.trayIcon.Icon = global::Goodware.Jabber.GUI.Properties.Resources.lightbulbico;
			this.optionsToolStripButton.Enabled = false;
			this.statusToolStripDropDownButton.Enabled = true;
			this.statusMessageToolStripComboBox.Enabled = true;
			this.contactsTreeView.ContextMenuStrip = contactsViewContextMenuStrip;
			this.Text = model.User + "@" + model.ServerName + " - JustTalk";
			this.trayIcon.Text = "Connected";

			// Initialize the structures needed
			Group def = new Group("Default Group");
			def.ContextMenuStrip = defaultGroupContextMenuStrip;
			contactsTreeView.Nodes.Add(def);
			contactsTreeView.TreeViewNodeSorter = Comparer<IComparable>.Default;	// Sorter to sort the contacts in the groups
			conversations = new Dictionary<string, ConverstationWindow>();
			contacts = new Dictionary<string, Contact>();
			groupChats = new Dictionary<string, GroupchatWindow>();
			
			this.connected = true;			// Set state to connected
		}