Exemplo n.º 1
0
        private static void Window_OkButtonClicking(object sender, RoutedEventArgs e)
        {
            GeneralWindow window = (GeneralWindow)sender;
            CreateFeatureLayerUserControl userControl = (CreateFeatureLayerUserControl)window.Tag;
            string message = userControl.InvalidMessage;

            if (!string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                e.Handled = true;
            }
            ConfigureFeatureLayerParameters parameters = userControl.GetFeatureLayerInfo();

            if (Directory.Exists(parameters.LayerUri.LocalPath))
            {
                string           name         = Path.GetFileName(parameters.LayerUri.LocalPath);
                string           existMessage = string.Format(CultureInfo.InvariantCulture, "The destination already has a file named {0}, do you want to replace the file in destination?", name);
                MessageBoxResult result       = MessageBox.Show(existMessage, "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning);
                if (result == MessageBoxResult.No)
                {
                    e.Handled = true;
                }
                else
                {
                    try
                    {
                        Directory.Delete(parameters.LayerUri.LocalPath, true);
                    }
                    catch (Exception ex)
                    {
                        GisEditor.LoggerManager.Log(LoggerLevel.Debug, ex.Message, new ExceptionInfo(ex));
                    }
                }
            }
        }
        private static void OKButtonClicking(object sender, RoutedEventArgs e)
        {
            GeneralWindow window = (GeneralWindow)sender;
            CreateFeatureLayerUserControl userControl = (CreateFeatureLayerUserControl)window.Tag;
            string message = userControl.InvalidMessage;

            if (!string.IsNullOrEmpty(message))
            {
                MessageBox.Show(message, "Warning", MessageBoxButton.OK, MessageBoxImage.Warning);
                e.Handled = true;
            }
        }