Example #1
0
        private void DataMapTemplateListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataMapTemplateInfo info = DataMapTemplateListBox.SelectedItem as DataMapTemplateInfo;

            Info   = info;
            Result = loadTemplate(info);
            if (info.Type == DataMapType.CsvFile)
            {
                NextButton.IsEnabled = false;
            }
            else if (info.Type == DataMapType.SqlServer)
            {
                NextStep             = NewDataMapStep.SqlServerSettings;
                NextButton.IsEnabled = true;
            }
        }
Example #2
0
        private DataMap loadTemplate(DataMapTemplateInfo info)
        {
            try
            {
                if (info.Template != null)
                {
                    FileInfo template = new FileInfo(info.Template);
                    if (!template.Exists)
                    {
                        throw new FileNotFoundException(info.Template);
                    }

                    string templateJson = File.ReadAllText(info.Template);
                    return(JsonConvert.DeserializeObject <DataMap>(templateJson));
                }
            } catch (Exception ex)
            {
                LogHelper.LogException(ex, "Exception loading template", true);
            }

            return(new DataMap("New DataMap.dmap"));
        }