private void KeysForm_Load(object sender, EventArgs e)
        {
            MiscFunctions.CheckFile("apikeys.txt");

            StreamReader sr = File.OpenText("apikeys.txt");

            while (sr.Peek() >= 0)
            {
                string   line  = sr.ReadLine();
                string[] words = line.Split(';');
                dataGridView1.Rows.Add(dataGridView1.RowCount, words[1], words[2]);
            }
            sr.Close();
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();

            #region skin
            var skinManager = MaterialSkinManager.Instance;
            skinManager.AddFormToManage(this);
            skinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            skinManager.ColorScheme = new ColorScheme(Primary.LightBlue800, Primary.LightBlue900, Primary.LightBlue500, Accent.LightBlue200, TextShade.WHITE);
            #endregion

            inputTextBox.Text  = MiscFunctions.GetDesktopPath() + @"\words.txt";
            outputTextBox.Text = MiscFunctions.GetDesktopPath();
        }
Esempio n. 3
0
        public LangForm()
        {
            InitializeComponent();

            MiscFunctions.CheckFile("langs.txt");
            StreamReader sr = File.OpenText("langs.txt");

            while (sr.Peek() >= 0)
            {
                string line = sr.ReadLine();
                comboBox1.Items.Add(line);
            }
            sr.Close();
        }
Esempio n. 4
0
        private void materialRaisedButton1_Click_1(object sender, EventArgs e)
        {
            MessageBox.Show("Open a new instance of your browser!");
            List <string> list = new List <string>();

            list = MiscFunctions.GatherWords(inputTextBox.Text);
            if (File.Exists(inputTextBox.Text))
            {
                if (list.Count == 0)
                {
                    MessageBox.Show("Words list is empty!");
                }
                else
                {
                    foreach (var item in list)
                    {
                        Process.Start("https://translate.google.com/#view=home&op=translate&sl=en&tl=sl&text=" + item);
                    }
                }
            }
        }
Esempio n. 5
0
        private void compileBtn_Click(object sender, EventArgs e)
        {
            if (apiKeyTextBox.Text == "Please select or write an api key")
            {
                MessageBox.Show("Please enter a valid api key!");
            }
            else
            {
                sw.Start();
                dic.Clear();
                PathIn      = inputTextBox.Text;
                ApiKeyConst = apiKeyTextBox.Text;

                includeStatus.CountCheck    = false;
                includeStatus.OrderCheck    = false;
                includeStatus.EngWordsCheck = false;
                includeStatus.SloWordsCheck = false;
                includeStatus.MeaningCheck  = false;
                includeStatus.PronCheck     = false;
                includeStatus.UrlCheck      = false;

                if (countCheck.Checked == true)
                {
                    includeStatus.CountCheck = true;
                }
                if (orderCheck.Checked == true)
                {
                    includeStatus.OrderCheck = true;
                }
                if (engWordsCheck.Checked == true)
                {
                    includeStatus.EngWordsCheck = true;
                }
                if (sloWordsCheck.Checked == true)
                {
                    includeStatus.SloWordsCheck = true;
                }
                if (meaningCheck.Checked == true)
                {
                    includeStatus.MeaningCheck = true;
                }
                if (pronCheck.Checked == true)
                {
                    includeStatus.PronCheck = true;
                }
                if (urlCheck.Checked == true)
                {
                    includeStatus.UrlCheck = true;
                }

                try
                {
                    List <string> progressLenghtCheck = MiscFunctions.GatherWords(PathIn);
                    progressBar.Maximum         = progressLenghtCheck.Count();
                    progressBar.SuperscriptText = "/" + progressLenghtCheck.Count();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + " (GetProgressBarLength.0)");
                }

                BackgroundWorker worker = new BackgroundWorker();

                if (engWordsCheck.Checked == false && sloWordsCheck.Checked == false && meaningCheck.Checked == false && pronCheck.Checked == false && urlCheck.Checked == false)
                {
                    MessageBox.Show("No include option checked! Do so at setting tab!");
                    //TimerLabel.Content = "Took: --- ms";
                    //ItemsCountLabel.Content = "composed: --- words";
                    //ListOutput.Items.Add("You must select at least one include checkbox!");
                }
                else
                {
                    materialTabControl1.SelectTab("tabPage2");
                    worker.RunWorkerCompleted   += Worker_RunWorkerCompleted;
                    worker.WorkerReportsProgress = true;
                    worker.DoWork          += Worker_DoWork;
                    worker.ProgressChanged += Worker_ProgressChanged;
                    worker.RunWorkerAsync();
                }
            }
        }
Esempio n. 6
0
 private void browseOutPathBtn_Click(object sender, EventArgs e)
 {
     outputTextBox.Text = MiscFunctions.GetPath("folder");
 }
Esempio n. 7
0
 private void browseSrcPathBtn_Click(object sender, EventArgs e)
 {
     inputTextBox.Text = MiscFunctions.GetPath("file");
 }
Esempio n. 8
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            fail = false;
            var worker = sender as BackgroundWorker;

            worker.ReportProgress(0);

            List <string> list = new List <string>();

            try
            {
                list = MiscFunctions.GatherWords(PathIn);
                if (includeStatus.OrderCheck)
                {
                    list.Sort();
                }
                try
                {
                    Word word;
                    int  count = 0;
                    foreach (var item in list)
                    {
                        count++;
                        word = new Word();

                        if (includeStatus.CountCheck)
                        {
                            word.WordCount = count + ";";
                        }
                        if (includeStatus.EngWordsCheck)
                        {
                            word.EngWord = item + ";";
                        }
                        if (includeStatus.SloWordsCheck)
                        {
                            word.SloWord = Translation.TranslateAsync(item, ApiKeyConst, langTextBox.Text) + ";";
                        }
                        if (includeStatus.MeaningCheck)
                        {
                            word.Meaning = "Meaning" + ";";
                        }
                        if (includeStatus.PronCheck)
                        {
                            word.Pron = "Pronunciation" + ";";
                        }
                        if (includeStatus.UrlCheck)
                        {
                            string tempUrl = string.Format("https://www.google.com/search?q={0}&tbm=isch&q=", item);
                            word.UrlText = tempUrl;
                        }
                        dic.Add(word.ConcatenateProperties());
                        worker.ReportProgress(count);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "(compileScript.1)", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    fail = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "(compileScript.0)", MessageBoxButtons.OK, MessageBoxIcon.Error);
                fail = true;
            }
        }