Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RandomButton_Click(object sender, EventArgs e)
        {
            InputTextBox.Clear();
            OutputTextBox.Clear();
            TimeBox.Clear();
            CountText.Clear();

            int    n    = rnd.Next(2, 20);
            int    k    = rnd.Next(1, n);
            string line = null;

            for (int i = 0; i < k; i++)
            {
                int temp1 = rnd.Next(1, n);
                int temp2 = rnd.Next(1, n);
                if (temp1 != temp2)
                {
                    line += temp1 + " " + temp2 + "\n";
                    i++;
                }
            }
            if (line != null)
            {
                InputTextBox.Text = line.Trim();
            }
            CountText.Text = n + " " + k;
        }
Esempio n. 2
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     InputTextBox.Clear();
     OutputTextBox.Clear();
     arrayLengthLabel.Text = "Длина массива:";
     timeSortLabel.Text    = "Время работы сортировки:";
 }
Esempio n. 3
0
        private void mDoScriptAnalyzis()
        {
            logLabel.Text = "Running analysis...";
            OutputTextBox.Clear();
            using (var templateAccessor = new TemplateListAccessor())
            {
                if (templateAccessor.ExecuteTemplate(scriptFilePathTextBox.Text) == true)
                {
                    logLabel.Text = "Script complies with an expected predef.lua script";
                    List <Template> templateList = templateAccessor.GetAllTemplates();

                    foreach (Template template in templateList)
                    {
                        string s = "id = " + template.ID.ToString() + " - " +
                                   "classid = " + template.Class.ToString() + "\n";
                        OutputTextBox.AppendText(s);
                    }
                }
                else
                {
                    OutputTextBox.AppendText(templateAccessor.GetLastExecutionError());
                    logLabel.Text = "Script DOES NOT comply with an expected predef.lua script";
                }
            }
        }
Esempio n. 4
0
        private void GenerateButtonClick(object sender, EventArgs e)
        {
            int  number;
            bool result = int.TryParse(NumberOfGuidsTextBox.Text, out number);

            if (!result)
            {
                MessageBox.Show("Invalid number specified");
                return;
            }

            OutputTextBox.Clear();

            var sb = new StringBuilder();

            for (int i = 0; i < number; i++)
            {
                var x    = Guid.NewGuid();
                var guid = IncludeDashesCheckBox.Checked ? x.ToString() : x.ToString().Replace("-", "");

                sb.Append(guid);
                sb.Append("\r\n");
            }

            OutputTextBox.Text = sb.ToString();
        }
Esempio n. 5
0
 private void ResetTextButton_Click(object sender, EventArgs e)
 {
     InputTextBox.Clear();
     OutputTextBox.Clear();
     CopyToBufferButton.Enabled = false;
     ActiveControl = InputTextBox;
 }
Esempio n. 6
0
 private void ClearButton_Click(object sender, EventArgs e)
 {
     InputTextTextBox.Clear();
     OutputTextBox.Clear();
     secetWordTextBox.Clear();
     secetWordTextBox.Focus();
 }
Esempio n. 7
0
        private void SubmitInputButton_Click(object sender, EventArgs e)
        {
            try
            {
                string RusKey = "Ё!\"№;%:?*()_+ЙЦУКЕНГШЩЗХЪ/ФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,ё1234567890-=йцукенгшщзхъ\\фывапролджэячсмитьбю. ";
                string EngKey = "~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:\"ZXCVBNM<>?`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./ ";


                string Text       = InputTextBox.Text;
                string OutputText = "";

                for (int i = 0; i < Text.Length; i++)
                {
                    try
                    {
                        OutputText += EngKey.Substring(RusKey.IndexOf(Text[i]), 1);
                    }
                    catch
                    {
                        OutputText += RusKey.Substring(EngKey.IndexOf(Text[i]), 1);
                    }
                }


                OutputTextBox.Clear();
                OutputTextBox.AppendText(OutputText);
                MessageBox.Show("Успешно переведено                                                  ");
            }
            catch
            {
                MessageBox.Show("Что-то пошло не так                                                      ");
            }
        }
