public AddMapDialog(IServiceProvider serviceProvider, MapRule existing, MapsFeature feature) : base(serviceProvider) { Item = existing; InitializeComponent(); Text = existing == null ? "Add Mapping Entry" : "Edit Mapping Entry"; var container = new CompositeDisposable(); FormClosed += (sender, args) => container.Dispose(); container.Add( Observable.FromEventPattern <EventArgs>(txtOriginal, "TextChanged") .Sample(TimeSpan.FromSeconds(1)) .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { btnOK.Enabled = !string.IsNullOrWhiteSpace(txtOriginal.Text); })); container.Add( Observable.FromEventPattern <EventArgs>(btnOK, "Click") .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { if (Item == null) { Item = new MapRule(null, feature); } Item.Original = txtOriginal.Text; Item.New = txtNew.Text; DialogResult = DialogResult.OK; })); }
protected override void Initialize(object navigationData) { base.Initialize(navigationData); var service = (IConfigurationService)GetService(typeof(IConfigurationService)); pictureBox1.Image = service.Scope.GetImage(); _feature = new MapsFeature(Module); _feature.RewriteSettingsUpdated = this.InitializeListPage; _feature.Load(); }
public MapRule(ConfigurationElement element, MapsFeature feature) { this.Element = element; _feature = feature; if (element != null) { this.Original = (string)element["key"]; this.New = (string)element["value"]; } this.Flag = element == null || element.IsLocallyStored ? "Local" : "Inherited"; }
public MapItem(ConfigurationElement element, MapsFeature feature) { this.Element = element; _feature = feature; this.Flag = element == null || element.IsLocallyStored ? "Local" : "Inherited"; this.Name = element == null ? string.Empty : (string)element["name"]; this.Items = new List <MapRule>(); if (element != null) { var collection = element.GetCollection(); foreach (ConfigurationElement rule in collection) { this.Items.Add(new MapRule(rule, _feature)); } } }
protected override void Initialize(object navigationData) { base.Initialize(navigationData); var info = (Tuple <MapsFeature, MapItem>)navigationData; // TODO: pictureBox1.Image = service.Scope.GetImage(); _feature = info.Item1; this.Map = info.Item2; txtName.ReadOnly = this.Map != null; if (this.Map != null) { this.Map.MapSettingsUpdated = this.InitializeListPage; txtName.Text = this.Map.Name; } this.Map?.OnRewriteSettingsSaved(); }
public AddMapsDialog(IServiceProvider serviceProvider, MapsFeature feature) : base(serviceProvider) { InitializeComponent(); var container = new CompositeDisposable(); FormClosed += (sender, args) => container.Dispose(); container.Add( Observable.FromEventPattern <EventArgs>(btnOK, "Click") .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { if (feature.Items.Any(item => txtName.Text == item.Name)) { ShowMessage( "The specified server variable already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } Item = new MapItem(null, feature) { Name = txtName.Text, DefaultValue = string.Empty }; DialogResult = DialogResult.OK; })); container.Add( Observable.FromEventPattern <EventArgs>(txtName, "TextChanged") .Sample(TimeSpan.FromSeconds(1)) .ObserveOn(System.Threading.SynchronizationContext.Current) .Subscribe(evt => { btnOK.Enabled = !string.IsNullOrWhiteSpace(txtName.Text); })); }
public FeatureTaskList(MapsFeature owner) { _owner = owner; }