Пример #1
0
        public MessagesForm(ApplicationSettings appSettings)
        {
            InitializeComponent();
            _applicationSettings = appSettings;
            _linesToShow=new string[_applicationSettings.MaxLogLinesDisplayed];

            FormClosing += MessagesForm_FormClosing;
            timer1.Start();
        }
Пример #2
0
        public MainForm(bool startupAutoLogin, bool autoStartBot, bool buttonAutoReloadWasPressed)
        {
            Settings = ApplicationSettings.LoadSettingsFromFile();
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(Settings.ApplicationLanguage);

            _internalScreenBitmap = new Bitmap(Settings.BotPictureWidth, Settings.BotPictureHeight,
                                               PixelFormat.Format32bppRgb);
            _messagesForm = new MessagesForm(Settings)
                                {
                                    ShowInTaskbar = false,
                                    FormBorderStyle = FormBorderStyle.SizableToolWindow,
                                    TopMost = true
                                };

            _performInitialAutoLogin = startupAutoLogin;
            _performInitialStartBot = autoStartBot;

            ReloadWebCore();

            InitializeComponent();

            // kada se ulazi u design mode, ovo se samo pomera. ovako cemo ga fixirati
            splitContainer1.SplitterDistance = 475;

            buttonAutoReload.Checked = buttonAutoReloadWasPressed;

            // interval that we will check if WebCore has updated content. When using BitmapSurface
            // WebCore does not advise us automatically through Updated event
            // we drive @ 66 fps
            webCoreTimer.Interval = 15;
            webCoreTimer.Start();

            #region Fix key press controls

            foreach (var control in panelButtonControls.Controls)
            {
                var ctrl = control as Button;
                if (ctrl != null)
                {
                    //ctrl.KeyDown += OnKeyDownSuppress;
                    //ctrl.KeyUp += OnKeyUp;
                    //ctrl.KeyPress += OnKeyPress;
                    ctrl.Click += OnClickWithChangeFocus;
                    ctrl.GotFocus += OnUnwantedControlGotFocus;
                }
                var ctrl2 = control as CheckBox;
                if (ctrl2 != null)
                {
                    //ctrl.KeyDown += OnKeyDownSuppress;
                    //ctrl.KeyUp += OnKeyUp;
                    //ctrl.KeyPress += OnKeyPress;
                    ctrl2.Click += OnClickWithChangeFocus;
                    ctrl2.GotFocus += OnUnwantedControlGotFocus;
                }
            }

            // koristimo textBox1 da uhvatimo key. jer kad button dobije focus, ne mozemo da ga vratimo nazad na form.
            textBox1.Focus();
            textBox1.KeyPress += TextBox1KeyPress;
            textBox1.KeyDown += TextBox1KeyDown;
            textBox1.KeyUp += TextBox1KeyUp;
            PictureContainer.KeyPress += TextBox1KeyPress;
            PictureContainer.KeyDown += TextBox1KeyDown;
            PictureContainer.KeyUp += TextBox1KeyUp;
            PictureContainer.MouseWheel += OnMouseWheel;
            PictureContainer.MouseDown += OnMouseDown;
            PictureContainer.MouseUp += OnMouseUp;
            PictureContainer.MouseMove += OnMouseMove;
            PictureContainer.SizeChanged += PictureBoxContainerSizeChanged;
            PictureContainer.Paint += PictureContainerPaint;

            #endregion

            _messagesForm.VisibleChanged += MessagesFormVisibleChanged;

            // Initialize the view.
            InitializeView(WebCore.CreateWebView(BrowserWidth, BrowserHeight, _aweWebSession));

            var activeCoordsForm = new CoordsForm(Settings);
            activeCoordsForm.loadDataFromSettings();

            Logger.LogInfo(string.Format("ivanJo BOT start. AutoLogin={0},BotAutoStart={1}",startupAutoLogin,autoStartBot));
        }
