コード例 #1
0
        public async void HandleEvent(SearchFileEventData eventData)
        {
            FolderBrowserDialog _dlg = new FolderBrowserDialog()
            {
                Description = "请选择歌曲所在目录.",
            };

            if (_dlg.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(_dlg.SelectedPath))
            {
                EventBus.Default.Trigger <UIComponentDisableEventData>();
                EventBus.Default.Trigger <UIClearMusicInfosEventData>();

                var _files = await m_searchProvider.FindFilesAsync(_dlg.SelectedPath, m_settingManager.ConfigModel.ExtensionsName);

                if (_files.Count == 0)
                {
                    MessageBox.Show("没有找到任何文件。", AppConsts.Msg_Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                MessageBox.Show(BuildCompleteMsg(_files), "搜索完成", MessageBoxButtons.OK, MessageBoxIcon.Information);

                EventBus.Default.Trigger(new MusicInfoLoadEventData()
                {
                    MusicFilePaths = _files
                });
            }
        }
コード例 #2
0
        public async void HandleEvent(SearchFileEventData eventData)
        {
            EventBus.Default.Trigger <UIComponentDisableEventData>();
            if (!eventData.IsAppendData)
            {
                EventBus.Default.Trigger <UIClearMusicInfosEventData>();
            }

            GlobalContext.Instance.SetBottomStatusText(AppConsts.Status_Bottom_SearchFilesing);

            var files = await _searchProvider.FindFilesAsync(eventData.FolderPath, _settingManager.ConfigModel.ExtensionsName);

            if (files.Count == 0)
            {
                MessageBox.Show("没有找到任何文件。", AppConsts.Msg_Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            MessageBox.Show(BuildCompleteMsg(files), "搜索完成", MessageBoxButtons.OK, MessageBoxIcon.Information);

            EventBus.Default.Trigger(new MusicInfoLoadEventData
            {
                MusicFilePaths = files
            });
        }