示例#1
0
 private void MessageTimer_Tick(object sender, EventArgs e)
 {
     MessageTextBox.Text = Messages.Text;
     MessageTextBox.Focus();
     MessageTextBox.Select(MessageTextBox.TextLength, 0);
     MessageTextBox.ScrollToCaret();
 }
 public TabTelnetDesigner()
 {
     InitializeComponent();
     InitializeTelnet();
     MessageTextBox.Focus();
     this.ActiveControl = MessageTextBox;
 }
示例#3
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (ContactTextBox.Text.Length == 0)
            {
                lblError.Visible = true;

                ContactTextBox.Focus();
                return;
            }
            else if (MessageTextBox.Text.Length == 0)
            {
                lblError.Visible = true;

                MessageTextBox.Focus();
                return;
            }
            else
            {
                Mirembajtja obj = new Mirembajtja();
                int         id  = (int)Session["ID"];

                obj.DataMirembajtjes = DateTime.Now;
                obj.Pershkrimi       = MessageTextBox.Text;
                obj.ProduktiID       = id;
                obj.PunetoriID       = PunetoriID(ContactTextBox.Text);

                MirembajtjaMapper objm = new MirembajtjaMapper(obj);
                objm.Insert();
                Response.Redirect("Index.aspx");
            }
        }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     // Gives the textbox focus so we can start typing as soon as the window loads
     MessageTextBox.Focus();
     // Set caret to the end so we can start working from the right
     MessageTextBox.CaretIndex = Code.Text.Length;
 }
示例#5
0
        private void Send()
        {
            StatusBand.Hide();

            #region Validation

            if (TitleTextBox.Text.Length == 0)
            {
                StatusBand.Warning(FindResource("S.Feedback.Warning.Title") as string);
                TitleTextBox.Focus();
                return;
            }

            if (MessageTextBox.Text.Length == 0)
            {
                StatusBand.Warning(FindResource("S.Feedback.Warning.Message") as string);
                MessageTextBox.Focus();
                return;
            }

            #endregion

            StatusBand.Info(FindResource("S.Feedback.Sending").ToString());

            Cursor             = Cursors.AppStarting;
            MainGrid.IsEnabled = false;
            MainGrid.UpdateLayout();

            Persist();

            Cursor             = Cursors.Arrow;
            MainGrid.IsEnabled = true;
        }
示例#6
0
 private void MessageTextBox_OnLoaded(object sender, RoutedEventArgs e)
 {
     if (new KeyboardCapabilities().KeyboardPresent > 0)
     {
         MessageTextBox.Focus(FocusState.Programmatic);
     }
 }
示例#7
0
 public void OnChatToggle(bool isOpen)
 {
     ((ChatViewModel)DataContext).OnChatToggle(isOpen);
     if (isOpen)
     {
         MessageTextBox.Focus();
     }
 }
 private void sendMessage(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(MessageTextBox.Text))
     {
         socket.Emit("chat message", _username, ChatName.Text, MessageTextBox.Text);
     }
     MessageTextBox.Text = string.Empty;
     MessageTextBox.Focus();
 }
示例#9
0
        private void SendText()
        {
            JObject request = new JObject();

            request.Add("action", "send_message");
            request.Add("message", MessageTextBox.Text);
            SendRequest(client, request);
            MessageTextBox.Clear();
            MessageTextBox.Focus();
        }
示例#10
0
 public void MessageTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     picker.Focus();
     MessageTextBox.Focus();
     if (e.Key == Key.Enter && MessageTextBox.Text.Trim() != string.Empty)
     {
         Form1.connection.InvokeAsync("newMessage", MessageTextBox.Text.Trim());
         MessageTextBox.Text = "";
     }
 }
示例#11
0
        private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            MessageTextBox.Focus();

            var logs = await _logger.GetLogItems(new LogSearchModel { LogType = LogType.Error, MaxCount = 20 });

            Logs = new MultiCheckSelection <ILogItem>(logs);
            if (IsFrown)
            {
                Logs.Selections.ToList().ForEach(l => l.IsSelected = true);
            }
        }
