示例#1
0
 private void LoginButton_Click(object sender, EventArgs e)
 {
     loginButton.Enabled = false;
     if (emailTextbox.Text.Length > 0)
     {
         if (passwordTextbox.Text.Length > 0)
         {
             if (_parent.Login(emailTextbox.Text, passwordTextbox.Text))
             {
                 PoEHelper.SaveCredentials(emailTextbox.Text, passwordTextbox.Text);
             }
             passwordTextbox.Text = "";
             Dispose();
         }
         //else
         //{
         //    if (_parent.Login(emailTextbox.Text))
         //    {
         //        PoEHelper.SaveCredentials(emailTextbox.Text);
         //    }
         //    passwordTextbox.Text = "";
         //    Dispose();
         //}
     }
     else
     {
         passwordTextbox.Text = "";
     }
     loginButton.Enabled = true;
 }
示例#2
0
        private void SetWindowRect()
        {
            Rectangle rect = PoEHelper.GetClientSize();

            Location = rect.Location;
            Size     = rect.Size;
            foreach (StashPanel p in Controls.OfType <StashPanel>())
            {
                p.SetSize(Size);
            }
        }
示例#3
0
        public OverlayForm()
        {
            InitializeComponent();
            TopMost         = true;
            FormBorderStyle = FormBorderStyle.None;
            BackColor       = Color.Magenta;
            TransparencyKey = Color.Magenta;
            ResizeRedraw    = true;
            ShowIcon        = false;
            ShowInTaskbar   = false;
            Text            = @"TradeXD";

            StartListeningForWindowChanges();

            _client = new PoEWebClient();
            try
            {
                (bool successful, string email, string cipher, string salt) = PoEHelper.LoadCredentials();
                string password = PoEHelper.Decrypt(cipher, salt);
                if (successful && Login(email, password))
                {
                    PoEHelper.SaveCredentials(email, password);
                    password = "";
                }
                else
                {
                    LoginForm loginForm = new LoginForm(this);
                    loginForm.Show();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                LoginForm loginForm = new LoginForm(this);
                loginForm.Show();
            }

            Refresh();

            _stashPanel = new StashPanel(Size)
            {
                Visible = false
            };
            Controls.Add(_stashPanel);

            _trayMenu = new ContextMenu();
            _trayMenu.MenuItems.Add("Settings", OnSettings);
            _trayMenu.MenuItems.Add("Exit", OnExit);
            _trayIcon = new NotifyIcon
            {
                Text        = Text,
                Icon        = new Icon(SystemIcons.Application, 40, 40),
                ContextMenu = _trayMenu,
                Visible     = true
            };

            _mouseListener = new MouseHookListener(new GlobalHooker())
            {
                Enabled = true
            };
            _keyboardListener = new KeyboardHookListener(new GlobalHooker())
            {
                Enabled = true
            };
            _mouseListener.MouseUp  += MouseUpListener;
            _keyboardListener.KeyUp += KeyboardUpListener;
        }