Ejemplo n.º 1
0
        void notifyIcon1_BalloonTipClicked(object sender, EventArgs e)
        {
            //could be a file string[] or a Lan.NetworkUser.
            object obj = notifyIcon1.Tag;

            if (obj != null)
            {
                Type type = obj.GetType();
                if (type == typeof(string[]))
                {
                    string[] args  = (string[])notifyIcon1.Tag;
                    string   from  = args[0];
                    string   fname = args[1];
                    string   path  = Settings.Default.TransfersFolder;
                    if (path == "")
                    {
                        string docs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                        path = docs + @"\NetworkChat\files";
                    }

                    path = path + @"\" + from + @"\" + fname;

                    Process.Start("explorer.exe", @"/select, " + path);
                }
                else if (type == typeof(Lan.NetworkUser))
                {
                    Lan.NetworkUser nu = (Lan.NetworkUser)notifyIcon1.Tag;
                    refreshAfterUserSelect(nu);
                }
            }
        }
Ejemplo n.º 2
0
        private static void returnNewMessage(string envelope)
        {
            envelope = XmlEncryption.decryptXml(envelope);

            XmlDocument x = new XmlDocument();

            x.LoadXml(envelope);
            XmlNode user     = x.SelectSingleNode("envelope/user");
            XmlNode computer = x.SelectSingleNode("envelope/computer");
            XmlNode ip       = x.SelectSingleNode("envelope/ip");
            string  message  = ASCIIEncoding.ASCII.GetString(Convert.FromBase64String(x.SelectSingleNode("envelope/message").InnerText));
            XmlNode presence = x.SelectSingleNode("envelope/presence");
            XmlNode dateSent = x.SelectSingleNode("envelope/timestamp");

            Lan.NetworkUser nc = new Lan.NetworkUser();
            nc.UserName     = user.InnerText;
            nc.ComputerName = computer.InnerText;
            nc.IPAddress    = IPAddress.Parse(ip.InnerText);
            nc.Presence     = (Lan.Presence)Enum.Parse(typeof(Lan.Presence), presence.InnerText);
            nc.TimeStamp    = DateTime.Parse(dateSent.InnerText);
            nc.UserUniqueId = (nc.UserName + nc.ComputerName).ToLower();

            if (NewMessage != null)
            {
                NewMessage(nc, message);
            }
        }
Ejemplo n.º 3
0
        private void refreshAfterUserSelect(Lan.NetworkUser nu)
        {
            int index = listViewUsers.Items.IndexOfKey(nu.UserUniqueId);

            currentlySelectedUser = nu;
            //go through listviewuser and if the same
            if (index > -1)
            {
                listViewUsers.Items[nu.UserUniqueId].Selected  = true;
                listViewUsers.Items[nu.UserUniqueId].BackColor = Color.LightPink;
                listViewUsers.Items[nu.UserUniqueId].ForeColor = Color.Purple;

                tabPage1.Tag    = nu;
                tabPage1.Text   = nu.UserName + " Messages";
                buttonSend.Text = "Send To " + nu.UserName;

                tabControl1.SelectedIndex = 0;

                string text = userMessages.LoadUserMessageText(nu.UserUniqueId);
                richTextBoxReplies.Rtf = text;

                richTextBoxReplies.Select(richTextBoxReplies.TextLength, 0);

                richTextBoxReplies.ScrollToCaret();

                toolStripButtonBold.Checked      = Settings.Default.DefaultFont.Bold;
                toolStripButtonItalic.Checked    = Settings.Default.DefaultFont.Italic;
                toolStripButtonUnderline.Checked = Settings.Default.DefaultFont.Underline;
                toolStripButtonStrikeOut.Checked = Settings.Default.DefaultFont.Strikeout;

                richMessage.Font          = Settings.Default.DefaultFont;
                richMessage.SelectionFont = Settings.Default.DefaultFont;

                foreach (ListViewItem lvi in listViewUsers.Items)
                {
                    lvi.BackColor = Color.White;
                    lvi.ForeColor = Color.Black;
                }

                if (listViewUsers.SelectedItems.Count > 0)
                {
                    listViewUsers.SelectedItems[0].BackColor = Color.LightPink;
                    listViewUsers.SelectedItems[0].ForeColor = Color.Purple;
                }

                foreach (TreeNode tn in treeViewGroups.Nodes)
                {
                    tn.BackColor = Color.White;
                    tn.ForeColor = Color.Black;
                }

                Lan.NetworkUser nit = usersWithMessages.Find(s => s.UserUniqueId == nu.UserUniqueId.ToLower());
                usersWithMessages.Remove(nit);

                richMessage.Select();

                this.WindowState = FormWindowState.Normal;
                this.BringToFront();
            }
        }
