Ejemplo n.º 1
0
 public MapListViewItem(MapRule item, MapPage page)
     : base(item.Original)
 {
     this.Item = item;
     _page     = page;
     this.SubItems.Add(new ListViewSubItem(this, item.New));
 }
Ejemplo n.º 2
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;
            }));
        }