Exemple #1
0
 private void goToUrlInLink(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (sender is LinkLabel)
     {
         Runner.OpenURL(Utils.GetLocalizedPrefix() + "forcemem.com");
     }
 }
Exemple #2
0
 void OpenSelectedNode()
 {
     if (!string.IsNullOrEmpty(tv.SelectedNode.Tag as string))
     {
         Runner.OpenURL((string)tv.SelectedNode.Tag);
     }
 }
Exemple #3
0
        bool ShowArticles_body(string word, string codeFrom, string codeTo, IWaitingUIObject waitingUiObject)
        {
            //http://www.albahari.com/threading/part2.aspx
            if (waitingUiObject != null)
            {
                lock (waitingUiObject)
                {
                    ++waitingUiObject.WaitingProgressCounter;
                }
            }
            string fileName = this.GetContents(word, codeFrom, codeTo);

            if (string.IsNullOrEmpty(fileName))
            {
                string mes = string.Format("Word '{0}' not founded", word);
                MessageBox.Show(mes, "DictionaryBlend", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            Runner.OpenURL(fileName);
            if (waitingUiObject != null)
            {
                lock (waitingUiObject)
                {
                    --waitingUiObject.WaitingProgressCounter;
                }
            }
            return(true);
        }
Exemple #4
0
        private void miPpenLocalLibrary_Click(object sender, EventArgs e)
        {
            string folder = Directory.GetCurrentDirectory() + "\\Library";

            if (Directory.Exists(folder))
            {
                Runner.OpenURL(folder);
            }
        }
Exemple #5
0
        //www.subtitles.com.br/search-subtitles-test-0-all-all-1.htm
        // telesubtitles.com/
        private void gutenbergToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem mi = (ToolStripMenuItem)sender;

            //throw new ApplicationException("!!!");
            //int ii = 0;
            //int i = 4 / ii;

            if (sender == this.gutenbergToolStripMenuItem)
            {
                // марк твен www.gutenberg.org/browse/authors/t#a53
                Runner.OpenURL("http://www.gutenberg.org/catalog/"); // www.gutenberg.org/browse/authors/a
            }
            else if (sender == this.manybooksnetToolStripMenuItem)
            {
                Runner.OpenURL("http://manybooks.net/language.php");
            }
            else if (sender == this.englishLibrarynetToolStripMenuItem)
            {
                Runner.OpenURL("http://www.davidappleyard.com/library/");
            }
            else if (sender == this.bibliomaniaToolStripMenuItem)
            {
                Runner.OpenURL("http://bibliomania.com/0/-/frameset.html");
            }
            // news
            else if (sender == this.miBBC)
            {
                Runner.OpenURL("http://news.bbc.co.uk/");
            }
            else if (sender == this.miTheepochtimes)
            {
                Runner.OpenURL("http://www.theepochtimes.com/n2/other-languages.html");
            }
            else if (sender == this.miInopressa_ru)
            {
                Runner.OpenURL("http://inopressa.ru");
            }
            else if (sender == this.miTED)
            {
                Runner.OpenURL("http://www.ted.com/OpenTranslationProject");
            }


            // http://thenextweb.com/
            // Subtitles
            else if (!string.IsNullOrEmpty(mi.Tag as string))
            {
                Runner.OpenURL((string)mi.Tag);
            }
            else
            {
                Runner.OpenURL((string)mi.Text);
            }
        }
Exemple #6
0
 private void miGoToTranslateByGoogle_Click(object sender, EventArgs e)
 {
     if (sender == miGoToTranslateByGoogle)
     {
         Runner.OpenURL(@"http://translate.google.com/");
     }
     else if (sender == miGoToTranslateByMicrosoft)
     {
         Runner.OpenURL(@"http://www.microsofttranslator.com/Default.aspx");
     }
     else if (sender == miGoToTranslateByYahoo)
     {
         Runner.OpenURL(@"http://babelfish.yahoo.com/translate_txt");
     }
     else if (sender == miGoToTranslatebyPromt)
     {
         Runner.OpenURL(@"http://www.online-translator.com/");
     }
 }
        void WebBrowserForForm_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            string blank = "blank";

            if (e.Url.AbsolutePath != blank && !IsNotIFrame(sender))
            {
                e.Cancel = true;
                return;
            }
            if (OpenUrlInExternalWindow)
            {
                // if this not bookmark
                // if (!e.Url.AbsoluteUri.StartsWith("#") && !e.Url.AbsoluteUri.StartsWith("about:/#"))
                {
                    if (e.Url.AbsolutePath != blank)
                    {
                        e.Cancel = true;
                        Runner.OpenURL(e.Url.AbsoluteUri);
                    }
                }
            }
        }
