Esempio n. 1
0
        private void BtnDone_Click(object sender, EventArgs e)
        {
            try
            {
                input = Convert.ToInt16(TxtInput.Text);

                for (int i = 0; i < output.Length; i++)
                {
                    if (input == i + 1)
                    {
                        output[i, 1] += 1;
                    }
                }
                TxtInput.Clear();
            }
            catch (FormatException)
            {
                MessageBox.Show("Rating must be a number 1 - 10", "Hold up...", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (IndexOutOfRangeException)
            {
                MessageBox.Show("Rating must be a number 1 - 10", "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            finally
            {
                TxtInput.Clear();
            }
        }
Esempio n. 2
0
        private void ChangeToNext()
        {
            if (string.IsNullOrWhiteSpace(TxtInput.Trim()))
            {
                Messenger.Default.Send("数字输入框不允许为空!");
                return;
            }
            Article[Index - 1].StrInput = TxtInput;
            Index++;

            TxtInput = string.Empty;
            if (Index == Exam.NI_F_CRITERIA + 1)
            {
                Messenger.Default.Send("您已经达到满分标准!");
            }
            if (Index >= Article.Count + 1)
            {
                foreach (var item in Article)
                {
                    if (item.StrOri.Equals(item.StrInput))
                    {
                        item.IsAllRight = true;
                    }
                }
                int rightAmount = Article.Where(x => x.IsAllRight == true).Count();
                Messenger.Default.Send("已经是最后一条了!");
                SaveScore();
                return;
            }
            TxtOri = Article[Index - 1].StrOri;
        }
Esempio n. 3
0
 private void BtnSendText_Click(object sender, EventArgs e)
 {
     try
     {
         BtnSendText.Enabled = false;
         BtnSendFile.Enabled = false;
         TxtInput.ReadOnly   = true;
         Logger?.Debug("FrmTcpClient {0} sends text: {1}", Id, TxtInput.Text);
         WriteLogToUI("{0:yyyy-MM-dd HH:mm:ss} Send text: {1}", DateTime.Now, TxtInput.Text);
         bool isSuccessful;
         ///// Old method.
         // isSuccessful = TcpClientSend(Models.Param.TcpDataType.Text, Encoding.UTF8.GetBytes(TxtInput.Text));
         /// New method.
         isSuccessful = TcpClientSend(Helpers.TTcpSocket.Serialization.SerializeText(TxtInput.Text));
         if (isSuccessful)
         {
             TxtInput.Text       = "";
             TxtInput.ReadOnly   = false;
             BtnSendText.Enabled = true;
             BtnSendFile.Enabled = true;
             TxtInput.Focus();
         }
         else
         {
             Logger?.Error("FrmTcpClient {0} fails to send text: {1}", Id, TxtInput.Text);
             WriteLogToUI("Fail to send text: {0}", TxtInput.Text);
             DisconnectRoutine();
         }
     }
     catch (Exception ex)
     {
         Logger?.Error("Id = {0}", Id);
         Logger?.Error(ex);
     }
 }
        // sends text the user typed to client
        private void TxtInput_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.Key == Key.Return && TxtInput.IsEnabled == true)
                {
                    var keys = writers.Keys;//all threads
                    foreach (var key in keys)
                    {
                        writers[key].Write("SERVER>>> " + TxtInput.Text); //writes to all threads
                    }
                    TxtDisplay.Text += "\r\nSERVER>>> " + TxtInput.Text;  //displays it to the Display

                    if (TxtInput.Text == "TERMINATE")                     //ako user-a na servara signalizira prekrarqvane na wryzkata na syrwywa s klienta
                    {
                        foreach (var key in keys)
                        {
                            connections[key]?.Close();
                        }
                    }
                    TxtInput.Clear();
                }
            }
            catch (SocketException)
            {
                TxtDisplay.Text += "\nError writing object";
            }
        }
Esempio n. 5
0
        public void AddDigit(string Digit)
        {
            if (Digit == "." && TxtInput.Text.Contains(Digit))
            {
                return;
            }


            if (!isAction)
            {
                if (TxtInput.Text == "0" && Digit != ".")
                {
                    TxtInput.Text = Digit;
                }
                else
                {
                    TxtInput.AppendText(Digit);
                }
            }
            else
            {
                ClearScreen();
                AddDigit(Digit);
            }
        }
Esempio n. 6
0
        private void BtnF2C_Click(object sender, EventArgs e)
        {
            double f = Convert.ToDouble(TxtInput.Text);
            double c = (f - 32) * 5 / 9;

            TxtAns.Text = c.ToString("f2") + "度";
            TxtInput.Focus();
        }
Esempio n. 7
0
 /// <summary>Creates a new instance of <see cref="InputNotification"/>.</summary>
 /// <param name="text">Text to be displayed.</param>
 /// <param name="windowName">Title to be displayed on the Window.</param>
 /// <param name="defaultText">Text to be displayed in the TxtInput TextBox by default.</param>
 public InputNotification(string text, string windowName, string defaultText = "")
 {
     InitializeComponent();
     Title         = windowName;
     TxtPopup.Text = text;
     TxtInput.Text = defaultText;
     TxtInput.Focus();
 }
Esempio n. 8
0
        // Submit button
        //For the user to input what they think is correct
        private void BtnInput_Click(object sender, EventArgs e)
        {
            // for the user to guess
            string UserGuess;

            // to compare user input to word
            UserGuess = TxtInput.Text.ToString();
            bool value = cb.CompareWord(UserGuess);

            // The counter for each round if gussed correctly
            if (value == true)
            {
                // Display message box for right anwser
                MessageBox.Show("You are correct!!", "Correct", MessageBoxButtons.OK);
                {
                    // What radio button is click for each word list: This is Easy
                    if (RbtEasy.Checked)
                    {
                        LblWord.Text = cb.ScrambleEasy();
                        TxtInput.Clear();
                        TxtInput.Focus();
                    }

                    //What radio button is click for each word list: This is Medium
                    if (RbtMedium.Checked)
                    {
                        LblWord.Text = cb.ScrambleMedium();
                        TxtInput.Clear();
                        TxtInput.Focus();
                    }

                    //What radio button is click for each word list: This is Hard
                    if (RbtHard.Checked)
                    {
                        LblWord.Text = cb.ScrambleHard();
                        TxtInput.Clear();
                        TxtInput.Focus();
                    }
                }
                counter++;
            }
            // If the user is incorrect
            else
            {
                // Message box for incorrect
                MessageBox.Show("Wrong, try again!", "Incorrect", MessageBoxButtons.OK);
            }
            // Once counter has reached 5
            if (counter == 5)
            {
                // Hide currect window
                Hide();
                // Move to winner form
                Winner f3 = new Winner();
                f3.ShowDialog();
                Close();
            }
        }
Esempio n. 9
0
        private void CmdFiles_Click(object sender, EventArgs e)
        {
            DialogResult result1 = MessageBox.Show("Αρχείο εισαγωγής στίχων: inverse.txt\nΑρχείο εγγραφής αποτελεσμάτων: outverse.txt\nΝα συνεχίσω ;", "Έγκριση ...", MessageBoxButtons.OKCancel);
            String       message = null;

            ErrorLines = 0;
            TotalLines = 0;

            if (result1 == DialogResult.OK)
            {
                try
                {
                    /*ΑΝΟΙΓΜΑ ΑΡΧΕΙΟΥ ΤΟ ΟΠΟΙΟ ΒΡΙΣΚΕΤΑΙ ΣΤΟ ΣΧΕΤΙΚΟ ΜΟΝΟΠΑΤΙ ΤΟΥ project*/
                    using (StreamReader inputFile = new StreamReader("inverse.txt"))  /*Το using στο τέλος κλείνει το stream*/
                    {
                        /*Εφόσον όλα πήγαν ΟΚ με το άνοιγμα του input file θα δημιουργήσουμε το αρχείο των αποτελεσμάτων*/
                        /*ΑΝΟΙΓΜΑ ΑΡΧΕΙΟΥ ΑΠΟΤΕΛΕΣΜΑΤΩΝ*/
                        using (StreamWriter outputFile = new StreamWriter("outverse.txt"))
                        {
                            LblResult.Text = "Μετρική ανάλυση σε εξέλιξη ..."; //Εμφάνιση μηνύματος στο LblResult
                            LblResult.SelectAll();
                            LblResult.SelectionColor = Color.Black;

                            /*ΔΙΑΒΑΣΜΑ ΓΡΑΜΜΗ-ΓΡΑΜΜΗ ΤΟΥ ΑΡΧΕΙΟΥ ΜΕΧΡΙ ΤΟ EOF*/
                            while ((VerseLine = inputFile.ReadLine()) != null)
                            {
                                //Αύξηση της τιμής του counter των γραμμών
                                TotalLines++;

                                //Μετρική ανάλυση αυτού του στίχου
                                Metrics.DoScansion(ref VerseLine, ref ScansionLine, ref ErrorLines);

                                outputFile.WriteLine(VerseLine);    //Εγγραφή στο αρχείο αποτελεσμάτων του στίχου
                                outputFile.WriteLine(ScansionLine); //και του αποτελέσματος της μετρικής του ανάλυσης
                            }
                        }

                        message = "Η μετρική ανάλυση μέσω αρχείων ολοκληρώθηκε.\nΣύνολο στίχων: " + TotalLines + "\nΣύνολο λαθών: " + ErrorLines;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Λάθος στη διαχείριση των αρχείων !", MessageBoxButtons.OK);
                    LblResult.Clear();
                    TxtInput.Focus();
                    return;
                }
            }
            else
            {
                message = "Η διαδικασία ακυρώθηκε !";
            }

            MessageBox.Show(message, "Τέλος μετρικής ανάλυσης", MessageBoxButtons.OK);
            LblResult.Clear();
            TxtInput.Focus();
        }
Esempio n. 10
0
        public void end(String pR)
        {
            TxtInput.AppendText(pR + "\n");
            WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();

            wplayer.URL = @"C:\Users\Proprietaire\Documents\Projet_Perso\PROJET\BCA_MakingAnIA\BCA_MakingAnIA\Commands\NonOrdinateur.mp3";
            wplayer.controls.play();
            wake = false;
        }
Esempio n. 11
0
 public Scrambler()
 {
     // Song we are bringing in
     player.URL = "mario.mp3";
     InitializeComponent();
     // Generates the new scramble class
     cb = new ScrambleClass();
     // To focus the cusor
     TxtInput.Focus();
 }
Esempio n. 12
0
 private void BtnOK_Click(object sender, EventArgs e)
 {
     if (IsValidData())
     {
         decimal salesTax = Convert.ToDecimal(TxtInput.Text);
         Tag = salesTax;
     }
     else
     {
         TxtInput.Clear();
         TxtInput.Focus();
     }
 }
Esempio n. 13
0
        private void TxtInput_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter && TxtInput.TextLength > 0)
            {
                if (LstData.Items.Contains(TxtInput.Text))
                {
                    MessageBox.Show("Frucht existiert schon!");
                    return;
                }

                LstData.Items.Add(TxtInput.Text);
                TxtInput.Clear();
            }
        }
