Пример #1
0
        private void SendButton_Click(object sender, EventArgs e)
        {
            if (UserList.SelectedIndex >= 0 && MessageTextBox.Text != "")
            {
                Thread waiting_thread = new Thread(new ThreadStart(new Action(() =>
                {
                    WaitingForm form = new WaitingForm("Отправка...");
                    form.ShowDialog();
                })));
                waiting_thread.Start();

                ActionResult result = client.SendMessage(user_name, UserList.SelectedItem.ToString(), MessageTextBox.Text);

                try { waiting_thread.Abort(); }
                catch (Exception ex) { }

                if (!result.Result)
                {
                    MessageBox.Show(result.Data, ErrorMessages.ERR_ERROR,
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    AddMessage(user_name, UserList.SelectedItem.ToString(), MessageTextBox.Text);
                    MessageTextBox.Clear();
                }
            }
            else
            {
                MessageBox.Show("Вы не выбрали получателя либо не ввели текст сообщения!", "Предупреждение",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #2
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");
            }
        }
Пример #3
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;
        }
Пример #4
0
        public void start()
        {
            try
            {
                client = new MqttClient(host, port, false, null);
                client.Connect(Guid.NewGuid().ToString(), username, password);
                client.MqttMsgPublishReceived += new MqttClient.MqttMsgPublishEventHandler(client_MqttMsgPublishReceived);
            }
            catch
            {
                label4.Text = "Can't connect to server";
            }
            if (client != null && client.IsConnected)
            {
                label4.Text = "";
                MessageTextBox.Clear();
            }
            button2.Enabled = false;
            timer3.Enabled  = true;
            c_id            = System.IO.File.ReadAllText("C_ID.text");

            if (c_id == "")
            {
                c_id = "rds" + generateID();
                System.IO.StreamWriter file = new System.IO.StreamWriter("C_ID.text");
                file.Write(c_id);
                file.Close();
            }

            Subscribe(c_id);
            Run_Config();
            timer1.Enabled = true; // Read Config
        }
Пример #5
0
        private void FeedbackForm_Load(object sender, EventArgs e)
        {
            string version4 = OSInfo.GetDotNetVersion("4.0");
            string version  = OSInfo.GetDotNetVersion();

            MessageTextBox.AppendText(string.Format("小丸工具箱 版本: {0}", new Version(ProductVersion)));
            MessageTextBox.AppendText(string.Format("\r\n操作系统: {0}{1} ({2}.{3}.{4}.{5})",
                                                    OSInfo.GetOSName(), OSInfo.GetOSServicePack(), OSInfo.OSMajorVersion, OSInfo.OSMinorVersion, OSInfo.OSRevisionVersion, OSInfo.OSBuildVersion));
            if (string.IsNullOrEmpty(version4))
            {
                MessageTextBox.AppendText("\r\n.NET Framework 4.0 未安装");
            }
            else
            {
                MessageTextBox.AppendText(string.Format("\r\nMicrosoft .NET Framework: {0}", version4));
            }
            if (!string.IsNullOrEmpty(version) && !version4.Equals(version))
            {
                MessageTextBox.AppendText(string.Format("\r\nMicrosoft .NET Framework: {0}", version));
            }
            if (!string.IsNullOrEmpty(CheckAviSynth()))
            {
                MessageTextBox.AppendText("\r\n" + CheckAviSynth());
            }
            else
            {
                MessageTextBox.AppendText("\r\nAvisynth 未安装");
            }
            MessageTextBox.AppendText("\r\n------------------------------以上信息为自动检测请勿修改------------------------\r\n\r\n");
        }
Пример #6
0
 private void OnSendMsgButtonClick(object sender, EventArgs e)
 {
     udpClient.SendMsg(MessageTextBox.Text);
     MessageDisplayTextBox.AppendText(MessageTextBox.Text + "\r\n");
     MessageDisplayTextBox.Refresh();
     MessageTextBox.Clear();
 }
Пример #7
0
 private void MessageTextBox_OnLoaded(object sender, RoutedEventArgs e)
 {
     if (new KeyboardCapabilities().KeyboardPresent > 0)
     {
         MessageTextBox.Focus(FocusState.Programmatic);
     }
 }
Пример #8
0
 public TabTelnetDesigner()
 {
     InitializeComponent();
     InitializeTelnet();
     MessageTextBox.Focus();
     this.ActiveControl = MessageTextBox;
 }
Пример #9
0
 private void MessageTimer_Tick(object sender, EventArgs e)
 {
     MessageTextBox.Text = Messages.Text;
     MessageTextBox.Focus();
     MessageTextBox.Select(MessageTextBox.TextLength, 0);
     MessageTextBox.ScrollToCaret();
 }
 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;
 }
Пример #11
0
 private void CopyToClipboard()
 {
     // Copy the content of the text box to the clipboard.
     MessageTextBox.SelectAll();
     MessageTextBox.Copy();
     MessageTextBox.Select(0, 0);
 }