示例#12
0
    /// <summary>
    /// Handles the Click event of the SendButton control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void SendButton_Click(object sender, EventArgs e)
    {
        List <string> list = (List <string>)Application[chatId];
        string        time = DateTime.Now.Hour.ToString() + ":" + DateTime.Now.Minute.ToString() + ":" + DateTime.Now.Second.ToString();
        string        msg  = string.Format("({0}) {1}: {2} {3}", time, Page.User.Identity.Name.ToUpper(), MessageTextBox.Text, Environment.NewLine);

        list.Add(msg);
        Application.Clear();
        Application[chatId] = list;
        MessageTextBox.Text = "";
        MessageTextBox.Focus();
    }
示例#13
0
        private async Task SendScheduled(DateTime sendSchedule)
        {
            MessageTextBox.Focus(FocusState.Programmatic);
            DateTime now = DateTime.Now;

            if (sendSchedule < now)
            {
                await Send();
            }
            else
            {
                ThreadPoolTimer.CreateTimer(TimerElapsedHandler, sendSchedule - now);
            }
        }
示例#14
0
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            var chatMessage = new ChatMessage()
            {
                From           = "Admin",
                SentDateTime   = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"),
                Message        = MessageTextBox.Text,
                IsAdminMessage = true
            };

            _chatEngine.SendToClient(chatMessage.Message, ChatClient.ClientId);
            MessageTextBox.Clear();
            MessageTextBox.Focus();
        }
示例#15
0
        void MessageKeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
            case Key.Enter:
                SendMessage();
                break;

            case Key.Tab:
                ShiftCurrentUser();
                MessageTextBox.Focus();
                break;
            }
        }
示例#16
0
        private async Task SendMessage()
        {
            try
            {
                //Calls method in hub - with the three arguments: email, groupid and message
                await connection.InvokeAsync("SendMessage", _emailAddress, _groupId, MessageTextBox.Text);

                MessageTextBox.Clear();
                MessageTextBox.Focus();
            }
            catch (Exception exception)
            {
                MessageList.AppendText(exception.Message);
            }
        }
示例#17
0
        public void RefreshDialogArea(bool scroll = true)
        {
            var messages = new List <Message>();

            if (SelectedContact != null)
            {
                messages.AddRange(App.Instance.Config.Messages.Where((x) => x.ContactKey == SelectedContact.PublicKey));
                MessagesList.ItemsSource = messages;
                MessageTextBox.Focus();
                if (scroll)
                {
                    MessagesListScroll.ScrollToEnd();
                }
            }
        }
示例#18
0
        public async void AsyncDisplayInformation()
        {
            while (true)
            {
                MessageTextBox.Text = Messages.Text;
                if (AutoRollChk.Checked)
                {
                    MessageTextBox.Focus();
                    MessageTextBox.Select(MessageTextBox.TextLength, 0);
                    MessageTextBox.ScrollToCaret();
                }


                await Task.Delay(500);
            }
        }
示例#19
0
        private void SendMessage()
        {
            if (MessageTextBox.Text == "")
            {
                return;
            }
            Command command = new Command(Constants.MessageTransferCommand, new Message(MessageTextBox.Text), NetworkOperator.ClientToken);
            bool    success = NetworkOperator.SendCommand(NetworkOperator.ServerAddress, NetworkOperator.ServerPort, command);

            if (!success)
            {
                ConnectionIndicator.Fill = Brushes.Red;                       // ошибка отправки
            }
            MessageTextBox.Text = "";
            MessageTextBox.Focus();
        }
示例#20
0
        private void ConnectButton_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(BotIdTextBox.Text) && !string.IsNullOrEmpty(DirectLineSecretTextBox.Text))
            {
                _botId            = BotIdTextBox.Text.Trim();
                _directLineSecret = DirectLineSecretTextBox.Text.Trim();

                groupBox.Enabled = true;
                MessageTextBox.Focus();

                Task.Run(() => StartBotConversation());
            }
            else
            {
                MessageBox.Show("Os campos BotId e DirectLineSecret são obrigatórios!");
            }
        }
