コード例 #1
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            CBuddyRecord record;

            if (BuddyId >= 0)
            {
                record = CBuddyList.getInstance().getRecord(BuddyId);
                CBuddyList.getInstance().deleteRecord(BuddyId);
            }
            else
            {
                if (textBoxNumber.Text.Length == 0)
                {
                    return;
                }

                record = new CBuddyRecord();
            }
            record.FirstName = textBoxName.Text;
            //record.LastName = _lname.Caption;
            record.Number          = textBoxNumber.Text;
            record.PresenceEnabled = checkBoxPresence.Checked;

            CBuddyList.getInstance().addRecord(record);
            CBuddyList.getInstance().save();

            Close();
        }
コード例 #2
0
        private void buttonSendIM_Click(object sender, EventArgs e)
        {
            if (BuddyId == -1)
            {
                return;
            }

            // get buddy data form _buddyId
            CBuddyRecord buddy = CBuddyList.getInstance()[BuddyId];

            if (buddy != null)
            {
                // Invoke SIP stack wrapper function to send message
                SensipResources.Messenger.sendMessage(buddy.Number, textBoxChatInput.Text);

                richTextBoxChatHistory.Text += "(me) " + DateTime.Now;

                //Font orgfnt = richTextBoxChatHistory.Font;
                //Font fnt = new Font("Microsoft Sans Serif",16,FontStyle.Bold);
                //richTextBoxChatHistory.Font = fnt;
                richTextBoxChatHistory.Text += ": " + textBoxChatInput.Text;
                //richTextBoxChatHistory.Font = orgfnt;
                richTextBoxChatHistory.Text += Environment.NewLine;

                textBoxChatInput.Clear();
            }
        }
コード例 #3
0
ファイル: phonebook.cs プロジェクト: ximendatie/sensip
        public void initialize()
        {
            XmlDocument xmlDocument = new XmlDocument();

            try
            {
                xmlDocument.Load(XMLPhonebookFile);
            }
            catch (System.IO.FileNotFoundException ee)
            {
                System.Console.WriteLine(ee.Message);

                XmlNode root = xmlDocument.CreateNode("element", "Phonebook", "");
                xmlDocument.AppendChild(root);
            }
            catch (System.Xml.XmlException e) { System.Console.WriteLine(e.Message); }


            XmlNodeList list = xmlDocument.SelectNodes("/Phonebook/Record");

            foreach (XmlNode item in list)
            {
                CBuddyRecord record = new CBuddyRecord();

                XmlNode snode = item.SelectSingleNode(FIRSTNAME);
                if ((snode != null) && (snode.FirstChild.Value != null))
                {
                    record.FirstName = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(LASTNAME);
                if ((snode != null) && (snode.FirstChild != null) && (snode.FirstChild.Value != null))
                {
                    record.LastName = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(PHONE_NUMBER);
                if ((snode != null) && (snode.FirstChild.Value != null))
                {
                    record.Number = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(PHONE_URI);
                if ((snode != null) && (snode.FirstChild != null))
                {
                    record.Uri = snode.FirstChild.Value;
                }

                snode = item.SelectSingleNode(PHONE_PRESENCE);
                if ((snode != null) && (snode.FirstChild != null))
                {
                    record.PresenceEnabled = (snode.FirstChild.Value == "" ? false : true);
                }

                this.addRecord(record);
            }
        }
コード例 #4
0
        private void ChatForm_Shown(object sender, EventArgs e)
        {
            // get buddy data form _buddyId
            CBuddyRecord buddy = CBuddyList.getInstance()[BuddyId];

            if (buddy != null)
            {
                tabPageChat.Text = "Chat with " + buddy.FirstName;
            }
            else
            {
                tabPageChat.Text = "Chat with " + BuddyName;
            }
        }
コード例 #5
0
        private void BuddyForm_Activated(object sender, EventArgs e)
        {
            CBuddyRecord record = CBuddyList.getInstance().getRecord(BuddyId);

            if (record == null)
            {
                return;
            }

            textBoxName.Text = record.FirstName;
            //textBoxName.Caption = record.LastName;
            textBoxNumber.Text = record.Number;

            checkBoxPresence.Checked = record.PresenceEnabled;
        }
コード例 #6
0
ファイル: phonebook.cs プロジェクト: ximendatie/sensip
        public void addRecord(CBuddyRecord record)
        {
            int buddyindex = -1;

            buddyindex = Messenger.addBuddy(record.Number, record.PresenceEnabled);

            // shouldn't happen!!!!
            if (buddyindex == -1)
            {
                return;             //System.Diagnostics.Debug.WriteLine("");
            }
            record.Id = buddyindex;
            // add record to buddylist
            _buddyList.Add(record.Id, record);
        }