Пример #1
0
        // Clean out the downloads folder (in case an install was recently done, or ignored.
        // Configure the appropriate Ui elements
        private async void NotificationThread_Load(object sender, System.EventArgs e)
        {
            VersionChecker.CleanUpDownloads();

            trayIcon.DoubleClick += TrayIcon_DoubleClick;
            trayIcon.MouseClick  += (o, ev) =>
            {
                if ((ev.Button & MouseButtons.Left) != 0)
                {
                    MethodInfo methodInfo = typeof(NotifyIcon).GetMethod("ShowContextMenu", BindingFlags.Instance | BindingFlags.NonPublic);
                    methodInfo?.Invoke(trayIcon, null);
                }
            };

            stripVersionLabel.Text = $"v{ApplicationUtility.GetApplicationFullVersionNumber()}";

            this.FormClosing += NotificationThread_FormClosing;
            this.Resize      += NotificationThread_Resize;

            trayMenu.Opening += TrayMenu_Opening;

            mnuShow.Click += (o, ev) =>
            {
                ShowForm();
            };

            mnuEnableScrobbling.Click += (o, ev) =>
            {
                mnuEnableScrobbling.Checked = !mnuEnableScrobbling.Checked;

                ScrobbleStateChanging(mnuEnableScrobbling.Checked);
            };

            mnuViewUserProfile.Click += (o, ev) =>
            {
                ViewUserProfile();
            };

            mnuExit.Click += (o, ev) =>
            {
                ExitApplication();
            };

            mnuLoveThisTrack.Click += (o, ev) =>
            {
                LoveorUnloveCurrentMedia();
            };

            ResetLoveTrackState(LoveStatus.Love);

            stripLoveTrack.Click += stripLoveTrack_Click;

            stripLoveTrack.MouseEnter += Common_MouseEnter;
            stripLoveTrack.MouseLeave += Common_MouseLeave;

            stripNewVersion.MouseEnter += Common_MouseEnter;
            stripNewVersion.MouseLeave += Common_MouseLeave;

            _normalTrayIcon = trayIcon.Icon;
            _greyScaleIcon  = await ImageHelper.GreyScaleIcon(_normalTrayIcon).ConfigureAwait(false);
        }