示例#21
0
        public MainWindow()
        {
            InitializeComponent();
            var channelFactory = new DuplexChannelFactory <IOneMessengerService>(new ClientCallback(), "OneMessengerServiceEndpoint");

            try
            {
                _server = channelFactory.CreateChannel();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Sever not Runing");
            }

            TextDisplay.IsReadOnly = true;
            MessageTextBox.Focus();
        }
示例#22
0
        private void SendButton_Click(object sender, EventArgs e)
        {
            if (MessageTextBox.Text.Length > 0)
            {
                Activity userMessage = new Activity
                {
                    From = new ChannelAccount("UserTest"),
                    Text = MessageTextBox.Text,
                    Type = ActivityTypes.Message
                };

                Task.Run(() => _directLineClient.Conversations.PostActivityAsync(_conversation.ConversationId, userMessage));

                WriteMessage("UserTest", MessageTextBox.Text);
                MessageTextBox.Text = string.Empty;
                MessageTextBox.Focus();
            }
        }
示例#23
0
        private void Send()
        {
            StatusBand.Hide();

            #region Validation

            if (TitleTextBox.Text.Length == 0)
            {
                StatusBand.Warning(LocalizationHelper.Get("S.Feedback.Warning.Title"));
                TitleTextBox.Focus();
                return;
            }

            if (MessageTextBox.Text.Length == 0)
            {
                StatusBand.Warning(LocalizationHelper.Get("S.Feedback.Warning.Message"));
                MessageTextBox.Focus();
                return;
            }

            if (EmailTextBox.Text.Length == 0)
            {
                StatusBand.Warning(LocalizationHelper.Get("S.Feedback.Warning.Email"));
                EmailTextBox.Focus();
                return;
            }

            #endregion

            StatusBand.Info(LocalizationHelper.Get("S.Feedback.Sending"));

            Cursor             = Cursors.AppStarting;
            MainGrid.IsEnabled = false;
            MainGrid.UpdateLayout();

            Persist();

            Cursor             = Cursors.Arrow;
            MainGrid.IsEnabled = true;
        }
示例#24
0
        private void InitializeEvents()
        {
            MessageTextBox.KeyUp += (sender, args) =>
            {
                if (args.Key == Key.Enter)
                {
                    var text = MessageTextBox.Text;
                    if (!string.IsNullOrEmpty(text))
                    {
                        MessageTextBox.Clear();

                        _eventAggregator.GetEvent <SendMessageTextEvent>().Publish(text);
                    }
                }
            };

            NameTextBox.KeyUp += (sender, args) =>
            {
                if (args.Key == Key.Enter && !_connecting)
                {
                    _connecting = true;
                    AttemptConnection();
                }
            };

            _eventAggregator.GetEvent <ConnectedToServerEvent>().Subscribe(connectionEstablished =>
            {
                NameTextBox.IsEnabled = false;
                _connecting           = false;
            }, ThreadOption.UIThread, true);

            _eventAggregator.GetEvent <SelectUserEvent>().Subscribe(user =>
            {
                MessageTextBox.IsEnabled = true;
                MessageTextBox.Focus();
            }, ThreadOption.UIThread, true);
        }
