예제 #1
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            Icon = Properties.Resources.legato;

            _Setting = await SettingJsonFile.LoadAsync();

            _AimpObserver.CurrentTrackChanged += async(track) =>
            {
                _UpdateFormTrackInfo(track);
                _UpdateAlbumArt();

                // auto posting
                if (checkBoxAutoPosting.Checked)
                {
                    var sound = await _PlaySoundAsync(_Setting.PostingSound, false);
                    await _PostAsync();
                    await _StopSoundAsync(sound);
                }
            };

            if (_AimpProperties.IsRunning)
            {
                _UpdateFormTrackInfo(_AimpProperties.CurrentTrack);
                _UpdateAlbumArt();
            }

            this.Accounts = new Accounts();
            this.Accounts.Init();
        }
예제 #2
0
        private async void MainForm_Load(object sender, EventArgs e)
        {
            this.Icon = Properties.Resources.legato;

            this._Setting = await SettingJsonFile.LoadAsync();

            this._AimpObserver.CurrentTrackChanged += async(track) =>
            {
                this._UpdateFormTrackInfo(track);
                this._UpdateAlbumArt();

                // auto posting
                if (this.checkBoxAutoPosting.Checked)
                {
                    await this._PostAsync();
                }
            };

            if (this._AimpProperties.IsRunning)
            {
                this._UpdateFormTrackInfo(this._AimpProperties.CurrentTrack);
                this._UpdateAlbumArt();
            }

            SystemEvents.PowerModeChanged += (s, ev) =>
            {
                switch (ev.Mode)
                {
                // スリープ直前
                case PowerModes.Suspend:
                    break;

                // 復帰直後は曲情報を再取得
                case PowerModes.Resume:
                    this._UpdateFormTrackInfo(this._AimpProperties.CurrentTrack);
                    this._UpdateAlbumArt();
                    break;

                // バッテリーや電源に関する通知があった場合
                case PowerModes.StatusChange:
                    break;
                }
            };

            this._Accounts.Init();

            this.TopMost = this._Setting.TopMost != null ? (bool)this._Setting.TopMost : false;
        }