Example #1
0
 private void buttonCoords_Click(object sender, EventArgs e)
 {
     var activeCoordsForm = new CoordsForm(Settings);
     activeCoordsForm.loadData();
     activeCoordsForm.ShowDialog();
 }
Example #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));
        }