コード例 #1
0
ファイル: fMain.cs プロジェクト: rizenforce/TrARKSlator
        // Starts using translation service selected
        private void ActivateService(string service)
        {
            // Update menu items
            foreach (ToolStripMenuItem d in tsddbServices.DropDownItems)
            {
                d.Checked = (d.Text == service);
            }
            tsddbServices.Text = service;

            // Update current active
            AvailableTranslationServices.Active = AvailableTranslationServices.List().Find(x => x.Name == service);
        }
コード例 #2
0
ファイル: fMain.cs プロジェクト: rizenforce/TrARKSlator
        private void fMain_Load(object sender, EventArgs e)
        {
            // Title label
            lblAppTitle.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + " " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            // Populate translation menu
            AvailableTranslationServices.List().ForEach(
                delegate(TranslatorService tr)
            {
                var ttb    = new ToolStripMenuItem(tr.Name);
                ttb.Click += new EventHandler(tsddbGenericHandler);
                tsddbServices.DropDownItems.Add(ttb);

                if ((Properties.Settings.Default.TranslatorEngine == tr.Name) || (AvailableTranslationServices.Active == tr))
                {
                    ActivateService(tr.Name);
                }
            });

            // Load settings
            toggleAlwaysOnTop(Properties.Settings.Default.AlwaysOnTop);
            SetOpacity(Properties.Settings.Default.Opacity);
            this.Size        = Properties.Settings.Default.FormSize;
            this.Location    = Properties.Settings.Default.FormPos;
            txtLog.BackColor = Properties.Settings.Default.ColorBackground;
            this.OnResize(e);

            // Start the log watcher
            using (IPso2LogWatcherFactory factory = new Pso2LogWatcherFactory())
                using (IPso2LogWatcher watcher = factory.CreatePso2LogWatcher())
                {
                    watcher.Pso2LogEvent += (sndr, ev) =>
                    {
                        // That's a command, let's quit
                        if (ParsingSupport.isPSO2ChatCommand(ev.Message))
                        {
                            return;
                        }

                        // Let's remove all crap
                        ev.Message = ParsingSupport.chatCleanUp(ev.Message);

                        // If message didn't turned out all crap, let's display
                        if (ev.Message != "")
                        {
                            addLine(ev);
                        }
                    };
                    watcher.Start();
                }
        }
コード例 #3
0
 public TranslatorService()
 {
     AvailableTranslationServices.Add(this);
 }