Example #1
0
        /// <summary>
        ///  Provides functionality for the map tool to be configured by the end user through a dialog.
        ///  Called when the user clicks the Configure button next to the map tool.
        /// </summary>
        /// <param name="owner">The application window which should be the owner of the dialog.</param>
        /// <returns>True if the user clicks ok, otherwise false.</returns>
        public bool Configure(System.Windows.Window owner)
        {
            // Implement this method if CanConfigure returned true.
            //throw new NotImplementedException();
            IList <DataSource> dataSources = new List <DataSource> {
            };

            var dialog = new Config.FindClosestResourceDialog(dataSources, DataSourceIds != null ? DataSourceIds[0] : null, ResourceTypeField, BarriersDataSources)
            {
                Owner = owner
            };

            if (dialog.ShowDialog() != true)
            {
                return(false);
            }

            // Retrieve the selected values for the properties from the configuration dialog.
            DataSourceIds       = new string[] { dialog.DataSource.Id };
            ResourceTypeField   = dialog.Field.Name;
            ResourcesDatasource = new ObservableCollection <DataSource>();
            ResourcesDatasource.Add(dialog.DataSource);

            BarriersDataSources = new ObservableCollection <DataSource>();
            foreach (DataSource dt in dialog.BarrierDataSources)
            {
                BarriersDataSources.Add(dt);
            }

            InitializePersistedResources();
            InitializePersistedBarriers();

            return(true);
        }
        /// <summary>
        ///  Provides functionality for the map tool to be configured by the end user through a dialog.
        ///  Called when the user clicks the Configure button next to the map tool.
        /// </summary>
        /// <param name="owner">The application window which should be the owner of the dialog.</param>
        /// <returns>True if the user clicks ok, otherwise false.</returns>
        public bool Configure(System.Windows.Window owner)
        {
            // Implement this method if CanConfigure returned true.
            //throw new NotImplementedException();
             IList<DataSource> dataSources = new List<DataSource>{};

             var dialog = new Config.FindClosestResourceDialog(dataSources, DataSourceIds != null ? DataSourceIds[0] : null, ResourceTypeField, BarriersDataSources) { Owner = owner };
            if (dialog.ShowDialog() != true)
                return false;

            // Retrieve the selected values for the properties from the configuration dialog.
            DataSourceIds = new string[] { dialog.DataSource.Id };
            ResourceTypeField = dialog.Field.Name;
            ResourcesDatasource = new ObservableCollection<DataSource>();
            ResourcesDatasource.Add(dialog.DataSource);

            BarriersDataSources = new ObservableCollection<DataSource>();
            foreach(DataSource dt in dialog.BarrierDataSources)
            {
                BarriersDataSources.Add(dt); 
            }

            InitializePersistedResources();
            InitializePersistedBarriers(); 

            return true;
        }