protected override void Initialize(object navigationData) { base.Initialize(navigationData); var service = (IConfigurationService)GetService(typeof(IConfigurationService)); pictureBox1.Image = service.Scope.GetImage(); _feature = new TraceFailedRequestsFeature(Module); _feature.TraceFailedRequestsSettingsUpdated = InitializeListPage; _feature.Load(); }
public FeatureTaskList(TraceFailedRequestsFeature owner) { _owner = owner; }
public SettingsDialog(IServiceProvider serviceProvider, SiteTraceFailedRequestsLogging element, TraceFailedRequestsFeature feature) : base(serviceProvider) { InitializeComponent(); cbEnabled.Checked = element.Enabled; txtDirectory.Text = element.Directory; txtNumber.Text = element.MaxLogFiles.ToString(); var container = new CompositeDisposable(); FormClosed += (sender, args) => container.Dispose(); container.Add( Observable.FromEventPattern <EventArgs>(txtDirectory, "TextChanged") .Merge(Observable.FromEventPattern <EventArgs>(txtNumber, "TextChanged")) .Merge(Observable.FromEventPattern <EventArgs>(cbEnabled, "CheckedChanged")) .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { btnOK.Enabled = !string.IsNullOrWhiteSpace(txtDirectory.Text) && !string.IsNullOrWhiteSpace(txtNumber.Text); })); container.Add( Observable.FromEventPattern <EventArgs>(btnOK, "Click") .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { if (uint.TryParse(txtNumber.Text, out uint number) && number > 0 && number <= 10000) { element.MaxLogFiles = number; element.Enabled = cbEnabled.Checked; element.Directory = txtDirectory.Text; DialogResult = DialogResult.OK; return; } // TODO: can this come from validator? ShowMessage( "The 'Maximum Number of Trace Files' property is invalid. The value must be a valid integer between 1 and 10000.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); })); container.Add( Observable.FromEventPattern <CancelEventArgs>(this, "HelpButtonClicked") .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(EnvironmentVariableTarget => { feature.ShowHelp(); })); }
public NewTraceDialog(IServiceProvider serviceProvider, TraceFailedRequestsItem existing, TraceFailedRequestsFeature feature) : base(serviceProvider) { InitializeComponent(); Text = existing == null ? "Add ISAPI Filter" : "Edit ISAPI Filter"; txtName.ReadOnly = existing != null; Item = existing ?? new TraceFailedRequestsItem(null); if (existing != null) { txtPath.Text = Item.Path; } var container = new CompositeDisposable(); FormClosed += (sender, args) => container.Dispose(); container.Add( Observable.FromEventPattern <EventArgs>(btnOK, "Click") .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { Item.Path = txtPath.Text; if (!txtName.ReadOnly && feature.Items.Any(item => item.Match(Item))) { ShowMessage( "A filter with this name already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } DialogResult = DialogResult.OK; })); container.Add( Observable.FromEventPattern <EventArgs>(txtName, "TextChanged") .Merge(Observable.FromEventPattern <EventArgs>(txtPath, "TextChanged")) .Sample(TimeSpan.FromSeconds(0.5)) .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { btnOK.Enabled = !string.IsNullOrWhiteSpace(txtName.Text) && !string.IsNullOrWhiteSpace(txtPath.Text); })); container.Add( Observable.FromEventPattern <EventArgs>(btnBrowse, "Click") .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { DialogHelper.ShowBrowseDialog(txtPath, null); })); }