Esempio n. 14
0
 private void BtnF2C_Click(object sender, EventArgs e)
 {
     try
     {
         double f = Convert.ToDouble(TxtInput.Text);
         double c = (f - 32) * 5 / 9;
         TxtAns.Text = c.ToString("f2") + "度";
     }
     catch
     {
         TxtAns.Text = "度數請數入數值!";
         TxtInput.Clear();
     }
     TxtInput.Focus();
 }
Esempio n. 15
0
        public Form1()
        {
            InitializeComponent();

            //Δήλωση του χειριστή συμβάντος (handler) για τη χρήση του "Enter" στο TxtInput RichTextBox
            this.TxtInput.KeyDown += new KeyEventHandler(TxtInput_KeyDown);

            TxtInput.Clear();
            TxtInput.Focus();

            VerseLine    = null;
            ScansionLine = null;
            TotalLines   = 0;
            ErrorLines   = 0;

            Metrics = new metrics();
        }
Esempio n. 16
0
        public void MyAction()
        {
            try
            {
                #region Update TxtOutput
                string txtSalida  = string.Empty;
                string txtEntrada = String.Copy(TxtInput);
                string salto      = "\n";
                txtEntrada.Replace(salto, "");
                double[] data = TxtInput.Split(';').Select(n => Convert.ToDouble(n)).ToArray();
                txtSalida += "Minimum: " + data.Minimum();
                txtSalida += salto + "Maximum: " + data.Maximum();
                txtSalida += salto + "Count: " + data.Count();
                txtSalida += salto + "Mean: " + data.Mean();
                txtSalida += salto + "Median: " + data.Median();
                txtSalida += salto + "Variance: " + data.Variance();
                txtSalida += salto + "StandardDeviation: " + data.StandardDeviation();
                txtSalida += salto + "MaximumAbsolute: " + data.MaximumAbsolute();
                txtSalida += salto + "MinimumAbsolute: " + data.MinimumAbsolute();
                TxtOutput  = txtSalida;
                #endregion

                #region Update Chart Line
                ChartValues <double> cv = new ChartValues <double>();
                cv.AddRange(data);

                var lineSerie = new LineSeries
                {
                    Title  = "Values",
                    Values = cv,
                };

                //Bug Series.clear()
                while (series.Count > 0)
                {
                    series.RemoveAt(series.Count - 1);
                }

                series.Add(lineSerie);
                #endregion
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
        }
Esempio n. 17
0
        private void CmdVerse_Click(object sender, EventArgs e)
        {
            ErrorLines = 0;
            VerseLine  = TxtInput.Text;
            Metrics.DoScansion(ref VerseLine, ref ScansionLine, ref ErrorLines);

            if (ErrorLines != 0)
            {
                ScansionLine = "Λάθος ανάλυση...";
            }

            LblResult.Text = VerseLine + "\n" + ScansionLine;
            LblResult.SelectAll();
            LblResult.SelectionColor = Color.Black;

            TxtInput.Clear();
            CmdClear.Focus();
        }
        private void ChangeToNext()
        {
            if (string.IsNullOrWhiteSpace(TxtInput.Trim()))
            {
                Messenger.Default.Send("文本输入框不允许为空!");
                return;
            }
            Article[Index - 1].StrInput = TxtInput;
            Index++;

            TxtInput = string.Empty;
            if (Index >= Article.Count + 1)
            {
                Messenger.Default.Send("恭喜您已输入完毕所有内容!");
                SaveScore();
                return;
            }
            TxtOri = Article[Index - 1].StrOri;
        }
 private void BtnSend_Click(object sender, EventArgs e)
 {
     if (selectedContact != null)
     {
         if (string.IsNullOrWhiteSpace(TxtInput.Text))
         {
             MessageBox.Show("The message must not be empty.");
         }
         else
         {
             MessageService.SendMessage(selectedContact, TxtInput.Text);
             PrintMessage(MessageRepo.GetLastMessage(selectedContact));
             TxtInput.ResetText();
         }
     }
     else
     {
         MessageBox.Show("Plz select a contact before sending a message.");
     }
 }
Esempio n. 20
0
        private void BtnLoadSelectedFiles_Click(object sender, EventArgs e)
        {
            TxtInput.Clear();
            List <string> FilesToLoad = new List <string>();

            foreach (var file in LstFiles.SelectedItems)
            {
                FilesToLoad.Add(file.ToString());
            }
            TxtInput.Text = Functions.LoadFiles(FilesToLoad);

            TxtOutput.Clear();
            TxtCount.Clear();

            Tuple <Dictionary <char, uint>, Dictionary <char, uint> > tp = Functions.MakeOldCodeDict(TxtInput.Text.ToCharArray());

            DictOldCode  = tp.Item1;
            DictCountDup = tp.Item2;

            ShowLastDict(DictOldCode);
        }
Esempio n. 21
0
 private void BtnSend_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (_clientSocket.Connected)
         {
             Stream s      = _clientSocket.GetStream();
             byte[] buffer = Encoding.ASCII.GetBytes(TxtInput.Text);
             s.Write(buffer, 0, buffer.Length);
             s.Flush();
             TxtInput.Clear();
         }
         else
         {
             MessageBox.Show("Connected.");
         }
     }
     catch (SocketException se)
     {
         MessageBox.Show("Message not sent: " + se);
     }
 }
