Ejemplo n.º 1
0
 private void homenetToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (mContactBook.getCandidatesForJabberID(mUserAccount.JabberUser.JID).Count > 0)
     {
         myContactWindow = new ContactsWindow(this, (NTContact)mContactBook.getCandidatesForJabberID(mUserAccount.JabberUser.JID)[0], null);
         myContactWindow.FormClosing += new FormClosingEventHandler(myContactWindow_FormClosing);
         myContactWindow.Show();
     }
     else
     {
         StartNewContact(mUserAccount.Username);
     }
 }
Ejemplo n.º 2
0
        public void StartNewContact(String jabberID)
        {
            try
            {
                Hashtable properties = new Hashtable();
                if (jabberID != null)
                {
                    int dummy;
                    if (Int32.TryParse(jabberID, out dummy))
                    {
                        properties.Add("NTHomeTelephoneNumber", jabberID);
                    }
                    else
                    {
                        properties.Add("NTJabberID", jabberID);
                    }

                    myContactWindow = new ContactsWindow(this, null, properties);
                    myContactWindow.FormClosing += new FormClosingEventHandler(myContactWindow_FormClosing);
                    myContactWindow.Show();
                }
            }
            catch (Exception ex)
            {
#if (TRACE)
                Console.WriteLine("StartNewContact : " + ex.Message);
#endif
            }
        }
Ejemplo n.º 3
0
        private void myCallHistory_AddContactToolStripItem_Click(object sender, EventArgs e)
        {
            RadListBoxItem selectedItem = (RadListBoxItem)myCallHistoryListBox.SelectedItem;
            if (selectedItem != null)
            {
                CallRecord selectedCallRecord = (CallRecord)selectedItem.Tag;
                Hashtable properties = new Hashtable();
                if (selectedCallRecord != null)
                {
                    int dummy;
                    if (Int32.TryParse(selectedCallRecord.NumberOrUsername, out dummy))
                    {
                        properties.Add("NTHomeTelephoneNumber", selectedCallRecord.NumberOrUsername);
                    }
                    else
                    {
                        properties.Add("NTJabberID", selectedCallRecord.NumberOrUsername);
                    }

                    myContactWindow = new ContactsWindow(this, null, properties);
                    myContactWindow.FormClosing += new FormClosingEventHandler(myContactWindow_FormClosing);
                    myContactWindow.Show();
                }
            }
        }
Ejemplo n.º 4
0
 private void myMenuAddContactToolStripButton_Click(object sender, EventArgs e)
 {
     myContactWindow = new ContactsWindow(this, null, null);
     myContactWindow.FormClosing += new FormClosingEventHandler(myContactWindow_FormClosing);
     myContactWindow.Show();
 }
Ejemplo n.º 5
0
 private void viewContactContactsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     RadListBoxItem selectedItem = (RadListBoxItem)myContactsListBox.SelectedItem;
     if (selectedItem != null)
     {
         NTContact selectedContact = (NTContact)selectedItem.Tag;
         myContactWindow = new ContactsWindow(this, selectedContact, null);
         myContactWindow.FormClosing += new FormClosingEventHandler(myContactWindow_FormClosing);
         myContactWindow.Show();
     }
 }
Ejemplo n.º 6
0
 private void viewContactPropertiesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (myRosterListTreeView.SelectedNode != null)
     {
         if (myRosterListTreeView.SelectedNode.Level == 1)
         {
             Hashtable properties = new Hashtable();
             properties.Add("NTJabberID", myRosterListTreeView.SelectedNode.Tag.ToString());
             myContactWindow = new ContactsWindow(this, mContactBook.getCandidatesForJabberID(myRosterListTreeView.SelectedNode.Tag.ToString()).Count > 0 ? (NTContact)mContactBook.getCandidatesForJabberID(myRosterListTreeView.SelectedNode.Tag.ToString())[0] : null, properties);
             myContactWindow.FormClosing += new FormClosingEventHandler(myContactWindow_FormClosing);
             myContactWindow.Show();
         }
     }
 }
Ejemplo n.º 7
0
        private void xmppControl_OnSubscriptionRequest(object sender, XmppsSubscriptionRequestEventArgs e)
        {
            if (this.InvokeRequired)
            {
                BeginInvoke(new xmppControl_OnSubscriptionRequestDelegate(xmppControl_OnSubscriptionRequest), new object[] { sender, e });
                return;
            }

            try
            {
                if (e == null || !xmppControl.Connected) return;
#if (TRACE)
                Console.WriteLine("IM-SubscriptionRequest:" + "(" + e.From + ")");     
#endif

                if (mContactBook.getCandidatesForJabberID(e.From + @"@" + e.Domain).Count > 0)
                {
                    e.Accept = true;
                    xmppControl.SubscribeTo(e.From + @"@" + e.Domain);
                }
                else
                {
                    if (MessageBox.Show(
                       String.Format(Properties.Localization.txtInfoIMSubcriptionRequestDesc, e.From),
                        Properties.Localization.txtInfoIMSubcriptionRequest,
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question,
                        MessageBoxDefaultButton.Button1
                        ) == DialogResult.Yes)
                    {
                        e.Accept = true;
                    }
                    if (MessageBox.Show(
                        String.Format(Properties.Localization.txtInfoAddToContactDesc, e.From),
                       Properties.Localization.txtInfoAddToContact,
                        MessageBoxButtons.YesNo,
                        MessageBoxIcon.Question,
                        MessageBoxDefaultButton.Button1
                        ) == DialogResult.Yes)
                    {
                        Hashtable properties = new Hashtable();
                        properties.Add("NTJabberID", e.From + @"@" + e.Domain);
                        myContactWindow = new ContactsWindow(this, null, properties);
                        myContactWindow.FormClosing += new FormClosingEventHandler(myContactWindow_FormClosing);
                        myContactWindow.Show();
                    }
                }
            }
            catch (Exception ex)
            {
#if (TRACE)
                Console.WriteLine("xmppControl_OnSubscriptionRequest : " + ex.Message);     
#endif
            }
        }
Ejemplo n.º 8
0
 private void myContactsListBox_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (myContactsListBox.SelectedItem != null)
         {
             Telerik.WinControls.UI.RadListBoxItem clickedItem = (Telerik.WinControls.UI.RadListBoxItem)myContactsListBox.SelectedItem;
             myContactWindow = new ContactsWindow(this, (NTContact)clickedItem.Tag, null);
             myContactWindow.FormClosing += new FormClosingEventHandler(myContactWindow_FormClosing);
             myContactWindow.Show();
         }
     }
 }
Ejemplo n.º 9
0
 void tmplContactListItem_DoubleClick(object sender, EventArgs e)
 {
     Telerik.WinControls.UI.RadListBoxItem clickedItem = (Telerik.WinControls.UI.RadListBoxItem)sender;
     myContactWindow = new ContactsWindow(this, (NTContact)clickedItem.Tag, null);
     myContactWindow.FormClosing += new FormClosingEventHandler(myContactWindow_FormClosing);
     myContactWindow.Show();
 }