Beispiel #1
0
        public Menu()
        {
            UserC user = (UserC)Unpackage <UserC> .Upackage(sw.GetMyData(Const.session));

            InitializeComponent();
            tName.Content                 = user.name + " " + user.surname;
            tPhone.Content                = user.phone;
            tEmai.Content                 = user.email;
            elipse.Fill                   = Brushes.BlueViolet;
            tSubname.Content              = ("" + user.name[0] + user.surname[0]).ToUpper();
            GMenu                         = this;
            LAutor.Cursor                 = Cursors.Hand;
            Contacts.Cursor               = Cursors.Hand;
            Settings.Cursor               = Cursors.Hand;
            Exit.Cursor                   = Cursors.Hand;
            Contacts.MouseEnter          += Contacts_MouseEnter;
            Contacts.MouseLeave          += Contacts_MouseLeave;
            Settings.MouseEnter          += Contacts_MouseEnter;
            Settings.MouseLeave          += Contacts_MouseLeave;
            Exit.MouseEnter              += Contacts_MouseEnter;
            Exit.MouseLeave              += Contacts_MouseLeave;
            Contacts.MouseLeftButtonDown += InformMouseLeftButtonDown;
            LAutor.MouseLeftButtonDown   += Settings_MouseLeftButtonDown;
            Exit.MouseLeftButtonDown     += Exit_MouseLeftButtonDown;
            Settings.MouseLeftButtonDown += Origin_MouseLeftButtonDown;
        }
Beispiel #2
0
        public SignIn()
        {
            InitializeComponent();
            tPassword.KeyDown += Box_KeyDown;
            tLogin.KeyDown    += Box_KeyDown;
            ServerWorks sw = new ServerWorks();

            using (FileStream fstream = File.OpenRead(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "session.txt")))
            {
                byte[] array = new byte[fstream.Length];
                fstream.Read(array, 0, array.Length);
                string textFromFile = System.Text.Encoding.Default.GetString(array);
                if (!string.IsNullOrEmpty(textFromFile))
                {
                    if (sw.GetMyData(textFromFile) != null)
                    {
                        Const.session = textFromFile;
                        MainWindow.GlobalMainFrame.Source = new Uri("DialogWindow.xaml", UriKind.Relative);
                    }
                    else
                    {
                        Label.Content = "Данные сесcии устарели,произведите вход заново.";
                    }
                }
            }
        }
Beispiel #3
0
        private static void Exit_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ServerWorks server = new ServerWorks();
            UserC       user   = (UserC)Unpackage <UserC> .Upackage(server.GetMyData(Const.session));

            using (FileStream fstream = File.Open(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "session.txt"), FileMode.Create))
            { }
            server.RemoveHach(user.userName);
            MessageBox.Show("Всего хорошего!");
            Environment.Exit(0);
        }
Beispiel #4
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();
            }
        }