Exemple #8
0
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     Runner.OpenURL("easy4learn.net");
     //    Runner.OpenURL(string.Format("http://easy4learn.com/{0}/", Utils.GetLocaleForUI()));
 }
Exemple #9
0
 void GoToProducerPage()
 {
     Runner.OpenURL(Utils.GetLocalizedPrefix() + "forcemem.com/easy-lang/index.htm");
     CF.AdvertLinkWasShown = true;
 }
Exemple #10
0
        public void RunDownload(string url)
        {
            // url = @"http://www.ted.com/talks/drew_curtis_how_i_beat_a_patent_troll.html";
            tedProgressForm = new f.TED.FormDowloadedInfo();
            tedProgressForm.Show();
            try
            {
                m_TEDProvider = new TEDProvider();
                m_TEDProvider.GetContent(url, "", "");
                // get info
                if (string.IsNullOrEmpty(m_TEDProvider.SubtitleId))
                {
                }
                else
                {
                    tedProgressForm.EnSubtProgress = 50;
                }

                string folder = GetFolder(m_TEDProvider.VideoTitle, rootFolderName);

                DoDownloadFile(m_TEDProvider.ImgSrc, folder);

                m_FileSubtEn = m_TEDProvider.GetSubtitles("en", folder);
                if (!string.IsNullOrEmpty(m_FileSubtEn))
                {
                    tedProgressForm.EnSubtProgress = 100;
                }
                else
                {
                    tedProgressForm.IsEnSubtWorng = true;
                }

                // native
                if (rbTranslation.Checked && cmbNativeLanguage.SelectedItem is LangName)
                {
                    string nativeCode = ((LangName)cmbNativeLanguage.SelectedItem).Code;
                    if (!nativeCode.Equals("en"))
                    {
                        m_fileSubtNative = m_TEDProvider.GetSubtitles(nativeCode, folder);
                        if (!string.IsNullOrEmpty(m_fileSubtNative))
                        {
                            tedProgressForm.NativeSubtProgress = 100;
                        }
                        else
                        {
                            tedProgressForm.IsNativeSubtWorng = true;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(m_TEDProvider.VideoURL))
                {
                    WebDownloader.DownloadProgressDelegate dowloadProgress = new WebDownloader.DownloadProgressDelegate(ShowProgress);
                    m_fileVideo = WebDownloader.Download(m_TEDProvider.VideoURLFull, folder + "\\", dowloadProgress, "en.mp4");
                    CallCompleteEvent();
                }
                else
                {
                    // перейти на страницу чтобы самостоятельно скачать видео
                    MessageBox.Show(this, "Video not found. Try download it self.", Application.ProductName,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Runner.OpenURL(url);
                }
            }
            catch
            {
                MessageBox.Show(this, "Please, try to select another episode.", Application.ProductName,
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                tedProgressForm.IsVideoWorng = true;
            }
            tedProgressForm.Close();
        }
Exemple #11
0
 void btFindSynonyms_Click(object sender, EventArgs e)
 {
     Runner.OpenURL(string.Format(@"https://www.google.com/search?q={0}&tbm=isch", this.TextsForMenu.ActiveTextBox.CurrentWord));
     // ShowSynonyms(this.TextsForMenu.ActiveTextBox);
 }
Exemple #12
0
 void ForeignText_LinkClicked(object sender, LinkClickedEventArgs e)
 {
     Runner.OpenURL(e.LinkText);
 }
Exemple #13
0
        //            "<table><tr><td class=\"topForArticle\"><a href=\"{0}\" title=\"{1}\">{2} ({3})</a></td></tr></table>";

        /*
         * .topForArticle
         * {
         *      background-color: #C0C0C0; padding-right: 50px; padding-left: 50px;
         * }
         *
         * static readonly string TopForArticleTemplate = "{0}\r\n<table><tr>{0}</tr></table>\r\n";
         */
        #endregion

        public static void Dict_Click(object sender, EventArgs e)
        {
            RunDictContent dictContent = ((ToolStripItem)sender).Tag as RunDictContent;

            if (dictContent == null)
            {
                return;
            }
            string word = dictContent.TextWithSelection.CurrentLowerWord;

            if (string.IsNullOrEmpty(word))
            {
                string message = "A word is not specified";
                // if (Application.ProductName  == DictionaryBlend message += " (Drag-n-drop supported)." // "You must type a word
                MessageBox.Show(message, Application.ProductName,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                LangPair lp = dictContent.TextWithSelection.LangDir;
                if (dictContent.UITarget != null)
                {
                    #region for async calling
                    WaitingUIObjectWithFinish waitObject = null;
                    //if ((dictContent.Providers.Count == 1) && !(dictContent.Providers[0] is FavoritProvider))
                    if (dictContent.TextWithSelection is ITextWithSelectionAndWaiting)
                    {
                        MethodInvoker onFinish = new MethodInvoker(AssignTextToControl);
                        waitObject = new WaitingUIObjectWithFinish(((ITextWithSelectionAndWaiting)dictContent.TextWithSelection).Control,
                                                                   ((ITextWithSelectionAndWaiting)dictContent.TextWithSelection).Picture, onFinish);
                        lastUITarget = dictContent.UITarget;
                        foreach (AsyncProvider provider in currentRequests)
                        {
                            if (provider.CurrentThread.IsAlive)
                            {
                                provider.CurrentThread.Abort();
                            }
                        }
                        currentRequests.Clear();
                        lock (resultContainer)
                            resultContainer.Clear();
                    }
                    #endregion

                    using (new WaitCursor(waitObject == null))
                    {
                        // System.Threading.Thread.Sleep(3000);

                        string dictBodies = "";
                        foreach (DictionaryProvider provider in dictContent.Providers)
                        {
                            //if (provider is FavoritProvider)
                            //{
                            //    new Gator.GatorStarter(word, lp.From, lp.To, null); // waitingUIObject
                            //    dictBodies = "See result in an external window";
                            //}
                            //else
                            {
                                if (!provider.IsSupport(lp.ToString()))
                                {
                                    continue;
                                }
                                string url           = provider.GetPublicUrl(word, lp);
                                string providerTitle = provider.Title;
                                if (provider.GetType().Name.ToLower().Contains("google"))
                                {
                                    providerTitle = "Google " + providerTitle;
                                }
                                string title = string.Format(topForArticleTemplate, url, providerTitle, provider.Copyright);
                                if (waitObject != null)
                                {
                                    currentRequests.Add(new AsyncProvider(word, lp, provider, waitObject, resultContainer, title));
                                }
                                else
                                {
                                    dictBodies += title;
                                    string content = provider.GetContent(word, lp);
                                    dictBodies += content;
                                }
                            }
                        }
                        if (waitObject == null)
                        {
                            dictContent.UITarget.TempContent = dictBodies;
                        }
                        dictContent.UITarget.AssignText(dictBodies);
                    }
                }
                else // here just working with urls and external browser
                {
                    #region Runner.OpenURL
                    foreach (DictionaryProvider provider in dictContent.Providers)
                    {
                        if (provider is FavoritProvider)
                        {
                            new Gator.GatorStarter(word, lp.From, lp.To, null); // waitingUIObject
                        }
                        else
                        {
                            if (!provider.IsSupport(lp.ToString()))
                            {
                                continue;
                            }
                            Runner.OpenURL(provider.GetPublicUrl(word, lp));
                        }
                    }
                    #endregion
                }
            }
        }
 public static void ShowLearnWordsArticle()
 {
     Runner.OpenURL(string.Format("http://easy4learn.com/{0}/purchase.htm", Utils.GetLocaleForUI()));
     Runner.OpenURL(Utils.GetLocalizedPrefix() + "easy4learn.com/advices/learn-words.htm");
 }
Exemple #15
0
 private void llbHowGetURL_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     Runner.OpenURL(@"http://userscripts.org/scripts/show/25105");
     Runner.OpenURL(@"https://addons.mozilla.org/en-US/firefox/addon/download-youtube/");
 }