예제 #1
0
        private void SendInput()
        {
            var saveInput = InputBox.Text.Trim();
            var code      = "(" + saveInput + ")";

            try
            {
                if (Echo)
                {
                    __print("<div color=gray>" + code + "</div>");
                }

                var parsedMisp = MISPLIB.Core.Parse(new MISPLIB.StringIterator(code));
                InputBox.Clear();

                var evaluatedResult = MISPLIB.Core.Evaluate(parsedMisp, GlobalScope);

                if (ShowResult)
                {
                    var outputBuilder = new StringBuilder();
                    MISPLIB.Core.EmissionID = Guid.NewGuid();
                    evaluatedResult.Emit(outputBuilder);
                    __print("<div color=green>" + outputBuilder.ToString() + "</div>");
                }

                CommandMemory.Add(saveInput);
                MemoryScrollIndex = CommandMemory.Count;
            }
            catch (Exception x)
            {
                __print("<div color=red>" + x.Message + "</div>");
                InputBox.Text = saveInput;
            }
        }
 private void ExpandSearchBox()
 {
     SearchIconBox.Visible = false;
     PlaceHolder           = InputBox.Text;
     InputBox.Clear();
     StartExpand();
 }
예제 #3
0
        private void OnKeyDownHandler(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Return && InputBox.Text != string.Empty)
            {
                string command = InputBox.Text;
                InputBox.Clear();
                if (command == "exit")
                {
                    this.Close();
                    return;
                }
                _networkService.EnqueueCommand(command);

                //consoleControlOutput.WriteOutput($"Input: {command}\n", Colors.White);
                Log.Debug(this, $"{command}");
                //Log.Warn(this, $"{command}");
                //Log.Error(this, $"{command}");
                //consoleControlInput.ClearOutput();

                _commandList.Add(command);
                if (_commandList.Count >= MaxCommands)
                {
                    _commandList.RemoveAt(0);
                }
                _commandIndex = _commandList.Count - 1;
            }
        }
        private void AddBtn_Click(object sender, EventArgs e)
        {
            int n;

            try
            {
                n = HorList.SelectedIndices[0];
            }
            catch { return; }


            dataN++;
            DataList.Items.Add("Input-" + dataN + "(" + n + ")");
            Console.WriteLine(String.Join(",", outputtype.getOutput(n)));

            /*
             * double[] d=new double[10];
             * for (int i=0; i < 10; i++)
             *  d[i] = 0;
             * d[n] = 1;
             */
            UserInput u = new UserInput(BoolToDouble(InputBox.GetArray()), outputtype.getOutput(n));

            myList.Add(u);
            InputBox.Clear();
        }
예제 #5
0
 private void SendInputButton_Click(object sender, EventArgs e)
 {
     sr.ServerCommand(InputBox.Text);
     OutputBox.SelectionColor = Color.Blue;
     OutputBox.SelectedText   = "] " + InputBox.Text + "\n";
     InputBox.Clear();
 }
        private void AnyBoxChecked(object sender, EventArgs e)
        {
            var senderAsCheckbox = sender as CheckBox;

            if (senderAsCheckbox.Checked != true)
            {
                return;
            }

            if (senderAsCheckbox.Name.EndsWith("In"))
            {
                uncheckCheckboxes(true);
                InputBox.Clear();
                senderAsCheckbox.CheckedChanged -= AnyBoxChecked;
                senderAsCheckbox.Checked         = true;
                senderAsCheckbox.CheckedChanged += AnyBoxChecked;
            }
            else if (senderAsCheckbox.Name.EndsWith("Out"))
            {
                uncheckCheckboxes(false);
                senderAsCheckbox.CheckedChanged -= AnyBoxChecked;
                senderAsCheckbox.Checked         = true;
                senderAsCheckbox.CheckedChanged += AnyBoxChecked;
            }
            else
            {
                Console.WriteLine("Error!");
                throw new Exception("Text.EndsWith didn't return properly!");
            }
        }
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            //如果没有开始记录过程或者验证过程,就直接返回
            if (!(recordStart || verifyStart))
            {
                return;
            }
            //过滤掉这些键
            if (e.Key == Key.LeftShift || e.Key == Key.RightShift)
            {
                return;
            }

            if (e.Key == Key.Enter)
            {
                if (InputBox.Text == PasswordShow.Text)
                {
                    MessageBoxResult result = MessageBox.Show("Do you want to save?", "Save", MessageBoxButton.YesNo);
                    if (result == MessageBoxResult.Yes)
                    {
                        SaveData();
                    }
                    InputBox.Clear();
                }
                else
                {
                    MessageBox.Show("Incorrect password!");
                }
            }
            timeline.MarkDown(e.Key);
        }
        private void ExecuteButton_OnClick(object sender, RoutedEventArgs e)
        {
            var result = Bot.Chat(string.IsNullOrEmpty(InputBox.Text) ? "clear" : InputBox.Text);

            ResponseLabel.Content = result.BotMessage;
            InputBox.Clear();
        }
