示例#1
0
        public MainWindow()
        {
            InitializeComponent();


            CORE.User u = new CORE.User(mApp, 1);
            u.CheckLogin("Ivanov", "123");


            //CORE.App pApp = new CORE.App();
            //CORE.Message mes = new CORE.Message(pApp, 2);
            //mes.Send(1, 3, "privet");
            //MyThread = Thread.CurrentThread;

            //CurApp = Application.Current;
            //CurApp.Exit += CurApp_Exit;
            //dom = AppDomain.CurrentDomain;
            //dom.ProcessExit += CurrentDomain_ProcessExit;

            //MyPro = Process.GetCurrentProcess();
            //MyPro.Disposed += MyPro_Disposed;
            //MyPro.Exited += MyPro_Exited;


            //CORE.MessageCollection mesco = new CORE.MessageCollection(pApp);
            //mesco.Fill(1, 2, 30);
        }
示例#2
0
        public int amount_one    = 0; //не реализ.

        public MessageSender()
        {
            _getAuth          = new API.GetAuth();
            _sendMsgFromGroup = new API.SendMsgFromGroup(_getAuth);
            _user             = new User();
            _getGroupUsersId  = new API.GetGroupUsersId(_getAuth);
        }
        /// <summary>
        /// Регистрация
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (CheckFields() && CheckPassword())
                {
                    CORE.User u = new CORE.User(MainWin.mApp);

                    u.NameF            = txtNameF.Text;
                    u.NameI            = txtNameI.Text;
                    u.NameO            = txtNameO.Text;
                    u.Phone            = txtPhone.Text;
                    u.Birthday         = dtpBirthday.DisplayDate;
                    u.Password         = passBox.Password;
                    u.Login            = txtLogin.Text;
                    u.DateRegistration = DateTime.Now;

                    u.NewUser();
                    MainWin.Main.Content = new Pages.LoginPage(MainWin);
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message);
            }
        }
示例#4
0
        /// <summary>
        /// Инициализирует новый экземпляр класса Contacts
        /// </summary>
        /// <param name="I_am"></param>
        /// <param name="win"></param>
        public Contacts(CORE.User I_am, NativeWindow win)
        {
            PresentUser = I_am;
            PresentUser.MakeOnLine();

            MyWindow = win;
            InitializeComponent();
        }
示例#5
0
        public CommonMsg()
        {
            _user          = new User();
            _messageSender = new MessageSender();
            _lastMessage   = new LastMessageChat();

            SendingMessages();
        }
示例#6
0
 /// <summary>
 /// Инициализирует новый экземпляр класса Profile
 /// </summary>
 /// <param name="pApp"></param>
 /// <param name="user"></param>
 public Profile(CORE.App pApp, CORE.User user)
 {
     user.Read();
     user.MakeOnLine();
     mApp        = pApp;
     ProfileUser = user;
     InitializeComponent();
 }
 /// <summary>
 /// отображаем переписку между пользователями Sender (текущий пользователь) и Recipient
 /// </summary>
 /// <param name="Sender"></param>
 /// <param name="Recipient"></param>
 private void LoadMessages(CORE.User Sender, CORE.User Recipient)
 {
     if (Recipient != null)
     {
         CORE.MessageCollection mesco = new CORE.MessageCollection(MainWin.mApp);
         mesco.Fill((int)Sender.IdUser, (int)Recipient.IdUser, NumberMessages);
         ListMessages.ItemsSource = mesco;
     }
 }
        /// <summary>
        /// Инициализирует новый экземпляр класса Messages
        /// </summary>
        /// <param name="I_am"></param>
        /// <param name="win"></param>
        public Messages(CORE.User I_am, NativeWindow win)
        {
            InitializeComponent();
            MainWin     = win;
            PresentUser = I_am;

            LoadListBoxContacts();
            PresentUser.MakeOnLine();
        }
        /// <summary>
        /// Переопределение пользователя с которым ведется переписка, при изменении выбора пользователя
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListContacts_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // Обновляем онлайн-статус пользователя.
            PresentUser.MakeOnLine();

            RecipientUser = new CORE.User(MainWin.mApp, (int)((ListContacts.SelectedItem as CORE.User).IdUser));
            SetInfoRecipient();
            LoadMessages(PresentUser, RecipientUser);
        }