Esempio n. 8
0
        private void DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
        {
            IsDownloading = false;
            if (NotifyOnDone)
            {
                Invoke(new MethodInvoker(() => Notify()));
            }
            Invoke(new MethodInvoker(() =>
            {
                UnlockButtons();
                StopAsyncButton.Enabled = false;
                OutputTextBox.Clear();
            }));

            if (e.Cancelled)
            {
                Invoke(new MethodInvoker(() => OutputTextBox.Text = $"Cancelled downloading for {((DownloadSession)sender).FileName}"));
            }
            else if (e.Error != null)
            {
                Invoke(new MethodInvoker(() =>
                                         ErrorTextBox.Text = $@"{e.Error.Message}
                    { e.Error.StackTrace}
                    { e.Error?.InnerException?.Message }
                    { e.Error?.InnerException?.StackTrace}"
                                         ));
            }
            else
            {
                Invoke(new MethodInvoker(() => OutputTextBox.Text = $"Finished downloading for {((DownloadSession)sender).FileName}"));
                File.WriteAllBytes(string.Format(@"\\?\{0}{1}", downloadLocation, ((DownloadSession)sender).FileName), e.Result);
            }
        }
Esempio n. 9
0
        private void TransferButton_Click(object sender, EventArgs e)
        {
            var count = InputTextBox.Text.Count(Char.IsDigit);

            string[] TextToTransfer = new string[count];

            OutputTextBox.Clear();

            using (StringReader reader = new StringReader(InputTextBox.Text))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    // Do something with the line
                    line = _defaultPhrase + SpacesPhrase + line;

                    if (!string.IsNullOrWhiteSpace(OutputTextBox.Text))
                    {
                        OutputTextBox.AppendText("\r\n" + line);
                    }
                    else
                    {
                        OutputTextBox.AppendText(line);
                    }
                    OutputTextBox.ScrollToCaret();
                }
            }
        }
Esempio n. 10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ClearButton_Click(object sender, EventArgs e)
 {
     InputTextBox.Clear();
     OutputTextBox.Clear();
     TimeBox.Clear();
     CountText.Clear();
 }
Esempio n. 11
0
        private void Grid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0 && !IsDownloading)
            {
                LockButtons();
                OutputTextBox.Clear();

                new Thread(() => Download(Grid["Address", e.RowIndex].Value as string, Grid["Extension", e.RowIndex].Value as string)).Start();
            }
        }
Esempio n. 12
0
 private void InitialViewers()
 {
     LexicaRresultView.Clear();
     LexicaRresultView.Columns.Add("Id", 36, HorizontalAlignment.Center);
     LexicaRresultView.Columns.Add("String", 186, HorizontalAlignment.Center);
     LexicaRresultView.Columns.Add("Type", 110, HorizontalAlignment.Center);
     LexicaRresultView.Columns.Add("Line", 48, HorizontalAlignment.Center);
     LexicaRresultView.Columns.Add("Column", 48, HorizontalAlignment.Center);
     OutputTextBox.Clear();
 }
Esempio n. 13
0
        //Reset Button

        private void button2_Click(object sender, EventArgs e)
        {
            InputTextBox.Clear();
            OutputTextBox.Clear();
            FahrenheitToCelciusRadioButton.Checked = false;
            CelciusToFahrenheitRadioButton.Checked = false;
            CelciusToKelvinRadioButton.Checked     = false;
            KelvinToCelciusRadioButton.Checked     = false;
            FahrenheitToKelvinRadioButton.Checked  = false;
        }
Esempio n. 14
0
 /// <summary>
 /// Raises the RunPGM event.
 /// </summary>
 /// <param name="command">Command that is to be executed</param>
 private void OnRunPGM(string command)
 {
     //Issue 889: making sure command text is not null or empty string
     if (RunPGM != null && !string.IsNullOrEmpty(command) && command.Trim().Length > 0)
     {
         OutputTextBox.Clear();
         btnCancelRunningCommands.Enabled = true;
         btnRun.Enabled = false;
         RunPGM(command);      // dcs90 7/7/2008 because resultlts must be handled for each command
     }
 }
Esempio n. 15
0
 private void ClearButton_Click(object sender, RoutedEventArgs e)
 {
     if (_executer.FileIsChosen)
     {
         OutputTextBox.Clear();
     }
     else
     {
         MessageBox.Show("You don't choose the file");
     }
 }
