1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using Uestc.Auto6.Dso.ComModel;
- using Uni_Trend.MSO7000X.UserControls;
- namespace Uestc.Auto6.Dso.U2
- {
- public partial class FileBrowserForm : Uni_Trend.MSO7000X.UserControls.FileBrowserForm
- {
- public static FileBrowserForm Instance { get; } = new FileBrowserForm();
- private FileBrowserForm()
- {
- StartPosition = FormStartPosition.CenterScreen;
- CanClose = false;
- IsShowPin = false;
- this.IsShowPin = FixedToolIconInfos[2].IsShow = false;
- SetFileTypeExtensionDelegate(new Func<Enum, string>(x => x.GetAlias()));
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- HeadBackColor = Color.FromArgb(62, 62, 62);
- }
- public override void SetFileFilter<T>(IEnumerable<T> fts)
- {
- if (!fts.Any())
- {
- EventBus.EventBroker.Instance.GetEvent<EventBus.LogEventArgs>().Publish(new Object(), new EventBus.LogEventArgs($"The arugmant '{nameof(fts)}' is empty or null in the function '{nameof(SetFileFilter)}'", EventBus.LogLevel.Error));
- #if DEBUG
- throw new ArgumentException(null, nameof(fts));
- #else
- return;
- #endif
- }
- ComboBoxEx cbxfiletype = base.GetFileTypeCb();
- cbxfiletype.DataSource = fts.Select(x => new KeyValuePair<String, T>(x.ToString() + $"(.{x.GetAlias()})", x)).ToList();
- cbxfiletype.DisplayMember = "Key";
- cbxfiletype.ValueMember = "Value";
- }
- }
- }
|