Esempio n. 22
0
 private void Window_Activated(object sender, EventArgs e)
 {
     TxtInput.Focus();
     TxtInput.SelectAll();
 }
Esempio n. 23
0
 public InputMessage(string Message)
 {
     InitializeComponent();
     Lable1.Content = Message;
     TxtInput.Focus();
 }
Esempio n. 24
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     TxtInput.Focus();
     TxtInput.SelectAll();
 }
Esempio n. 25
0
 private Prompt()
 {
     InitializeComponent();
     TxtInput.Focus();
 }
Esempio n. 26
0
 private void PenPartControlBase_Loaded(object sender, RoutedEventArgs e)
 {
     TxtInput?.SetBinding(TextBox.TextProperty, PropBinding);
 }
Esempio n. 27
0
 public override void UpdataBinding(object source)
 {
     base.UpdataBinding(source);
     TxtInput?.SetBinding(TextBox.TextProperty, PropBinding);
 }
Esempio n. 28
0
        } // end method SelectText
        #endregion Private Methods

        #region Control Events
        // have an initial operation on the status of the specified controls as well as the date and time
        private void FrmMainPage_Load(object sender, EventArgs e)
        {
            InitialiseControlStatus(); // call the specified method to initialise the status of the specified controls
            TxtInput.Select();
            LblDateAndTime.Text = DateTime.Now.ToString(); // display the start date and time, which is accurate to a second
        } // end method FrmMainPage_Load