Ejemplo n.º 4
0
 void Chat_NewMessage(Lan.NetworkUser Computer, string Message)
 {
     if (!this.IsDisposed)
     {
         Invoke(new dInvokeMessage(invokeMessage), new object[] { Computer, Message });
     }
 }
Ejemplo n.º 5
0
        private void startSendGroup()
        {
            string groupName = tabPage1.Tag.ToString();

            if (groupName == "Broadcast")
            {
                //send to all online
                //currentUsers
                foreach (Lan.NetworkUser nuw in currentUsers)
                {
                    if (nuw.Presence != Lan.Presence.Offline)
                    {
                        startSendMessage(nuw);
                    }
                }
            }
            else
            {
                //send to all in group...
                List <GroupUser> users = UserGroups.GetGroupMembers(groupName);
                foreach (GroupUser gu in users)
                {
                    Lan.NetworkUser nu = currentUsers.Find(s => s.UserUniqueId == gu.UserUniqueId);

                    if (nu != null)
                    {
                        if (nu.Presence != Lan.Presence.Offline)
                        {
                            startSendMessage(nu);
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void startSendMessage(Lan.NetworkUser nu)
        {
            if (nu == null)
            {
                return;
            }

            MessageObject me = new MessageObject();

            me.User           = nu;
            me.User.TimeStamp = DateTime.Now;
            me.Message        = richMessage.Rtf; //richMessage.Rtf;

            //display issues
            //richMessage.Rtf = "";
            //richMessage.Select(0, 0);
            richTextBoxReplies.Select(richTextBoxReplies.Text.Length, 0);
            richTextBoxReplies.SelectedRtf = @"{\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}" + @"\cf11[" + DateTime.Now.ToShortTimeString() + "] " + Environment.UserName + @": }";
            richTextBoxReplies.Select(richTextBoxReplies.Text.Length, 0);
            richTextBoxReplies.SelectedRtf = me.Message.Trim();
            richTextBoxReplies.ScrollToCaret();



            ParameterizedThreadStart pst = new ParameterizedThreadStart(sendMessage);
            Thread t = new Thread(pst);

            t.Start(me);
        }
Ejemplo n.º 7
0
        void tsiMenuSendMessage_Click(object sender, EventArgs args)
        {
            ToolStripItem tsi = (ToolStripItem)sender;

            Lan.NetworkUser nu = (Lan.NetworkUser)tsi.Tag;
            refreshAfterUserSelect(nu);
        }
Ejemplo n.º 8
0
        private static NetworkUser parseNetworkUser(string xml)
        {
            xml = XmlEncryption.decryptXml(xml);

            XmlDocument x = new XmlDocument();

            x.LoadXml(xml);
            XmlNode user      = x.SelectSingleNode("envelope/user");
            XmlNode computer  = x.SelectSingleNode("envelope/computer");
            XmlNode ip        = x.SelectSingleNode("envelope/ip");
            XmlNode message   = x.SelectSingleNode("envelope/message");
            XmlNode presence  = x.SelectSingleNode("envelope/presence");
            XmlNode icon      = x.SelectSingleNode("envelope/icon");
            XmlNode timestamp = x.SelectSingleNode("envelope/timestamp");

            //byte[] imgBits = Convert.FromBase64String(icon.InnerText);
            //MemoryStream ms = new MemoryStream(imgBits);
            //Image img = Image.FromStream(ms);
            //ms.Close();

            Lan.NetworkUser nc = new Lan.NetworkUser();
            nc.UserName     = user.InnerText;
            nc.ComputerName = computer.InnerText;
            nc.IPAddress    = IPAddress.Parse(ip.InnerText);
            nc.Presence     = (Presence)Enum.Parse(typeof(Presence), presence.InnerText);
            nc.TimeStamp    = DateTime.Parse(timestamp.InnerText);
            nc.UserUniqueId = (nc.UserName + nc.ComputerName);

            // nc.Icon = img;
            return(nc);
        }
Ejemplo n.º 9
0
        private void refreshGroups()
        {
            Dictionary <string, UserGroup> grps = UserGroups.ViewGroups();

            foreach (string kk in grps.Keys)
            {
                UserGroup ug = grps[kk];
                TreeNode  tn;

                if (!treeViewGroups.Nodes.ContainsKey(kk))
                {
                    tn                  = treeViewGroups.Nodes.Add(ug.GroupName, ug.GroupName);
                    tn.ImageKey         = "group";
                    tn.SelectedImageKey = "group";
                    tn.Tag              = "GROUP";
                }
                else
                {
                    tn = treeViewGroups.Nodes[kk];
                }

                bool isExpended = tn.IsExpanded;

                foreach (GroupUser gu in ug.GroupMembers)
                {
                    Lan.NetworkUser nu = currentUsers.Find(s => s.UserUniqueId == gu.UserUniqueId);

                    //oly shows online users...???
                    if (nu != null)
                    {
                        //check if in tree
                        if (!tn.Nodes.ContainsKey(nu.UserUniqueId))
                        {
                            //check if user online...
                            TreeNode unode = tn.Nodes.Add(nu.UserUniqueId, gu.UserName);
                            unode.ImageKey         = "person";
                            unode.SelectedImageKey = "person";
                            unode.Tag = gu;
                        }
                    }
                    else
                    {
                        if (tn.Nodes.ContainsKey(gu.UserUniqueId))
                        {
                            //Also remove from user list..
                            tn.Nodes[gu.UserUniqueId].Remove();
                        }
                    }

                    if (isExpended)
                    {
                        tn.Expand();
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private void listViewUsers_MouseClick(object sender, MouseEventArgs e)
        {
            if (listViewUsers.SelectedIndices.Count > 0)
            {
                Lan.NetworkUser com = (Lan.NetworkUser)listViewUsers.SelectedItems[0].Tag;

                //if (!Lan.IsUserThere(com))
                //{
                //    Lan.NetworkUser n = currentUsers.Find(s => s.UserUniqueId == com.UserUniqueId);
                //    currentUsers.Remove(n);
                //    refreshUsers();
                //    refreshGroups();
                //}

                labelPCInfo.Text = com.UserName + " on PC: " + com.ComputerName + "\r\nIP Address:" + com.IPAddress.ToString();

                currentlySelectedUser = com;

                tabPage1.Text             = com.UserName + " Messages";
                tabPage1.Tag              = com;
                tabControl1.SelectedIndex = 0;

                buttonSend.Text = "Send To " + com.UserName;

                string text = userMessages.LoadUserMessageText(com.UserUniqueId);
                richTextBoxReplies.Rtf = text;
                richTextBoxReplies.Select(richTextBoxReplies.TextLength, 0);
                richTextBoxReplies.ScrollToCaret();

                richMessage.Select();

                Lan.NetworkUser nit = usersWithMessages.Find(s => s.UserUniqueId == com.UserUniqueId.ToLower());
                if (nit != null)
                {
                    usersWithMessages.Remove(nit);
                }
            }

            foreach (ListViewItem lvi in listViewUsers.Items)
            {
                lvi.BackColor = Color.White;
                lvi.ForeColor = Color.Black;
            }

            if (listViewUsers.SelectedItems.Count > 0)
            {
                listViewUsers.SelectedItems[0].BackColor = Color.LightPink;
                listViewUsers.SelectedItems[0].ForeColor = Color.Purple;
            }

            foreach (TreeNode tn in treeViewGroups.Nodes)
            {
                tn.BackColor = Color.White;
                tn.ForeColor = Color.Black;
            }
        }
Ejemplo n.º 11
0
 void Lan_NetworkUserPulse(Lan.NetworkUser NetworkUser)
 {
     try
     {
         if (!this.IsDisposed)
         {
             Invoke(new dUserPulse(userPulse), NetworkUser);
         }
     }
     catch
     {
     }
 }
Ejemplo n.º 12
0
        public void SendMessage(Lan.NetworkUser User, string Message, string[] Files)
        {
            try
            {
                string toSend = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>";
                toSend += "<envelope><user>" + Environment.UserName + "</user><computer>" + Environment.MachineName + "</computer>";

                toSend += "<ip>" + User.IPAddress + "</ip>";
                toSend += "<presence>" + Enum.GetName(typeof(Lan.Presence), User.Presence) + "</presence>";
                toSend += "<timestamp>" + DateTime.Now.ToString() + "</timestamp>";
                toSend += "<message>" + Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(Message)) + "</message>";
                toSend += "</envelope>";
                string enc_toSend = XmlEncryption.encryptXml(toSend);

                Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                s.SendTimeout = (int)Settings.Default.Timeout;
                s.Connect(User.IPAddress, (int)Settings.Default.ChatPort);
                byte[] bytesToSend = ASCIIEncoding.ASCII.GetBytes(enc_toSend);
                int    i           = s.Send(bytesToSend);
                s.Close();


                //send files
                if (Files.Length > 0)
                {
                    foreach (string file in Files)
                    {
                        Thread.Sleep(1000);
                        sendFile(file, User);

                        if (FileSent != null)
                        {
                            FileSent(Files.Length);
                        }
                    }
                }

                if (MessageSent != null)
                {
                    MessageSent();
                }
            }
            catch (Exception ex)
            {
                //fire the event alertin to a lost user User...
                // userOffline(User);
            }
        }
Ejemplo n.º 13
0
        private void refreshUsers()
        {
            int selIndex = 0;

            if (listViewUsers.SelectedIndices.Count > 0)
            {
                selIndex = listViewUsers.SelectedItems[0].Index;
            }

            NetworkChat.Lan.NetworkUser[] nus = new Lan.NetworkUser[currentUsers.Count];
            currentUsers.CopyTo(nus);
            foreach (NetworkChat.Lan.NetworkUser nu in nus)
            {
                //    listViewUsers.Items[nu.UserUniqueId].SubItems[2].Text = nu.Presence.ToString();
                listViewUsers.Items[nu.UserUniqueId].ImageKey = nu.Presence.ToString().ToLower();
            }
        }
Ejemplo n.º 14
0
        private void timerFlashUsersWhoHaveMessages_Tick(object sender, EventArgs e)
        {
            Lan.NetworkUser[] nus = new Lan.NetworkUser[usersWithMessages.Count];
            usersWithMessages.CopyTo(nus);

            foreach (Lan.NetworkUser nu in nus)
            {
                ListViewItem[] lvis = listViewUsers.Items.Find(nu.UserUniqueId, true);
                if (lvis.Length > 0)
                {
                    ListViewItem lvi = lvis[0];
                    if (lvi.BackColor == Color.Red)
                    {
                        lvi.BackColor = Color.Wheat;
                    }
                    else
                    {
                        lvi.BackColor = Color.Red;
                    }
                }
            }
        }
Ejemplo n.º 15
0
        private void showUserFiles()
        {
            if (listViewUsers.SelectedItems.Count > 0)
            {
                Lan.NetworkUser nu   = (Lan.NetworkUser)listViewUsers.SelectedItems[0].Tag;
                string          path = Settings.Default.TransfersFolder;
                if (path == "")
                {
                    string docs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                    path = docs + @"\NetworkChat\files";
                }

                path += @"\" + nu.UserName + nu.ComputerName + @"\";

                if (Directory.Exists(path)) //dont use userUniqueID))
                {
                    Process.Start(path);
                }
                else
                {
                    MessageBox.Show(nu.UserName + " has not sent you any files...", nu.UserName + " has not sent you any files...", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }
Ejemplo n.º 16
0
        private void sendFile(string file, Lan.NetworkUser User)
        {
            lock (this)
            {
                try
                {
                    FileInfo fi   = new FileInfo(file);
                    string   name = fi.Name;

                    string contents = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>";
                    contents += "<FileContainer>";
                    contents += "<FromName>" + Environment.UserName + "</FromName>";
                    contents += "<From>" + Environment.UserName + Environment.MachineName + "</From>";
                    contents += "<File name=\"" + name + "\">";
                    byte[] bits = File.ReadAllBytes(file);
                    contents += Convert.ToBase64String(bits);
                    contents += "</File></FileContainer>";

                    XmlSerializer xss   = new XmlSerializer(typeof(string));
                    Socket        sFile = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                    sFile.SendTimeout = (int)Settings.Default.Timeout;
                    sFile.Connect(User.IPAddress, (int)Settings.Default.FilePort);
                    NetworkStream ns = new NetworkStream(sFile);
                    xss.Serialize(ns, contents);
                    ns.Close();
                    sFile.Shutdown(SocketShutdown.Both);
                    sFile.Close();

                    GC.Collect();
                }
                catch (Exception ex)
                {
                }
            }
        }
Ejemplo n.º 17
0
        private void invokeMessage(Lan.NetworkUser User, string Message)
        {
            //ONLY do this if the user is present
            object o            = tabPage1.Tag;
            bool   showOnScreen = false;

            if (o.GetType() == typeof(NetworkChat.Lan.NetworkUser))
            {
                NetworkChat.Lan.NetworkUser nu = (NetworkChat.Lan.NetworkUser)o;
                if (nu.UserUniqueId.ToLower() == User.UserUniqueId)
                {
                    showOnScreen = true;
                }
            }
            else //group
            {
            }


            if (showOnScreen)
            {
                richTextBoxReplies.Select(richTextBoxReplies.TextLength, 0);
                //use custom colors for users...
                richTextBoxReplies.SelectedRtf = @"{\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}" + @"\cf2[" + User.TimeStamp.ToShortTimeString() + "] " + User.UserName + @": }";
                richTextBoxReplies.Select(richTextBoxReplies.TextLength, 0);

                richTextBoxReplies.SelectedRtf = Message;
                richTextBoxReplies.ScrollToCaret(); //.Select(richTextBox1.TextLength, 0);

                if (Settings.Default.AlwaysSpeakMessages)
                {
                    RichTextBox ritb = new RichTextBox();
                    ritb.Rtf = Message;
                    Speak.SpeakPhrase(User.UserName + " says: " + ritb.Text);
                }
            }
            else if (!showOnScreen | !this.TopMost | this.WindowState == FormWindowState.Minimized)//not shown on screen just flash....
            {
                //add user to usersWithMessages;
                notifyIcon1.Tag = User;

                if (Settings.Default.PopupOnNewMessage)
                {
                    notifyIcon1.ShowBalloonTip(5000, "You have a new message", "You have a new message from " + User.UserName, ToolTipIcon.Info);
                }

                if (Settings.Default.SoundOnNewMessage)
                {
                    if (Settings.Default.SoundFileLocation != "")
                    {
                        if (File.Exists(Settings.Default.SoundFileLocation))
                        {
                            SoundPlayer sp = new SoundPlayer(Settings.Default.SoundFileLocation);
                            sp.Play();
                        }
                        else
                        {
                            SystemSounds.Beep.Play();
                        }
                    }
                    else
                    {
                        SystemSounds.Beep.Play();
                    }
                }

                if (Settings.Default.SpeakMessage | Settings.Default.AlwaysSpeakMessages)
                {
                    RichTextBox ritb = new RichTextBox();
                    ritb.Rtf = Message;
                    Speak.SpeakPhrase("You have a message from " + User.UserName + ", which says: " + ritb.Text);
                }
                else if (Settings.Default.SpeakMessageIsFrom)
                {
                    Speak.SpeakPhrase("You have a new message from " + User.UserName);
                }



                usersWithMessages.Add(User);
            }

            //get old string
            //save as user who sent


            RichTextBox rtb = new RichTextBox();
            string      old = userMessages.LoadUserMessageText(User.UserUniqueId);

            rtb.Rtf = old;
            rtb.Select(rtb.TextLength, 0);

            rtb.SelectedRtf = @"{\rtf1\ansi\deff0{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}" + @"\cf2[" + User.TimeStamp.ToShortTimeString() + "] " + User.UserName + @": " + Message + " }";
            richTextBoxReplies.ScrollToCaret();


            userMessages.SaveUserMessageText(User.UserUniqueId, rtb.Rtf);
        }
Ejemplo n.º 18
0
        private void userPulse(Lan.NetworkUser NetworkUser)
        {
            bool   found = false;
            string pres  = Enum.GetName(typeof(Lan.Presence), NetworkUser.Presence).ToLower();

            for (int i = 0; i < listViewUsers.Items.Count; i++)
            {
                //store in global
                Lan.NetworkUser nu = (Lan.NetworkUser)listViewUsers.Items[i].Tag;

                if (nu.UserUniqueId == NetworkUser.UserUniqueId)// & (nu.ComputerName == NetworkUser.ComputerName))
                {
                    //monitor status changes here
                    //***************************
                    currentUsers.RemoveAll(s => s.UserUniqueId == nu.UserUniqueId);
                    currentUsers.Add(NetworkUser);

                    IEnumerator tss = sendMessageToolStripMenuItemSendMessage.DropDownItems.GetEnumerator();

                    while (tss.MoveNext())
                    {
                        //if(tss.Current.
                        ToolStripItem t = (ToolStripItem)tss.Current;

                        Lan.NetworkUser nut = (Lan.NetworkUser)t.Tag;
                        if (nut.UserUniqueId == NetworkUser.UserUniqueId)
                        {
                            ResourceManager rm  = Resources.ResourceManager;
                            Image           img = (Image)rm.GetObject(pres);
                            t.Tag   = NetworkUser;
                            t.Image = img;
                        }
                    }


                    found = true;
                }
            }

            if (!found)
            {
                ListViewItem lvi = listViewUsers.Items.Add(NetworkUser.UserUniqueId, "", pres);
                lvi.SubItems.Add(NetworkUser.UserName);
                //lvi.SubItems.Add(pres);
                lvi.Tag = NetworkUser;

                ToolStripItem tsi = sendMessageToolStripMenuItemSendMessage.DropDownItems.Add(NetworkUser.UserName);
                tsi.Click += new EventHandler(tsiMenuSendMessage_Click);
                ResourceManager rm  = Resources.ResourceManager;
                Image           img = (Image)rm.GetObject(pres);
                tsi.Tag   = NetworkUser;
                tsi.Image = img;

                currentUsers.Add(NetworkUser);

                if (Settings.Default.SoundWhenUserComesOnline)
                {
                    if (Settings.Default.SoundFileLocation != "")
                    {
                        if (File.Exists(Settings.Default.SoundFileLocation))
                        {
                            SoundPlayer sp = new SoundPlayer(Settings.Default.SoundFileLocation);
                            sp.Play();
                            Thread.Sleep(50);
                        }
                        else
                        {
                            SystemSounds.Beep.Play();
                        }
                    }
                    else
                    {
                        SystemSounds.Beep.Play();
                    }
                }

                if (Settings.Default.PopupWhenUserComesOnline)
                {
                    notifyIcon1.Tag = null;
                    if (NetworkUser.Presence == Lan.Presence.Online)
                    {
                        notifyIcon1.ShowBalloonTip(5000, NetworkUser.UserName + " just came online", NetworkUser.UserName + " is now online on PC: " + NetworkUser.ComputerName, ToolTipIcon.Info);
                    }
                }

                if (Settings.Default.SpeakNameWhenUserComesOnline)
                {
                    Speak.SpeakPhrase(NetworkUser.UserName + " is now online");
                }
            }

            refreshUsers();
            refreshGroups();
        }
Ejemplo n.º 19
0
 void chat_UserOffline(Lan.NetworkUser User)
 {
     //Lan.NetworkUser nu = currentUsers.Single(s => s.UserUniqueId == User.UserUniqueId);
     //if (nu != null)
     //    currentUsers.Remove(nu);
 }
Ejemplo n.º 20
0
 internal void Show(Lan.NetworkUser networkUser)
 {
     this.ShowDialog();
 }