예제 #9
0
 private void SendMessageButton_Click(object sender, EventArgs e)
 {
     if (CurrentChannel != "" && CurrentServer != "")
     {
         Program.SendMessageToChannel(CurrentChannel, CurrentServer, InputBox.Text);
         InputBox.Clear();
     }
 }
예제 #10
0
 /// <summary>
 /// Makes sure the first character is a letter.
 /// </summary>
 private void FirstCharacter(char ch)
 {
     if (!char.IsLetter(ch))
     {
         InputBox.Clear();
         Error("First character must be a letter.");
     }
 }
        private void SendButton_Click(object sender, RoutedEventArgs e)
        {
            string newMessage = InputBox.Text;

            InputBox.Clear();
            ws.Send(newMessage);
            messages.Add(newMessage);
        }
 private void DelBtn_Click(object sender, EventArgs e)
 {
     DataList.Items.Clear();
     myList.Clear();
     OutputLabel.Text = "Input";
     UserBox.Clear();
     ShowBox.Clear();
     InputBox.Clear();
 }
예제 #13
0
        private void EvaluateButton_OnClick(object sender, RoutedEventArgs e)
        {
            var message = string.IsNullOrEmpty(InputBox.Text) ? "clear" : InputBox.Text;
            var result  = Bot.Evaluate(message);

            ResultBox.Text = result.Serialize();
            result.Invoke();
            InputBox.Clear();
        }
예제 #14
0
 private void InputBox_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == System.Convert.ToChar(13))
     {
         e.Handled = true;
         Terminal.ServerPrint(InfoType.信息, InputBox.Text);
         InputBox.Clear();
     }
 }
예제 #15
0
파일: TextInput.cs 프로젝트: nandub/DeOps
        private void PlainTextButton_Click(object sender, EventArgs e)
        {
            // clear formatting
            string text = InputBox.Text;

            InputBox.Clear();
            InputBox.Text = text;

            PlainTextMode = true;
        }
예제 #16
0
        private void buttonClicked(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            if (InputBox.Text == "0")
            {
                InputBox.Clear();
            }
            InputBox.Text += button.Text;
        }
예제 #17
0
파일: Form1.cs 프로젝트: 20chan/SimpleChat
 private void Send()
 {
     if (InputBox.Text == string.Empty)
     {
         MessageBox.Show("입력안했는데요", "잠깐");
         return;
     }
     this.Client.Send(InputBox.Text);
     InputBox.Clear();
 }
예제 #18
0
파일: Form1.cs 프로젝트: Siubaak/IGA2D
 private void 新建ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     IsCalculate   = false;
     Picture.Image = null;
     Input         = null;
     FilePath      = null;
     InputBox.Clear();
     OutputBox.Clear();
     Text = "IGA2D";
 }