Esempio n. 29
0
        } // end method InitialiseControlStatus 

        // select all in the specified text box
        private void SelectText()
        {
            TxtInput.Select();
            TxtInput.SelectAll();
        } // end method SelectText
Esempio n. 30
0
        private void b_Create_Click(object sender, EventArgs e)
        {
            try
            {
                if (formBCTransmitterSubmissionDtl is null || _txtInput is null)
                {
                    MessageBox.Show("You didn't select XML or txt file.");
                    return;
                }

                string fileName = fd_TxtFile.SafeFileName.Split(" ")[0].Replace("[", "");
                sfd_SaveFile.FileName = $"{fileName} Company - Explanation of Errors.xlsx";

                if (sfd_SaveFile.ShowDialog() == DialogResult.OK)
                {
                    FileInfo fi = new FileInfo(@$ "ErrorExplanation.xlsx");
                    var      explanationExcelFile = new ExcelPackage(fi);
                    var      wse = explanationExcelFile.Workbook.Worksheets[0];

                    var start = wse.Dimension.Start;
                    var end   = wse.Dimension.End;

                    List <ErrorExplanationDto> errorExplanation = new List <ErrorExplanationDto>();

                    for (int r = start.Row + 1; r <= end.Row; r++)
                    {
                        errorExplanation.Add(new ErrorExplanationDto()
                        {
                            ErrorType        = wse.Cells[r, 1].Text == "" ? "All" : wse.Cells[r, 1].Text,
                            ErrorTitle       = wse.Cells[r, 2].Text,
                            ErrorExplanation = wse.Cells[r, 3].Text
                        });
                    }

                    AddExplanation addExplanation = new AddExplanation();
                    formBCTransmitterSubmissionDtl.ACATransmitterSubmissionDetail.TransmitterErrorDetailGrp.Select(s => s.ErrorMessageDetail?.ErrorMessageCd).Where(s => s is { }).Distinct().All(a =>
                    {
                        if (!errorExplanation.Any(f => f.ErrorType == "All" && f.ErrorTitle.ToLower().Trim() == a?.ToLower().Trim()))
                        {
                            addExplanation.tb_ErrorTitle.Text   = a;
                            addExplanation.rtb_Explanation.Text = "";

                            if (addExplanation.ShowDialog() == DialogResult.OK)
                            {
                                errorExplanation.Add(addExplanation.errorExplanation);
                            }
                        }

                        return(true);
                    });


                    List <OutputDto> output = new List <OutputDto>();

                    formBCTransmitterSubmissionDtl.ACATransmitterSubmissionDetail.TransmitterErrorDetailGrp.All(a =>
                    {
                        string[] uniqe = a?.UniqueRecordId?.Split("|");

                        if (uniqe is { })
                        {
                            int personNumber = Convert.ToInt32(uniqe[2]);
                            TxtInput single  = _txtInput.FirstOrDefault(f => f.PersonNumber == personNumber);

                            var explanations   = errorExplanation.Where(f => f.ErrorTitle.ToLower().Trim() == a.ErrorMessageDetail.ErrorMessageCd.ToLower().Trim());
                            string explanation = "";

                            if (explanations is { } && explanations.Count() > 0)