示例#10
0
 public ServiceMsg()
 {
     //   _getAuth = new API.GetAuth();
     //   _sendMsgFromGroup = new API.SendMsgFromGroup(_getAuth);
     //  _tableData = new DB.TableData();
     _user          = new User();
     _messageSender = new MessageSender();
     _lastMessage   = new LastMessageChat();
 }
示例#11
0
        /// <summary>
        /// Вход в притложение. Определяет текущего пользователя и перенаправляет на страницу Профиль.
        /// </summary>
        /// <param name="sender"></param>
        public void LoginTrue(object sender)
        {
            PresentUser = new CORE.User(mApp, (int)sender);
            EnableMenu();

            Main.Content = new Profile(mApp, PresentUser);
            PresentUser.Read();
            PresentUser.MakeOnLine();
        }
示例#12
0
        /// <summary>
        /// Переходим к переписке с выбранным пользователем
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnWriteMessage_Click(object sender, RoutedEventArgs e)
        {
            // Обновляем онлайн-статус пользователя.
            PresentUser.MakeOnLine();

            CORE.User repicient = new CORE.User(MyWindow.mApp, Convert.ToInt32((sender as Button).Tag));
            repicient.Read();

            MyWindow.GoToMessagePage(repicient);
        }
示例#13
0
        private AutoExit()
        {
            _user          = new User();
            _messageSender = new MessageSender();



            timer.AutoReset = true;
            timer.Elapsed  += Timer_Elapsed;

            timer.Start();
        }
示例#14
0
        public Receiver(FORM.MainForm mainForm)
        {
            this._mainForm   = mainForm;
            _getAuth         = new API.GetAuth();
            _controlForm     = new FORM.ControlForm(_mainForm);
            _readerAllEvents = new API.ReaderAllEvents(_getAuth, _controlForm);

            _outChatMsg = new OutChatMsg();
            _serviceMsg = new ServiceMsg();
            _commonMsg  = new CommonMsg();
            _user       = new User();
        }
示例#15
0
        /// <summary>
        /// Инициализирует новый экземпляр класса Messages (Для перехода со страницы контактов).
        /// С учётом пользовтеля, с которым ведется переписка
        /// </summary>
        /// <param name="I_am"></param>
        /// <param name="Recipient"></param>
        /// <param name="win"></param>
        public Messages(CORE.User I_am, CORE.User Recipient, NativeWindow win)
        {
            InitializeComponent();
            MainWin = win;

            PresentUser   = I_am;
            RecipientUser = Recipient;
            SetInfoRecipient();

            LoadListBoxContacts();
            LoadMessages(PresentUser, RecipientUser);
            PresentUser.MakeOnLine();
        }
示例#16
0
        /// <summary>
        /// ѕровер¤ем Ћогин и ѕароль
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            CORE.User us = new CORE.User(MainWin.mApp);

            int?IdUser = us.CheckLogin(txtLogin.Text, passwordBoxEdit1.Password);

            if (IdUser == null)
            {
                MessageBox.Show("Ќеправильный логин и/или пароль", "ќшибка", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else
            {
                IsLogin = true;
                MainWin.LoginTrue(IdUser);
            }
        }
示例#17
0
 /// <summary>
 /// Перенаправляет на страницу Сообщения к переписке с выбранным пользователем со страницы Контакты
 /// </summary>
 /// <param name="Repicient"></param>
 public void GoToMessagePage(CORE.User Repicient)
 {
     Main.Content = new Pages.Messages(PresentUser, Repicient, this);
 }