Пример #3
0
        public SettingsForm(MainForm mainForm, ApplicationSettings settings)
        {
            InitializeComponent();

            _mainForm = mainForm;
            _settings = settings;

            numericUpDown1.Value = _settings.CheckEveryXMinutes;
            checkBoxSupply.Checked = _settings.DoSupplyClicks;
            checkBoxGoods.Checked = _settings.DoGoodsClicks;
            checkBoxMilitary.Checked = _settings.DoMilitaryUnitsClicks;
            //this.checkBoxMilitaryUnblock.Checked = _settings.DoMilitaryUnitsUnblock;
            checkBoxPlungedItemsClick.Checked = _settings.DoPlungedItemsClick;
            numericUpDown_WaitBeforeProduction.Value = _settings.WaitBeforeProductionInMillis/1000;
            //numericUpDown_Popup.Value = _settings.WaitOnPopupInMillis/1000;
            numericUpDownBotScreenWidth.Value = _settings.BotPictureWidth;
            numericUpDownBotScreenHeight.Value = _settings.BotPictureHeight;
            numericUpDown_MaxItemsClicked.Value = _settings.MaxItemsClickedInARow;
            numericUpDown_PrcRndCheck.Value = _settings.RndPercentCheckEveryXMinutes;
            numericUpDown_PrcRndClick.Value = _settings.RndPercentDontCollectInARow;
            //checkBoxVersionCheck.Checked = _settings.VersionCheck;
            checkBoxShowLogOnStartup.Checked = _settings.ShowLogWindowOnStartup;
            numericUpDownAutoLogin.Value = _settings.ReloadAfterXTimesNotRecognized;
            numericUpDownPauseCountdown.Value = _settings.PauseCountdownForXSeconds;
            numericUpDownAutoRefresh.Value = _settings.AutoRefreshAfterXMinutes;
            tb_UserAgent.Text = _settings.BrowserUserAgent;

            string name = _settings.SupplyItemCoords.Name;
            if (name == "5m")
            {
                radioButton5m.Checked = true;
            }
            else if (name == "15m")
            {
                radioButton15m.Checked = true;
            }
            else if (name == "1h")
            {
                radioButton1h.Checked = true;
            }
            else if (name == "4h")
            {
                radioButton4h.Checked = true;
            }
            else if (name == "8h")
            {
                radioButton8h.Checked = true;
            }
            else if (name == "1d")
            {
                radioButton1d.Checked = true;
            }
            else
            {
                //MessageBox.Show("error initializing settings: supply item type");
            }
            name = _settings.GoodsItemCoords.Name;
            if (name == "4h")
            {
                radioButtonGoods4h.Checked = true;
            }
            else if (name == "8h")
            {
                radioButtonGoods8h.Checked = true;
            }
            else if (name == "1d")
            {
                radioButtonGoods1d.Checked = true;
            }
            else if (name == "2d")
            {
                radioButtonGoods2d.Checked = true;
            }
            else
            {
                //MessageBox.Show("error initializing settings: goods item type");
            }

            var language = _settings.ApplicationLanguage;
            switch (language)
            {
                case "it-IT":
                    comboBoxLanguage.SelectedIndex = 2;
                    break;
                case "en-US":
                    comboBoxLanguage.SelectedIndex = 0;
                    break;
                case "de-DE":
                    comboBoxLanguage.SelectedIndex = 1;
                    break;
                case "ru-RU":
                    comboBoxLanguage.SelectedIndex = 3;
                    break;
                case "pl-PL":
                    comboBoxLanguage.SelectedIndex = 4;
                    break;
                default:
                    comboBoxLanguage.SelectedIndex = 0;
                    //MessageBox.Show("error initializing settings: application language");
                    break;
            }

            crdSupplyItem = _settings.SupplyItemCoords;
            numericUpDownCollectDistance.Value = _settings.CollectDistanceY;
            _oldCollectDistanceY = _settings.CollectDistanceY;
            numericUpDownSypplyDistance.Value = _settings.SupplyDistanceY;
            _oldSupplyDistanceY = _settings.SupplyDistanceY;
            numericUpDownSypplyDistanceX.Value = _settings.SupplyDistanceX;
            _oldSupplyDistanceX = _settings.SupplyDistanceX;
            checkBoxSaveScanResults.Checked = _settings.SaveScanResults;
            int index = comboBoxFoEServer.FindStringExact(_settings.FoEServer);
            comboBoxFoEServer.SelectedIndex = index < 0 ? 0 : index;
        }
Пример #4
0
 public CoordsForm(ApplicationSettings settings)
 {
     _settings = settings;
     InitializeComponent();
 }