Esempio n. 16
0
        private void InputButton_Click(object sender, EventArgs e)
        {
            OutputTextBox.Clear();
            try
            {
                if (prolog == null)
                {
                    labelError.Text = "Please Select Theory";
                    return;
                }
                if (prolog is Perm)
                {
                    Term      goal = new Struct("perm", Term.createTerm(InputTextBox.Text), new Var("R"));
                    SolveInfo SI   = prolog.solve(goal);

                    if (!SI.isSuccess())
                    {
                        OutputTextBox.AppendText("no");
                    }

                    while (SI.isSuccess())
                    {
                        OutputTextBox.AppendText(SI.getTerm("R").toString() + "\n");
                        if (prolog.hasOpenAlternatives())
                        {
                            SI = prolog.solveNext();
                        }
                        else
                        {
                            break;
                        }
                    }
                }
                else if (prolog is PrologDerivate)
                {
                    Term      goal = new Struct("dExpr", Term.createTerm(InputTextBox.Text), new Var("DT"));
                    SolveInfo SI   = prolog.solve(goal);

                    if (!SI.isSuccess())
                    {
                        OutputTextBox.AppendText("no");
                    }
                    else
                    {
                        OutputTextBox.AppendText(SI.getTerm("DT").toString() + "\n");
                    }
                }
            }
            catch (MalformedGoalException ex) {
                OutputTextBox.AppendText("Malformed Goal\n");
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Open File with tested data and output it in TextBox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OpenFileButton_Click(object sender, RoutedEventArgs e)
        {
            
            string path = _executer.GetStringPath();
           List<string[]> formatedCoordinates = _executer.GetDataFromFile(path);
            if (_executer.FileIsChosen)
                OutputTextBox.Clear();

            foreach (var line in formatedCoordinates)
            {
                OutputTextBox.Text += $"X:{line[0]} Y:{line[1]}\n"; 
            }
        }
Esempio n. 18
0
    private void GenerateButton_Click(object sender, EventArgs e)
    {
        OutputTextBox.Clear();
        OutputTextBox.Text += "A\tB\tC\r\n";
        OutputTextBox.Text += GetHorizontalLineText();
        var myTruthTable = GenerateTruthTable().ToList();

        foreach (var item in myTruthTable)
        {
            OutputTextBox.Text += GetFormattedItemText(item);
            OutputTextBox.Text += GetHorizontalLineText();
        }
    }
Esempio n. 19
0
        private void SelectButton_Click(object sender, EventArgs e)
        {
            // Create an instance of the opeKn file dialog box.
            var openFileDialog1 = new OpenFileDialog
            {
                // ReSharper disable once LocalizableElement
                Filter = "Microsoft Office files|*.DOC;*.DOT;*.DOCM;*.DOCX;*.DOTM;*.ODT;*.XML;*.RTF;*.MHT;" +
                         "*.WPS;*.WRI;*.XLS;*.XLT;*.XLW;*.XLSB;*.XLSM;*.XLSX;" +
                         "*.XLTM;*.XLTX;*.CSV;*.ODS;*.POT;*.PPT;*.PPS;*.POTM;" +
                         "*.POTX;*.PPSM;*.PPSX;*.PPTM;*.PPTX;*.ODP",
                FilterIndex = 1,
                Multiselect = false
            };

            // Process input if the user clicked OK.
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                // Open the selected file to read.
                string tempFolder = null;

                try
                {
                    tempFolder = GetTemporaryFolder();
                    _tempFolders.Add(tempFolder);

                    var outputFile = openFileDialog1.FileName.Substring(0, openFileDialog1.FileName.LastIndexOf('.')) + ".pdf";

                    OutputTextBox.Clear();
                    OutputTextBox.Text = @"Converting...";

                    using (var memoryStream = new MemoryStream())
                        using (var converter = new Converter(memoryStream))
                        {
                            converter.UseLibreOffice = LibreOfficeCheckBox.Checked;
                            converter.Convert(openFileDialog1.FileName, outputFile);
                            OutputTextBox.Text += Environment.NewLine + Encoding.Default.GetString(memoryStream.ToArray());
                            OutputTextBox.Text += Environment.NewLine + @"Converted file written to '" + outputFile + @"'";
                        }
                }
                catch (Exception ex)
                {
                    if (tempFolder != null && Directory.Exists(tempFolder))
                    {
                        Directory.Delete(tempFolder, true);
                    }

                    OutputTextBox.Text = GetInnerException(ex);
                }
            }
        }
Esempio n. 20
0
        public void ResetProgram()
        {
            int test = new int();

            AttemptStop();
            ErrorTextBox.Clear();
            OutputTextBox.Clear();
            Interpret.Reset();
            Settings.CanReset = false;
            SetRunToRun();
            SetOptionsToOptions();
            EnableEdit();
            PixelGridUI.NewGrid();
        }
Esempio n. 21
0
        ///// <summary>
        ///// change the font color of the selected Line.
        ///// </summary>
        ///// <param name="lineNo">number of line to be changed</param>
        ///// <param name="color">the color to which to change</param>

        //private void ChangeColor(int lineNo, Color color)
        //{
        //    int startPos = TextArea.SelectionStart;
        //    int currLine = txtTextArea.GetLineFromCharIndex(txtTextArea.SelectionStart);
        //    int lineLen = txtTextArea
        //}
        /// <summary>
        /// Raises the RunCommand event.
        /// </summary>
        /// <param name="command">Command that is to be executed</param>
        private void OnRunCommand(string command)
        {
            //Issue 889: making sure command text is not null or empty string
            if (RunCommand != null && !string.IsNullOrEmpty(command) && command.Trim().Length > 0)
            {
                OutputTextBox.Clear();
                btnCancelRunningCommands.Enabled = false;
                btnRun.Enabled = false;

                RunCommand(command);

                btnCancelRunningCommands.Enabled = true;
                btnRun.Enabled = true;
            }
        }
Esempio n. 22
0
        private void FilterButton_Click(object sender, EventArgs e)
        {
            if (HasFiltred)
            {
                return;
            }

            LockButtons();
            OutputTextBox.Clear();
            new Thread(() =>
            {
                Filter();

                Invoke(new MethodInvoker(() => UnlockButtons()));
            }).Start();
        }
Esempio n. 23
0
 public void ClearAll()
 {
     if (OutputTextBox.InvokeRequired)
     {
         ClearAllCallback d = new ClearAllCallback(ClearAll);
         OutputTextBox.BeginInvoke(d, new object[] { });
     }
     else
     {
         OutputTextBox.Clear();
         ErrorsAndWarningsDict.Clear();
         OutputTextBox.ScrollToCaret();
         LastHighlitedLine = -1;
         //Application.DoEvents();
     }
 }
Esempio n. 24
0
        private void OpenFileButton_Click(object sender, RoutedEventArgs e)
        {
            OutputTextBox.Text.Trim();
            _path = _executer.GetStringPath();
            List <string> formatedCoordinates = _executer.GetDataFromFile(_path);

            if (_executer.FileIsChosen)
            {
                OutputTextBox.IsEnabled = true;
                OutputTextBox.Clear();
                foreach (var line in formatedCoordinates)
                {
                    OutputTextBox.Text += $"{line}\n";
                }
            }
        }
Esempio n. 25
0
 private void mnuEditFind_Click(object sender, EventArgs e)
 {
     OutputTextBox.Clear();
     if (txtTextArea.TextLength > 0)
     {
         SearchDialog dlg = new SearchDialog(txtTextArea.SelectedText);
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             currentSearchString = dlg.SearchString;
             int currentPos = txtTextArea.SelectionStart;
             currentSearchOpts = (RichTextBoxFinds)0;
             if (dlg.SearchDirection == SearchDialog.Direction.Beginning)
             {
                 txtTextArea.SelectionStart = 0;
             }
             else if (dlg.SearchDirection == SearchDialog.Direction.Backward)
             {
                 currentSearchOpts |= RichTextBoxFinds.Reverse;
             }
             if (dlg.CaseSensitive)
             {
                 currentSearchOpts |= RichTextBoxFinds.MatchCase;
             }
             currentSearchOpts |= (dlg.WholeWord) ? RichTextBoxFinds.WholeWord : RichTextBoxFinds.None;
             int location = 0;
             if (txtTextArea.TextLength > txtTextArea.SelectionStart)
             {
                 location = txtTextArea.Find(dlg.SearchString, txtTextArea.SelectionStart, currentSearchOpts);
             }
             if (location > 0)
             {
                 txtTextArea.SelectionStart  = location;
                 txtTextArea.SelectionLength = currentSearchString.Length;
             }
             else
             {
                 OutputTextBox.Text          = SharedStrings.EOF;
                 txtTextArea.SelectionStart  = currentPos;
                 txtTextArea.SelectionLength = 0;
             }
         }
     }
     else
     {
         OutputTextBox.Text = SharedStrings.NO_SEARCH_TEXT;
     }
 }
