예제 #1
0
        public override void EijirouWeb_Click(object sender, EventArgs e)
        {
            string text = null;

            if (textBoxModify.Focused && textBoxModify.SelectionLength > 0)
            {
                text = textBoxModify.SelectedText;
            }
            else if (textBoxOriginal.Focused && textBoxOriginal.SelectionLength > 0)
            {
                text = textBoxOriginal.SelectedText;
            }

            if (text != null)
            {
                TranslateBrowser browser = TranslateBrowser.Create(new WebTranslate.EijirouTranslate(text), this);
            }

            if (text != null)
            {
                string url = WebTranslate.EijirouTranslate.GetUrl(text);
                if (url != null)
                {
                    System.Diagnostics.Process.Start(url);
                }
            }
        }
예제 #2
0
 void TranslateBrowser_FormClosed(object sender, FormClosedEventArgs e)
 {
     // とりあえずこのタイミングで破棄
     lock (instance.sync) {
         instance = null;
     }
 }
예제 #3
0
        static public TranslateBrowser Create(WebTranslate.TranslateBase trans, System.Windows.Forms.IWin32Window parent)
        {
            if (instance != null)
            {
                instance.translate(trans);
                return(instance);
            }
            TranslateBrowser browser = new TranslateBrowser(trans);

            //browser.Show( parent );
            browser.Show(); // 親よりも後ろに配置できる
            return(browser);
        }
예제 #4
0
 void TranslateBrowser_Shown(object sender, EventArgs e)
 {
     // とりあえずこのタイミングでシングル化
     if (instance != null)
     {
         // この場合はassertでもいいが
         lock (instance.sync) {
             instance = this;
         }
     }
     else
     {
         lock (this.sync) {
             instance = this;
         }
     }
 }
예제 #5
0
        public override void Eijirou_Click(object sender, EventArgs e)
        {
            string text = null;

            if (textBoxModify.Focused && textBoxModify.SelectionLength > 0)
            {
                text = textBoxModify.SelectedText;
            }
            else if (textBoxOriginal.Focused && textBoxOriginal.SelectionLength > 0)
            {
                text = textBoxOriginal.SelectedText;
            }

            if (text != null)
            {
                TranslateBrowser browser = TranslateBrowser.Create(new WebTranslate.EijirouTranslate(text), this);
            }
        }