Example #1
0
        private void SendMessage()
        {
            ClientLogic logic = new ClientLogic();

            logic.SendMessage(MessageBox.Text, UserName);
            // Clears the message box.
            MessageBox.Text = "";
        }
Example #2
0
        public ChatWindow()
        {
            InitializeComponent();
            //refreshs the history box
            ClientLogic logic = new ClientLogic(historyBox);

            Application.Current.MainWindow   = this;
            Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;

            historyBox.IsReadOnly = true;
        }
Example #3
0
        private void UnLoggin_click(object sender, RoutedEventArgs e)
        {
            ClientLogic logic = new ClientLogic();

            if (!MainWindow.IsOpened)
            {
                logic.UnLoggin();
                logic.CloseConnection();
                MainWindow mainWindow = new MainWindow();
                mainWindow.Show();

                ChatWindow.IsOpened = false;
                MainWindow.IsOpened = true;

                this.Close();
            }
        }
Example #4
0
        public MainWindow()
        {
            InitializeComponent();

            //creates connection and opens proxy to use
            try
            {
                ClientLogic logic = new ClientLogic();
                logic.CreateConnection();
                logic.OpenProxy();
                UpdateConnectionsCounter();
                UpdateConnectionState();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
                MessageBox.Show(ex.Message);
            }

            //The current login window is the main window now.
            Application.Current.MainWindow   = this;
            Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
        }
Example #5
0
        private void UpdateConnectionState()
        {
            ClientLogic logic = new ClientLogic();

            ConnectionStateLabel.Content = logic.GetConnetionState();
        }
Example #6
0
        private void UpdateConnectionsCounter()
        {
            ClientLogic logic = new ClientLogic();

            ConnectionCounterLabel.Content = $"{logic.GetConnectionsCounter()} / {logic.GetMaxConnetionsNumber()}";
        }