Exemplo n.º 1
0
        public Control_Contact(Contact contact)
        {
            InitializeComponent();

            this.contact = contact;

            profile_image_source.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri(contact.ProfileImage));
            profile_image.BorderBrush = (SolidColorBrush)new BrushConverter().ConvertFromString(contact.status.GetColor());
            txt_Name.Text = contact.FullName;
            txt_Status.Text = contact.StatusUpdate;

            txt_Name.Foreground = MainWindow.Instance.Color2;
            txt_Status.Foreground = MainWindow.Instance.Color2;

            if (contact.Pending)
            {
                btn_acceptfriend.Visibility = System.Windows.Visibility.Visible;
                btn_denyfriend.Visibility = System.Windows.Visibility.Visible;
                btn_removefriend.Visibility = System.Windows.Visibility.Collapsed;
                txt_Status.Text = "Pending Request";
                txt_Status.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(125, 125, 125));
            }

            btn_removefriend.Header = String.Format(btn_removefriend.Header.ToString(), contact.NickName);
            btn_blockfriend.Header = String.Format(btn_blockfriend.Header.ToString(), contact.NickName);
        }
Exemplo n.º 2
0
 public static void RemoveCallNotification(Contact contact)
 {
     foreach(NotificationWindow wnd in Windows)
     {
         if(wnd.contact != null)
             if(wnd.contact.ID == contact.ID)
             {
                 wnd.animation_fadeout.Stop();
                 wnd.animation_fadeout_now.Begin();
             }
     }
 }
Exemplo n.º 3
0
        public void StartChattingWith(Contact contact)
        {
            if(ChattingWith != null)
            if (ChattingWith.ID == contact.ID)
                return;

            if (Uploads.Count > 0)
            {
                NotificationWindow.ShowNotification("Upload In Progress", string.Format("Unable to start chatting with {0} since you are currently uploading files.", contact.FullName));
                return;
            }

            new Thread(new ThreadStart(delegate
                {
                    this.Dispatcher.Invoke((App.MethodInvoker)delegate
                    {
                        rtf_input.IsEnabled = false;
                    }, null);

                    this.Dispatcher.Invoke((App.MethodInvoker)delegate
                    {
                        ChattingWith = contact;

                        LastMessageFrom = "";

                        profile_image_source.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri(contact.ProfileImage));
                        profile_image.BorderBrush = (SolidColorBrush)new BrushConverter().ConvertFromString(contact.status.GetColor());
                        txt_chattingwith_nickname.Text = contact.FullName;
                        txt_chattingwith_statusupdate.Text = contact.StatusUpdate;

                        rtf_output.SelectAll();
                        rtf_output.Selection.Text = "";

                    }, null);

                    this.Dispatcher.Invoke((App.MethodInvoker)delegate
                    {
                        SlideFade.CreateProfileImgAnimationOut(profile_image);
                        App.Instance.Contacts[contact.ID].LastMessage = DateTime.Now;
                    }, null);

                    var Messages = contact.Messages;
                    int MessagesToLoad = 50;
                    if (Messages.Count > MessagesToLoad)
                    {
                        Messages.Reverse();
                        Messages.RemoveRange(MessagesToLoad - 1, Messages.Count - MessagesToLoad);
                        Messages.Reverse();
                    }

                    foreach (Message msg in Messages)
                    {
                        if ((msg.SendTime - DateTime.Now).Days > 7)
                            continue;

                        this.Dispatcher.Invoke((App.MethodInvoker)delegate
                        {
                            HandleMessage(msg.From, msg.Msg, true);
                        }, null);
                    }

                    this.Dispatcher.Invoke((App.MethodInvoker)delegate
                    {
                        rtf_input.IsEnabled = true;
                        rtf_output.ScrollToEnd();
                        SubscribeAll();
                    }, null);
                })).Start();
        }
Exemplo n.º 4
0
        public static void ShowCallNotification(Contact contact, string UDPAddress, int Port)
        {
            SoundManager.VoiceRingingSound.PlayLooping();

            NotificationWindow wnd = new NotificationWindow(true);
            wnd.Left = (SystemParameters.FullPrimaryScreenWidth - wnd.Width) - 10;
            wnd.Top = 10;
            wnd.txt_notificationtitle.Content = "Incoming Call From " + contact.NickName;
            wnd.txt_notificationcontent.Text = "";

            wnd.btn_call_accept.Visibility = Visibility.Visible;
            wnd.btn_call_deny.Visibility = Visibility.Visible;
            wnd.profile_image.Visibility = Visibility.Visible;

            wnd.profile_image_source.ImageSource = new System.Windows.Media.Imaging.BitmapImage(new Uri("https://blaze-games.com/api/image/nocompress/?nickname=" + contact.NickName));

            wnd.UDPAddress = UDPAddress;
            wnd.Port = Port;
            wnd.contact = contact;

            wnd.Show();
            Windows.Add(wnd);
            ReDraw();
        }
Exemplo n.º 5
0
 public static void ShowNotification(string Title, string Message, Contact contact)
 {
     NotificationWindow wnd = new NotificationWindow();
     wnd.Left = (SystemParameters.FullPrimaryScreenWidth - wnd.Width) - 10;
     wnd.Top = 10;
     wnd.txt_notificationtitle.Content = Title;
     wnd.txt_notificationcontent.Text = Message;
     wnd.Show();
     Windows.Add(wnd);
     ReDraw();
 }