示例#25
0
        private void StartButton_Click(object sender, EventArgs e)
        {
            try
            {
                epLocal = new IPEndPoint(IPAddress.Parse(LocalIpTextBox.Text), Convert.ToInt32(LocalPortTextBox.Text));
                sck.Bind(epLocal);

                epRemote = new IPEndPoint(IPAddress.Parse(FriendsIpTextBox.Text), Convert.ToInt32(FriendsPortTextBox.Text));
                sck.Connect(epRemote);

                byte[] buffer = new byte[1500];
                sck.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref epRemote, new AsyncCallback(MessageCallBack), buffer);

                StartButton.Text    = "Connected";
                StartButton.Enabled = false;
                SendButton.Enabled  = true;

                MessageTextBox.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#26
0
 private void ClientProcesssing()
 {
     try
     {
         //подключение к серверу
         client = new Socket(SocketType.Stream, ProtocolType.Tcp);
         int port = 50505;
         int.TryParse(PortBox.Text, out port);
         client.Connect(new IPEndPoint(IPAddress.Parse(IPBox.Text), port));
         client.SendTimeout = sendTimeout;
         //отправка запроса авторизации
         JObject request = new JObject();
         request.Add("action", "authorization");
         request.Add("name", NameBox.Text);
         request.Add("password", PasswordBox.Text);
         SendRequest(client, request);
         string resultString = "";
         //чтение ответа
         if ((resultString = ReceiveRequest(client)).Length > 0)
         {
             JObject result = JObject.Parse(resultString);
             if (result.GetValue("result").ToString() == "success")
             {
                 clientConnected = true;
                 Invoke((MethodInvoker)(() =>
                 {
                     MessagePanel.Enabled = true;
                     Disconnect.Enabled = true;
                     MessageTextBox.Focus();
                 }));
                 bool disconnectFromServer = false;
                 //работа клиента
                 while (clientConnected)
                 {
                     //чтение данных
                     if (client.Available >= 8 && (resultString = ReceiveRequest(client)).Length > 0)
                     {
                         result = JObject.Parse(resultString);
                         string action = result.GetValue("action").ToString();
                         if (action == "message")
                         {
                             string text = result.GetValue("message").ToString();
                             Invoke((MethodInvoker)(() =>
                             {
                                 label1.Text = label1.Text + (text + Environment.NewLine);
                                 ChatHistory.AppendText(text + Environment.NewLine);
                             }));
                         }
                         else if (action == "disconnect")
                         {
                             disconnectFromServer = true;
                             clientConnected      = false;
                         }
                     }
                 }
                 //запрос отключения
                 if (!disconnectFromServer)
                 {
                     request = new JObject();
                     request.Add("action", "disconnect");
                     SendRequest(client, request);
                 }
                 DisconnectUpdateUI();
                 //отключение от сервера
                 client.Close();
             }
             else
             {
                 client.Close();
                 DisconnectUpdateUI();
                 MessageBox.Show(result.GetValue("message").ToString());
             }
         }
         else
         {
             client.Close();
             DisconnectUpdateUI();
             MessageBox.Show("Unable to connect!");
         }
     }
     catch (ThreadAbortException)
     {
     }
     catch (Exception exception)
     {
         DisconnectUpdateUI();
         MessageBox.Show(exception.Message);
     }
 }
示例#27
0
 private void RichTextBox_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     RichTextBoxWaterMark.Visibility = System.Windows.Visibility.Collapsed;
     MessageTextBox.Focus();
 }
        private async void SendBtnClicked(object sender, RoutedEventArgs e)
        {
            string message = MessageTextBox.Text.Trim();

            // initialize file send
            if (string.IsNullOrWhiteSpace(message))
            {
                OpenFileDialog ofd = new OpenFileDialog {
                    Title = "Send File"
                };
                bool?result = ofd.ShowDialog();
                if (result.HasValue && result.Value)
                {
                    string key = (await SharedStuff.Database.Table <DatabaseHelper.Users>().Where(user => user.Username == Username)
                                  .FirstAsync()).Key;
                    // at first request a token
                    string id    = Guid.NewGuid().ToString();
                    var    msgUi = new ChatMessagesNotify
                    {
                        MyMessage = true,
                        Message   = Path.GetFileName(ofd.FileName),
                        FullDate  = DateTime.Now,
                        Type      = 1,
                        Sent      = 1,
                        FilePath  = ofd.FileName,
                        With      = Username
                    };
                    SharedStuff.PendingMessages.Add(id, msgUi);
                    // create json
                    string json = JsonConvert.SerializeObject(new JsonTypes.SendMessage
                    {
                        Type    = 2,
                        Id      = id,
                        Payload = new JsonTypes.SendMessagePayload
                        {
                            To      = Username,
                            Message = Path.GetFileName(ofd.FileName)
                        }
                    });
                    SharedStuff.Websocket.SendAsync(json, null);
                    AddMessage(msgUi);
                }
            }
            else
            {
                if (SharedStuff.Websocket.IsAlive)
                {
                    string id = Guid.NewGuid().ToString();
                    await Task.Run(() => SendMessage(message, id));

                    var msgUi = new ChatMessagesNotify
                    {
                        MyMessage = true,
                        Message   = message,
                        FullDate  = DateTime.Now,
                        Type      = 0,
                        Sent      = 1
                    };
                    AddMessage(msgUi);                          // add it to ui
                    SharedStuff.PendingMessages.Add(id, msgUi); // add message to pending messages
                }
                else
                {
                    var msgUi = new ChatMessagesNotify
                    {
                        MyMessage = true,
                        Message   = message,
                        FullDate  = DateTime.Now,
                        Type      = 0,
                        Sent      = 2
                    };
                    AddMessage(msgUi);
                }

                // finalizing UI
                MessageTextBox.Text = "";
                MessageTextBox.Focus();
                _stopLoading = true;
                MainScrollViewer.ScrollToBottom();
                MainScrollViewer.UpdateLayout();
                _stopLoading        = false;
                SendButtonIcon.Kind = PackIconKind.Attachment;
                SendButton.ToolTip  = "Send File";
            }
        }
