-
-
Notifications
You must be signed in to change notification settings - Fork 59
/
SettingsDialog.cs
47 lines (41 loc) · 1.73 KB
/
SettingsDialog.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) Lex Li. All rights reserved.
//
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace JexusManager.Features.IsapiCgiRestriction
{
using System;
using System.ComponentModel;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using System.Windows.Forms;
using Microsoft.Web.Administration;
using Microsoft.Web.Management.Client.Win32;
internal partial class SettingsDialog : DialogForm
{
public SettingsDialog(IServiceProvider serviceProvider, ConfigurationElement element, IsapiCgiRestrictionFeature feature)
: base(serviceProvider)
{
InitializeComponent();
cbCgi.Checked = (bool)element["notListedCgisAllowed"];
cbIsapi.Checked = (bool)element["notListedIsapisAllowed"];
var container = new CompositeDisposable();
FormClosed += (sender, args) => container.Dispose();
container.Add(
Observable.FromEventPattern<EventArgs>(btnOK, "Click")
.ObserveOn(System.Threading.SynchronizationContext.Current)
.Subscribe(evt =>
{
element["notListedIsapisAllowed"] = cbIsapi.Checked;
element["notListedCgisAllowed"] = cbCgi.Checked;
DialogResult = DialogResult.OK;
}));
container.Add(
Observable.FromEventPattern<CancelEventArgs>(this, "HelpButtonClicked")
.ObserveOn(System.Threading.SynchronizationContext.Current)
.Subscribe(EnvironmentVariableTarget =>
{
feature.ShowHelp();
}));
}
}
}