예제 #1
0
        public AllDialog()
        {
            sw  = new ServerWorks();
            swh = new ServerWorksHelper();
            InitializeComponent();
            settings.MouseLeftButtonDown += Settings_MouseLeftButtonDown;
            tBox.TextChanged             += tBox_TextChanged;
            tBox.GotFocus    += TBox_GotFocus;
            tBox.LostFocus   += TBox_LostFocus;
            GAllDial          = this;
            GsViewer          = Scroll;
            GPanel            = StackPanel;
            tBox.TextChanged += TBox_TextChanged;
            Thread t = new Thread(UpdateMessage)
            {
                IsBackground = true
            };

            t.SetApartmentState(ApartmentState.STA);
            t.Start();
        }
예제 #2
0
        public void SetData()
        {
            Message.GStackPanel.Children.Clear();
            SolidColorBrush scbS = swh.RandomColor();
            SolidColorBrush scbR = swh.RandomColor();

            sw.UpdateNewMessage(Const.session, Const.IdFocus);
            List <MessageC> list = sw.GetAllMessageUser(Const.session, Const.IdFocus);

            if (list != null)
            {
                ServerWorksHelper.GetMessageLastId(list);
                foreach (var m in list)
                {
                    UserC c    = sw.GetUserById(Const.session, Const.IdFocus);
                    UserC user = (UserC)Unpackage <UserC> .Upackage(sw.GetMyData(Const.session));

                    CustomMessage bt = new CustomMessage();
                    DateTime      dt = DateTime.Parse(m.time);
                    bt.TextTime = dt.TimeOfDay.ToString();
                    if (m.idReseiver == Const.IdFocus)
                    {
                        bt.ColorBackgroundMessage = new SolidColorBrush(System.Windows.Media.Color.FromRgb(239, 253, 222));
                        bt.ColorBackgroundCircle  = scbS;
                        bt.TextSub = ("" + user.name[0] + user.surname[0]).ToUpper();
                    }
                    else
                    {
                        bt.ColorBackgroundMessage = Brushes.White;
                        bt.ColorBackgroundCircle  = scbR;
                        bt.TextSub = ("" + c.name[0] + c.surname[0]).ToUpper();
                    }
                    bt.TextMessage      = m.message;
                    bt.CheckImageSource = m.status == 1 ? new BitmapImage(new Uri("/icons/statusone.png", UriKind.Relative)) : new BitmapImage(new Uri("/icons/statustwo.png", UriKind.Relative));
                    bt.Template         = (ControlTemplate)(this.TryFindResource("Bt2Template"));
                    Message.GStackPanel.Children.Add(bt);
                }
                Message.GsViewer.ScrollToEnd();
            }
        }
예제 #3
0
 public CustomMessage()
 {
     DefaultStyleKey = typeof(CustomMessage);
     sw  = new ServerWorks();
     swh = new ServerWorksHelper();
 }