Пример #12
0
        public void UpdateDisplays(byte[] buffer)
        {
            StatusDisplayLabel.Text = buffer[buffer.Length - 1].ToString("X2");

            byte commandByte = buffer[0];

            byte[] packetPayload = new byte[MRSPSP.PSPC.PacketPayloadSize];
            for (int i = 1; i < MRSPSP.PSPC.PacketPayloadSize; ++i)
            {
                packetPayload[i - 1] = buffer[i];
            }

            if (commandByte == (byte)MRSMessageType.MRSTextMessage)
            {
                char[] msg = new char[MRSPSP.PSPC.PacketPayloadSize];
                for (int i = 1; i < MRSPSP.PSPC.PacketPayloadSize; ++i)
                {
                    msg[i - 1] = (char)buffer[i];
                }
                if (MessageTextBox.Lines.Length > 0)
                {
                    MessageTextBox.AppendText(Environment.NewLine + new string(msg));
                }
                else
                {
                    MessageTextBox.AppendText(new string(msg));
                }
            }
            else if (commandByte == (byte)MRSMessageType.DSMCUStatusPacket)
            {
                DSMCUStatus dSMCUStatus = StructByteConverter.StructByteConverter.fromBytes <DSMCUStatus>(packetPayload);
                VBatt5DisplayLabel.Text = dSMCUStatus.VSupply.ToString("0000");
            }
        }
Пример #13
0
 public void OnChatToggle(bool isOpen)
 {
     ((ChatViewModel)DataContext).OnChatToggle(isOpen);
     if (isOpen)
     {
         MessageTextBox.Focus();
     }
 }
Пример #14
0
 private void SendMessage(object s, RoutedEventArgs ev)
 {
     Client.SendMessage(MessageTextBox.Text);
     Dispatcher.Invoke(() => {
         AppendMessage(MessageTextBox.Text, DateTime.Now);
         MessageTextBox.Clear();
     });
 }
Пример #15
0
 /// <summary>
 /// 添加消息
 /// </summary>
 /// <param name="message"></param>
 private void appendMessage(string message)
 {
     if (MessageTextBox.Text.Length != 0)
     {
         MessageTextBox.AppendText("\r\n");
     }
     MessageTextBox.AppendText(message);
 }
Пример #16
0
 private void MessageTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter && (e.KeyboardDevice.Modifiers & ModifierKeys.Shift) != ModifierKeys.Shift)
     {
         _viewModel.AddMessage(MessageTextBox.Text);
         MessageTextBox.Clear();
         e.Handled = true;
     }
 }
Пример #17
0
 private async void SendButton_Click(object sender, EventArgs e)
 {
     await Task.Run(() =>
     {
         byte[] buffer = Encoding.UTF8.GetBytes($"{UserName}: {MessageTextBox.Text}");
         ClientSocket.Send(buffer);
         MessageTextBox.Clear();
     });
 }
Пример #18
0
 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();
 }
Пример #19
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 = "";
     }
 }
Пример #20
0
 private void OnKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         udpClient.SendMsg(MessageTextBox.Text);
         MessageDisplayTextBox.AppendText(MessageTextBox.Text + "\r\n");
         MessageDisplayTextBox.Refresh();
         MessageTextBox.Clear();
     }
 }
Пример #21
0
 private void ChatButton_Click(object sender, EventArgs e)
 {
     ChatListBox.Items.Add("...............");
     ChatListBox.Items.Add("Ви:");
     ChatListBox.Items.Add(MessageTextBox.Text);
     MessageTextBox.Clear();
     ChatListBox.Items.Add("...............");
     ChatListBox.Items.Add("Оператор:");
     ChatListBox.Items.Add("Залиште Ваш номер, i оператор передзвонить Вам");
 }
Пример #22
0
 private void NewBtn_Click(object sender, RoutedEventArgs e)
 {
     //to clear all textbox and be ready to save
     InvoiceTxtbox.Clear();
     CustNameTxbox.Clear();
     CustEmailTxtbox.Clear();
     CustAddressTxbox.Clear();
     MessageTextBox.Clear();
     isNewRecord = true;
 }
Пример #23
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();
        }
Пример #24
0
 private void AppendMessage(string text)
 {
     //if not disposed
     if (outpuTimer != null)
     {
         MessageTextBox.Text          += text;
         MessageTextBox.SelectionStart = MessageTextBox.Text.Length;
         MessageTextBox.ScrollToCaret();
         MessageTextBox.Visible = true;
     }
 }
Пример #25
0
        private void SendMessage(object sender, RoutedEventArgs e)
        {
            var trimmedText = MessageTextBox.Text.Trim(' ');

            if (trimmedText == "")
            {
                return;
            }
            SendCommand(RatCommand.SendMessage, Common.MessageEncoding.GetBytes(trimmedText));
            MessageTextBox.Clear();
        }
Пример #26
0
        private void LogMessage(string message, Brush color)
        {
            var test = new TextRange(MessageTextBox.Document.ContentEnd, MessageTextBox.Document.ContentEnd);

            test.Text = "[" + DateTime.Now.ToLongTimeString() + "] " + message + '\r';

            // Coloring there.
            test.ApplyPropertyValue(TextElement.ForegroundProperty, color);
            FileLog.Append(test.Text);
            MessageTextBox.ScrollToEnd();
        }
Пример #27
0
        private void MessageTextBox_Leave(object sender, EventArgs e)
        {
            MessageTextBox.AddText(MessageTextBoxPlaceholder);

            //if (String.IsNullOrWhiteSpace(MessageTextBox.Text))
            //{
            //	MessageTextBox.ForeColor = Color.Gray;
            //	MessageTextBox.Font = new Font("Segoe UI Light", 14f, FontStyle.Regular);

            //	MessageTextBox.Text = MessageTextBoxPlaceholder;
            //}
        }
Пример #28
0
 private void DisconnectUpdateUI()
 {
     Invoke((MethodInvoker)(() =>
     {
         Connect.Enabled = true;
         MessagePanel.Enabled = false;
         Disconnect.Enabled = false;
         ChatHistory.Clear();
         Connect.Focus();
         MessageTextBox.Clear();
     }));
 }
Пример #29
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);
            }
        }
Пример #30
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();
    }