示例#29
0
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            StatusBand.Hide();

            #region Validation

            if (TitleTextBox.Text.Length == 0)
            {
                StatusBand.Warning("You need to inform the title of the feedback.");
                TitleTextBox.Focus();
                return;
            }

            if (MessageTextBox.Text.Length == 0)
            {
                StatusBand.Warning("You need to inform the message of the feedback.");
                MessageTextBox.Focus();
                return;
            }

            #endregion

            #region UI

            StatusBand.Info(FindResource("Feedback.Sending").ToString());

            Cursor             = Cursors.AppStarting;
            MainGrid.IsEnabled = false;
            MainGrid.UpdateLayout();

            #endregion

            var passList = Secret.Password.Split('|');

            var smtp = new SmtpClient
            {
                Timeout               = (5 * 60 * 1000), //Minutes, seconds, miliseconds
                Port                  = Secret.Port,
                Host                  = Secret.Host,
                EnableSsl             = true,
                UseDefaultCredentials = true,
                Credentials           = new NetworkCredential(Secret.Email, passList[current])
            };

            var mail = new MailMessage
            {
                From       = new MailAddress("*****@*****.**"),
                Subject    = "Screen To Gif - Feedback",
                IsBodyHtml = true
            };

            mail.To.Add("*****@*****.**");

            #region Text

            var sb = new StringBuilder();
            sb.Append("<html xmlns:msxsl=\"urn:schemas-microsoft-com:xslt\">");
            sb.Append("<head><meta content=\"en-us\" http-equiv=\"Content-Language\" />" +
                      "<meta content=\"text/html; charset=utf-16\" http-equiv=\"Content-Type\" />" +
                      "<title>Screen To Gif - Feedback</title>" +
                      "</head>");

            sb.AppendFormat("<style>{0}</style>", Util.Other.GetTextResource("ScreenToGif.Resources.Style.css"));

            sb.Append("<body>");
            sb.AppendFormat("<h1>{0}</h1>", TitleTextBox.Text);
            sb.Append("<div id=\"content\"><div>");
            sb.Append("<h2>Overview</h2>");
            sb.Append("<div id=\"overview\"><table><tr>");
            sb.Append("<th _locid=\"UserTableHeader\">User</th>");

            if (MailTextBox.Text.Length > 0)
            {
                sb.Append("<th _locid=\"FromTableHeader\">Mail</th>");
            }

            sb.Append("<th _locid=\"VersionTableHeader\">Version</th>");
            sb.Append("<th _locid=\"WindowsTableHeader\">Windows</th>");
            sb.Append("<th _locid=\"BitsTableHeader\">Instruction Size</th>");
            sb.Append("<th _locid=\"MemoryTableHeader\">Working Memory</th>");
            sb.Append("<th _locid=\"IssueTableHeader\">Issue?</th>");
            sb.Append("<th _locid=\"SuggestionTableHeader\">Suggestion?</th></tr>");
            sb.AppendFormat("<tr><td class=\"textcentered\">{0}</td>", Environment.UserName);

            if (MailTextBox.Text.Length > 0)
            {
                sb.AppendFormat("<td class=\"textcentered\">{0}</td>", MailTextBox.Text);
            }

            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Assembly.GetExecutingAssembly().GetName().Version.ToString(4));
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Environment.OSVersion);
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Environment.Is64BitOperatingSystem ? "64 bits" : "32 Bits");
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", Humanizer.BytesToString(Environment.WorkingSet));
            sb.AppendFormat("<td class=\"textcentered\">{0}</td>", IssueCheckBox.IsChecked.Value ? "Yes" : "No");
            sb.AppendFormat("<td class=\"textcentered\">{0}</td></tr></table></div></div>", SuggestionCheckBox.IsChecked.Value ? "Yes" : "No");

            sb.Append("<h2>Details</h2><div><div><table>");
            sb.Append("<tr id=\"ProjectNameHeaderRow\"><th class=\"messageCell\" _locid=\"MessageTableHeader\">Message</th></tr>");
            sb.Append("<tr name=\"MessageRowClassProjectName\">");
            sb.AppendFormat("<td class=\"messageCell\">{0}</td></tr></table>", MessageTextBox.Text);
            sb.Append("</div></div></div></body></html>");

            #endregion

            mail.Body = sb.ToString();

            foreach (AttachmentListBoxItem attachment in AttachmentListBox.Items)
            {
                mail.Attachments.Add(new Attachment(attachment.Attachment));
            }

            smtp.SendCompleted += Smtp_OnSendCompleted;
            smtp.SendMailAsync(mail);
        }
        private async void MessageTextBox_OnKeyDown(object sender, KeyEventArgs e)
        {
            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
            {
                if (Keyboard.IsKeyDown(Key.Enter))
                {
                    string message = MessageTextBox.Text.Trim().TrimEnd(Environment.NewLine.ToCharArray());
                    // do not send the message if it's empty
                    if (string.IsNullOrWhiteSpace(message))
                    {
                        return;
                    }
                    if (SharedStuff.Websocket.IsAlive)
                    {
                        string id = Guid.NewGuid().ToString();
                        await Task.Run(() => SendMessage(message, id)); // send message over network

                        var msgUi = new ChatMessagesNotify
                        {
                            MyMessage = true,
                            Message   = message,
                            FullDate  = DateTime.Now,
                            Type      = 0,
                            Sent      = 1
                        };
                        AddMessage(msgUi);                          // add it to ui
                        SharedStuff.PendingMessages.Add(id, msgUi); // add message to pending messages
                    }
                    else
                    {
                        var msgUi = new ChatMessagesNotify
                        {
                            MyMessage = true,
                            Message   = message,
                            FullDate  = DateTime.Now,
                            Type      = 0,
                            Sent      = 2
                        };
                        AddMessage(msgUi);
                    }
                    // finalizing UI
                    MessageTextBox.Text = "";
                    MessageTextBox.Focus();
                    _stopLoading = true;
                    MainScrollViewer.ScrollToBottom();
                    MainScrollViewer.UpdateLayout();
                    _stopLoading        = false;
                    SendButtonIcon.Kind = PackIconKind.Attachment;
                    SendButton.ToolTip  = "Send File";
                }
            }
            if (string.IsNullOrWhiteSpace(MessageTextBox.Text)) // show attachment icon
            {
                SendButtonIcon.Kind = PackIconKind.Attachment;
                SendButton.ToolTip  = "Send File";
            }
            else
            {
                SendButtonIcon.Kind = PackIconKind.Send;
                SendButton.ToolTip  = "Send Message";
            }
        }