Esempio n. 1
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            timer2.Stop();

            string path = Path.GetPathRoot(Environment.SystemDirectory) + "\\Users\\" + Environment.UserName + "\\AppData\\Local\\Temp\\VolupiaMessenger";
            string file = path + @"\" + _MyClient.Username + audioAtual + ".wav";

            var ms = new MemoryStream(File.ReadAllBytes(file));

            GetConversation(TalkingTolbl.Text, "Enviou um áudio...");
            SetConversationPlaceHolder(TalkingTolbl.Text);
            var rbubble = new BubbleComponent();

            rbubble.AudioFile = file;
            var newControl = rbubble.CreateRightAudioBubble(null, null);

            foreach (Control item in BubblePlaceHolder.Controls)
            {
                if (item.Name.Contains(TalkingTolbl.Text))
                {
                    item.Controls.Add(newControl);
                }
            }

            if (LoginForm.ServerConnectionState == LoginForm.VConnectionState.Connected)
            {
                Thread tt = new Thread(t => SendAudioThread(ms));
                tt.Start();
            }

            waveFile.Dispose();
        }
Esempio n. 2
0
        public static void TakeMessage(string message, string userName)
        {
            if (userName != string.Empty || message != string.Empty)
            {
                if (userName != _MyClient.Name)
                {
                    GetConversation(userName, message);
                    SetConversationPlaceHolder(userName);
                    var lbubble = new BubbleComponent();
                    var control = lbubble.CreateLeftTextBubble(message, userName);
                    foreach (Control item in BubblePlaceHolder.Controls)
                    {
                        if (item.Name.Contains(userName))
                        {
                            item.Controls.Add(control);
                        }
                    }
                }
                else
                {
                    GetConversation(TalkingTolbl.Text, message);
                    SetConversationPlaceHolder(TalkingTolbl.Text);
                    var rbubble    = new BubbleComponent();
                    var newControl = rbubble.CreateRightTextBubble(message, userName);
                    foreach (Control item in BubblePlaceHolder.Controls)
                    {
                        if (item.Name.Contains(TalkingTolbl.Text))
                        {
                            item.Controls.Add(newControl);
                        }
                    }
                }

                notifyTray.BalloonTipText = userName + ": " + message;

                if (ActiveForm.WindowState == FormWindowState.Minimized)
                {
                    notifyTray.ShowBalloonTip(3000);
                }
            }
        }
Esempio n. 3
0
        public static void TakeAudioMessage(MemoryStream ms, string userName, string meta)
        {
            notifyTray.BalloonTipText = userName + ": Enviou um áudio...";
            var    message       = "Enviou um áudio...";
            string audioFilePath = GenerateAudioFile(ms, userName, meta);

            if (userName != _MyClient.Name)
            {
                GetConversation(userName, message);
                SetConversationPlaceHolder(userName);
                var lbubble = new BubbleComponent();
                lbubble.AudioFile = audioFilePath;
                var control = lbubble.CreateLeftAudioBubble(message, userName);
                foreach (Control item in BubblePlaceHolder.Controls)
                {
                    if (item.Name.Contains(userName))
                    {
                        item.Controls.Add(control);
                    }
                }
            }
        }