Esempio n. 26
0
        /// <summary>
        /// Generates matches.
        ///
        /// -number of matches are determined by the appropriate field
        /// -this algorithm creates any number of round robin matches with approximately balanced number of times Players have fought one another, to spread out finishedMatchups as best as possible over the course of many matches
        /// -this is done by simply picking Players who have the worst highest weight of opponents and teammates and generates their matches first.
        /// </summary>
        private void GenerateSetsButton_Click(object sender, EventArgs e)
        {
            OutputTextBox.Clear();

            //makes a simple backup of the existing CSV files so that this operation can be undone
            CreateBackup();

            //if you dont have a full roster, add fill in Players
            AddFillinTeammatesToRoster();

            //generates matches (the number of which is designated in NumSetsOfMatchesToGenerateField)
            for (int l = 0; l < Int32.Parse(NumSetsOfMatchesToGenerateField.Text); l++)
            {
                GenerateSet(l);
            }
            SavePlayers();
        }
Esempio n. 27
0
        private void Sort_Click(object sender, EventArgs e)
        {
            timer = new Stopwatch();
            string[] temp = InputTextBox.Text.Split();
            arr = new int[temp.Length];
            for (int i = 0; i < temp.Length; i++)
            {
                arr[i] = Convert.ToInt32(temp[i]);
            }
            timer.Start();
            sorting(ref arr, 0, arr.Length - 1);
            timer.Stop();
            Graf.Series[1].Points.Clear();
            if (point.ContainsKey(arr.Length))
            {
                point[arr.Length] = timer.Elapsed.Ticks;
            }
            else
            {
                point.Add(arr.Length, timer.Elapsed.Ticks);
            }

            foreach (var item in point)
            {
                Graf.Series[1].Points.AddXY(item.Key, item.Value);
            }

            //отображаем результаты сортировки
            OutputTextBox.Clear();
            timeSortLabel.Visible = true;
            timeSortLabel.Text    = "Время работы сортировки: " + timer.Elapsed.Ticks.ToString();
            for (int i = 0; i < arr.Length; i++)
            {
                OutputTextBox.Text += arr[i].ToString();
                if (i % 35 == 0 && i != 0)
                {
                    OutputTextBox.Text += '\n';
                }
                else
                {
                    OutputTextBox.Text += " ";
                }
            }
        }