예제 #19
0
        private void InputBox_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.Up)
            {
                MemoryScrollIndex -= 1;
                if (MemoryScrollIndex < 0)
                {
                    MemoryScrollIndex = 0;
                }
                if (MemoryScrollIndex < CommandMemory.Count)
                {
                    InputBox.Text = CommandMemory[MemoryScrollIndex];
                    InputBox.Focus();
                    InputBox.SelectAll();
                }

                e.Handled = true;
            }
            else if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.Down)
            {
                MemoryScrollIndex += 1;
                if (MemoryScrollIndex > CommandMemory.Count)
                {
                    MemoryScrollIndex = CommandMemory.Count;
                }
                if (MemoryScrollIndex < CommandMemory.Count)
                {
                    InputBox.Text = CommandMemory[MemoryScrollIndex];
                    InputBox.Focus();
                    InputBox.SelectAll();
                }

                e.Handled = true;
            }
            else if (e.Key == Key.Return)
            {
                var saveInput = InputBox.Text.Trim();

                try
                {
                    InputBox.Clear();
                    (OutputBox.Document as dynamic).body.innerHTML += "<font color=red>" + saveInput + "</font><br>";
                    Driver.Input(saveInput);
                    CommandMemory.Add(saveInput);
                    MemoryScrollIndex = CommandMemory.Count;
                }
                catch (Exception x)
                {
                    (OutputBox.Document as dynamic).body.innerHTML += "<br><font color=red>" + x.Message + "</font><br>";
                    InputBox.Text = saveInput;
                }

                e.Handled = true;
            }
        }
