protected override void Initialize(object navigationData) { base.Initialize(navigationData); var service = (IConfigurationService)this.GetService(typeof(IConfigurationService)); pictureBox1.Image = service.Scope.GetImage(); _feature = new MimeMapFeature(this.Module); _feature.MimeMapSettingsUpdated = this.InitializeListPage; _feature.Load(); }
public FeatureTaskList(MimeMapFeature owner) { _owner = owner; }
public NewMapItemDialog(IServiceProvider serviceProvider, MimeMapItem existing, MimeMapFeature feature) : base(serviceProvider) { InitializeComponent(); Text = string.Format("{0} MIME Type", existing == null ? "Add" : "Edit"); Item = existing ?? new MimeMapItem(null); if (existing != null) { txtExtension.Text = Item.FileExtension; txtType.Text = Item.MimeType; } var container = new CompositeDisposable(); FormClosed += (sender, args) => container.Dispose(); container.Add( Observable.FromEventPattern <EventArgs>(btnOK, "Click") .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { Item.FileExtension = txtExtension.Text; Item.MimeType = txtType.Text; if (feature.Items.Any(item => item.Match(Item))) { ShowMessage( "This MIME map already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } DialogResult = DialogResult.OK; })); container.Add( Observable.FromEventPattern <EventArgs>(txtExtension, "TextChanged") .Merge(Observable.FromEventPattern <EventArgs>(txtType, "TextChanged")) .Sample(TimeSpan.FromSeconds(1)) .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { btnOK.Enabled = !string.IsNullOrWhiteSpace(txtExtension.Text) && !string.IsNullOrWhiteSpace(txtType.Text); })); }