Esempio n. 28
0
 private void ResetUI()
 {
     if (!EncryptRadio.Enabled)
     {
         DecryptRadio.Checked = true;
     }
     else if (!DecryptRadio.Enabled)
     {
         EncryptRadio.Checked = true;
     }
     else
     {
         EncryptRadio.Checked = false;
         DecryptRadio.Checked = false;
     }
     InputTextBox.Clear();
     OutputTextBox.Clear();
     CopyToBufferButton.Enabled = false;
 }
Esempio n. 29
0
        private void CreateLocalHashButton_Click(object sender, EventArgs e)
        {
            OutputTextBox.Clear();
            System.Text.StringBuilder output = new StringBuilder();
            Updater.Lib lib = new Lib();

            OutputTextBox.Text = lib.create_manifest_file(@"C:\work-space-set\epi-info-set\epiinfo\Epi Info 7\build\debug");

            /*
             * System.Collections.Generic.Dictionary<string,string> file_list = lib.create_file_hash_dictionary(@"C:\work-space-set\epi-info-set\epiinfo\Epi Info 7\build\debug");
             * int File_Count = file_list.Count;
             *
             * foreach (KeyValuePair<string, string> kvp in file_list)
             * {
             *  output.Append(kvp.Key);
             *  output.Append(":");
             *  output.AppendLine(kvp.Value);
             * }
             *
             * OutputTextBox.Text = "NumberOfFiles: " + File_Count.ToString() + "\r\n" + output.ToString();
             */
        }
Esempio n. 30
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SortButton_Click(object sender, EventArgs e)
        {
            OutputTextBox.Clear();
            TimeBox.Clear();
            string[] line = CountText.Text.Split();
            int      n    = int.Parse(line[0]);
            int      k    = int.Parse(line[1]);

            char[]   ch  = { ' ', '\n' };
            string[] str = InputTextBox.Text.Split(ch);
            string   ans = AlgorithmSort.Sort(n, k, str);

            for (int i = 0; i < ans.Length; i++)
            {
                OutputTextBox.Text += ans[i];
            }
            TimeBox.Text = AlgorithmSort.time.Elapsed.Ticks.ToString();
            if (AlgorithmSort.cycle == false)
            {
                if (flag)
                {
                    chart1.Series[1].Points.Clear();
                    if (point.ContainsKey(ans.Length))
                    {
                        point[ans.Length] = AlgorithmSort.a;
                    }
                    else
                    {
                        point.Add(ans.Length, AlgorithmSort.a);
                    }
                    foreach (var item in point)
                    {
                        chart1.Series[1].Points.AddXY(item.Key, item.Value);
                    }
                }
            }
            flag = true;
        }