Beispiel #1
0
        private void AddCellButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            // Create an instance of the open file dialog box.
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            // Set filter options and filter index.
            openFileDialog1.DefaultExt  = ".000";
            openFileDialog1.Filter      = "S57 Cells (.000)|*.000";
            openFileDialog1.Multiselect = true;

            // Call the ShowDialog method to show the dialog box.
            bool?userClickedOK = openFileDialog1.ShowDialog();

            // Process input if the user clicked OK.
            if (userClickedOK == true)
            {
                foreach (string fileName in openFileDialog1.FileNames)
                {
                    var hydroLayer = new HydrographicS57Layer()
                    {
                        Path = fileName,
                        ID   = Path.GetFileNameWithoutExtension(fileName)
                    };
                    _hydrographicGroupLayer.ChildLayers.Add(hydroLayer);
                    s57CellList.SelectedItem = hydroLayer;
                }
            }
        }
        private async Task CreateHydrographicLayerAsync(string path)
        {
            var file = await ApplicationData.Current.LocalFolder.TryGetItemAsync(path);

            if (file == null)
            {
                throw new Exception("Local hydrographic data not found. Please download sample data from 'Sample Data Settings'");
            }

            // Create hydrographic layer from sample data
            var hydroLayer = new HydrographicS57Layer()
            {
                Path = file.Path,
                ID   = Path.GetFileNameWithoutExtension(file.Name)
            };

            _hydrographicGroupLayer.ChildLayers.Add(hydroLayer);
        }
		private void AddCellButton_Click(object sender, System.Windows.RoutedEventArgs e)
		{
			// Create an instance of the open file dialog box.
			OpenFileDialog openFileDialog1 = new OpenFileDialog();

			// Set filter options and filter index.
			openFileDialog1.DefaultExt = ".000";
			openFileDialog1.Filter = "S57 Cells (.000)|*.000";
			openFileDialog1.Multiselect = true;

			// Call the ShowDialog method to show the dialog box.
			bool? userClickedOK = openFileDialog1.ShowDialog();

			// Process input if the user clicked OK.
			if (userClickedOK == true)
			{
				foreach (string fileName in openFileDialog1.FileNames)
				{
					var hydroLayer = new HydrographicS57Layer() 
					{ 
						Path = fileName,
						ID = Path.GetFileNameWithoutExtension(fileName)
					};
					_hydrographicGroupLayer.ChildLayers.Add(hydroLayer);
					s57CellList.SelectedItem = hydroLayer;
				}
			}
		}
		private async Task CreateHydrographicLayerAsync(string path)
		{
			var file = await ApplicationData.Current.LocalFolder.TryGetItemAsync(path);
			if (file == null)
				throw new Exception("Local hydrographic data not found. Please download sample data from 'Sample Data Settings'");

			// Create hydrographic layer from sample data
			var hydroLayer = new HydrographicS57Layer()
			{
				Path = file.Path,
				ID = Path.GetFileNameWithoutExtension(file.Name)
			};
			_hydrographicGroupLayer.ChildLayers.Add(hydroLayer);
		}