예제 #20
0
 private void SendImage(System.Drawing.Image img)
 {
     if (TrySendImageMsg(img))
     {
         InputBox.Clear();
     }
     else
     {
         MessageBox.Show("Message send failed.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
예제 #21
0
        private void InputReceived(string input)
        {
            InputBox.Clear();
            input = input.Trim();

            //If input is valid, go to the next page
            if (Core.ValidateInput(input))
            {
                this.NavigationService.Navigate(new ProcessingPage(input));
            }
        }
예제 #22
0
 private void SendInputtedText()
 {
     if (TrySendTextMsg(InputBox.Text))
     {
         InputBox.Clear();
     }
     else
     {
         MessageBox.Show("Message send failed.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
예제 #23
0
 /// <summary>
 /// 获取服务器信息
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Label_MouseDown_1(object sender, MouseButtonEventArgs e)
 {
     TrySendPackage(new TransPackage()
     {
         Name        = WindowParent.NickName,
         ClientGuid  = WindowParent.ClientGuid,
         Content     = InputBox.Text,
         PackageType = ConstDef.ReportTerminalOutput
     });
     InputBox.Clear();
 }
예제 #24
0
 private void Reset()
 {
     InputBox.IsEnabled      = true;
     VowelButton.IsEnabled   = true;
     ConstButton.IsEnabled   = true;
     ConfirmButton.IsEnabled = true;
     TimeLeft           = 30;
     ProgressBar.Value  = 30;
     Limit              = 0;
     LabelTimer.Content = "30";
     CountBox.Clear();
     InputBox.Clear();
     PickedChars.Clear();
 }
예제 #25
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (!CashMachine.Instance.State.OnAcceptButton())
     {
         DisplayText(CashMachine.Instance.State);
         int    i = 0;
         string s = InputBox.Text;
         if (int.TryParse(s, out i))
         {
             CashMachine.Instance.State.Operate(i);
         }
     }
     InputBox.Clear();
 }
예제 #26
0
        private void OnStateChanged(IState s)
        {
            if (s is NullState)
            {
                InputBox.PasswordChar = '*';
            }
            else
            {
                InputBox.PasswordChar = '\0';
            }

            DisplayText(s);
            InputBox.Clear();
        }
예제 #27
0
 private void SendText(object sender, System.Windows.Input.KeyEventArgs e)
 {
     // TODO: Add event handler implementation here.
     if (e.Key == Key.Enter)
     {
         //string temp = ;
         TextBlock temp = new TextBlock();
         temp.Text  = "ME: ";
         temp.Text += InputBox.Text;
         InputBox.Clear();
         ListBoxItem NewEntity = new ListBoxItem();
         NewEntity.Content = temp;
         TextView.Items.Add(NewEntity);
     }
 }
예제 #28
0
        private async void Add_Click(object sender, EventArgs e)
        {
            try
            {
                string url = InputBox.Text;
                if (url.Contains("audio/au"))
                {
                    Regex  re = new Regex(@"(audio/au)\d+", RegexOptions.Compiled);
                    string id = re.Match(url).ToString();
                    id = id.Replace("audio/au", "");


                    string name = "";
                    name = await api.GetSingle(id);

                    if (name != "")
                    {
                        DownloadList.Items.Add(name);
                    }
                }

                else if (url.Contains("audio/am"))
                {
                    Regex  re = new Regex(@"(audio/am)\d+", RegexOptions.Compiled);
                    string id = re.Match(url).ToString();
                    id = id.Replace("audio/am", "");

                    List <string> nameList = new List <string>();
                    nameList = await api.GetPlayList(id);

                    if (nameList.Count() != 0)
                    {
                        foreach (string name in nameList)
                        {
                            DownloadList.Items.Add(name);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                StatusLabel.Text = ex.Message;
            }
            finally
            {
                InputBox.Clear();
            }
        }
예제 #29
0
 private void StartButton_Click(object sender, EventArgs e)
 {
     if (splitIntoBox.Value != 0)
     {
         FileInfo file = new FileInfo(InputBox.Text);
         string   name = file.Name.Substring(0, file.Name.LastIndexOf("."));
         using (PdfReader pdfReader = new PdfReader(InputBox.Text))
         {
             int fileNum = 1;
             for (int pageNumber = 1; pageNumber <= pdfReader.NumberOfPages; pageNumber++, fileNum++)
             {
                 ITextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
                 string   currentText             = PdfTextExtractor.GetTextFromPage(pdfReader, pageNumber, strategy);
                 string   filename = name + "-" + fileNum + ".pdf";
                 Document document = new Document();
                 PdfCopy  pdfCopy  = new PdfCopy(document, new FileStream(OutputBox.Text + "\\" + filename, FileMode.Create));
                 document.Open();
                 pdfCopy.AddPage(pdfCopy.GetImportedPage(pdfReader, pageNumber));
                 if (splitIntoBox.Value != 1)
                 {
                     for (int i = 2; i <= splitIntoBox.Value && pageNumber <= pdfReader.NumberOfPages; i++)
                     {
                         pageNumber++;
                         if (pageNumber > pdfReader.NumberOfPages)
                         {
                             MessageBox.Show($"Total amount of pages is not able to be split into {splitIntoBox.Value}s. Exit application, delete the files created, and try again.", "Error",
                                             MessageBoxButtons.OK, MessageBoxIcon.Error);
                             return;
                         }
                         pdfCopy.AddPage(pdfCopy.GetImportedPage(pdfReader, pageNumber));
                     }
                 }
                 document.Close();
             }
             MessageBox.Show("Document Processed.");
             Process.Start(OutputBox.Text);
             InputBox.Clear();
             OutputBox.Clear();
         }
     }
     else if (splitIntoBox.Value <= 0)
     {
         MessageBox.Show("Page Split number is not valid", "Not Valid",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #30
0
        private void InputBox_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                if (InputBox.Text == "")
                {
                    return;
                }
                string[] args = InputBox.Text.Split(' ');
                if (args[0].ToLower() != "op")
                {
                    Program.ServerConnection.SendPacket("ADMIN||" + args[0].ToUpper() + "||" + InputBox.Text.Replace(args[0], "").Trim());
                }
                else
                {
                    int rank = 0;
                    if (Int32.TryParse(args[args.Length - 1], out rank))
                    {
                        string username = null;
                        for (int i = 0; i < args.Length - 1; i++)
                        {
                            if (i != 0 && i != args.Length - 1)
                            {
                                if (username == null)
                                {
                                    username += args[i];
                                }
                                else
                                {
                                    username += " " + args[i];
                                }
                            }
                        }

                        Program.ServerConnection.SendPacket("ADMIN||OP||" + username.Trim() + "||" + rank.ToString());
                    }
                    else
                    {
                        WriteMessage("Invalid args");
                    }
                }
                InputBox.Clear();
                e.Handled = true;
            }
        }