Ejemplo n.º 1
0
        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;
            }));
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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";
        }
Ejemplo n.º 4
0
 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));
         }
     }
 }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
        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);
            }));
        }
Ejemplo n.º 7
0
 public FeatureTaskList(MapsFeature owner)
 {
     _owner = owner;
 }