Пример #1
0
 static void StashPanel_Show_Post(StashPanel __instance)
 => UpdateStashName(Players.GetLocal(__instance));
Пример #2
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;
        }