Exemplo n.º 1
0
 public OptionsForm()
 {
     InitializeComponent();
     FormUtil.restoreLocation(this);
     webBrowser1.ObjectForScripting = new BrowserInterop(webBrowser1, new InteropMethods(this));
     webBrowser1.Url = Utils.getUriForBrowser("options.html");
 }
Exemplo n.º 2
0
 public UserHookForm()
 {
     InitializeComponent();
     linkLabel1.Links.Add(0, linkLabel1.Text.Length, "http://agthdb.bakastyle.com/");
     FormUtil.restoreLocation(this);
     refreshHookList();
 }
Exemplo n.º 3
0
        public TranslationForm()
        {
            InitializeComponent();

            hintForm = new HintForm();
            hintForm.setMainForm(this);
            backgroundForm = new BackgroundForm();
            backgroundForm.setMainForm(this);
            FormUtil.restoreLocation(this);
            TopMost = Settings.app.stayOnTop;
            webBrowser1.ObjectForScripting = new BrowserInterop(webBrowser1, new InteropMethods(this));
            webBrowser1.Url = Utils.getUriForBrowser("translation.html");
            TranslationService.instance.onTranslationRequest += (id, raw, src) =>
            {
                var translators = Settings.app.getSelectedTranslators(!Atlas.instance.isNotFound);
                if (translators.Count == 1 && Settings.session.po != null)
                {
                    // trying .po translation
                    var poTrans = PoManager.instance.getTranslation(raw);
                    if (!string.IsNullOrEmpty(poTrans))
                    {
                        webBrowser1.callScript("newTranslationResult", id, Utils.toJson(new TranslationResult(poTrans, false)));
                        return;
                    }
                }
                webBrowser1.callScript("translate", id, raw, src, Utils.toJson(translators));
            };
            TranslationService.instance.onEdictDone += (id, parse) =>
            {
                lastParseResult = parse;
                if (id == waitingForId)
                {
                    waitingForId = -1;
                    return;
                }
                lastParseOptions = null;
                submitParseResult(parse);
            };
            if (OptionsForm.instance.Visible)
            {
                this.SuspendTopMostBegin();
            }
            OptionsForm.instance.VisibleChanged += (sender, e) =>
            {
                if ((sender as Form).Visible)
                {
                    this.SuspendTopMostBegin();
                }
                else
                {
                    this.SuspendTopMostEnd();
                }
            };
            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
            //Utils.setWindowNoActivate(this.Handle);
            Winapi.RegisterHotKey(Handle, 0, (int)Winapi.KeyModifier.Control, (int)Keys.Oemtilde);
        }
Exemplo n.º 4
0
        public MainForm()
        {
            _instance = this;
            InitializeComponent();
            FormUtil.restoreLocation(this);
            webBrowser1.ObjectForScripting = new BrowserInterop(webBrowser1, new InteropMethods(this));
            webBrowser1.Url = Utils.getUriForBrowser("index.html");
            TextHook.instance.setContextFactory(new MyContextFactory(TextHook.instance));

            /*Logger.onLog += (text) => {
             *  webBrowser1.callScript("log", "DEBUG: " + text);
             * };*/
        }
Exemplo n.º 5
0
 public NamesForm()
 {
     InitializeComponent();
     FormUtil.restoreLocation(this);
 }