|
|
|
@ -49,38 +49,36 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
@@ -49,38 +49,36 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IEnumerable<ITypeDefinition> GetTypeDefinitions(){ |
|
|
|
|
|
|
|
|
|
IEnumerable<ITypeDefinition> GetTypeDefinitions() |
|
|
|
|
{ |
|
|
|
|
if (SelectedProject != null) { |
|
|
|
|
var compilation = SharpDevelop.SD.ParserService.GetCompilation(SelectedProject); |
|
|
|
|
var definitions = compilation.MainAssembly.TopLevelTypeDefinitions.Where(x => x.Properties.Any()); |
|
|
|
|
return definitions; |
|
|
|
|
} else { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public IModelCollection<IProject> Projects {get; private set;} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region SolutionCombo
|
|
|
|
|
|
|
|
|
|
void _pro_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e){ |
|
|
|
|
SelectedProject = (IProject)e.AddedItems[0]; |
|
|
|
|
var definitions = GetTypeDefinitions(); |
|
|
|
|
// if (definitions != null) {
|
|
|
|
|
if (definitions.Any()) { |
|
|
|
|
_cboTypes.Visibility = System.Windows.Visibility.Visible; |
|
|
|
|
_availTxt.Visibility = System.Windows.Visibility.Visible; |
|
|
|
|
_projTxt.Visibility = System.Windows.Visibility.Visible; |
|
|
|
|
_cboTypes.ItemsSource = definitions; |
|
|
|
|
_cboTypes.SelectedIndex = 0; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
var data = new AbstractColumn("MyColumn", typeof(string)); |
|
|
|
|
items.Add(data); |
|
|
|
|
_projTxt.Text = ResourceService.GetString("SharpReport.Wizard.PushModel.NoProject"); |
|
|
|
|
} |
|
|
|
|
// }
|
|
|
|
|
if (definitions.Any()) { |
|
|
|
|
_cboTypes.Visibility = System.Windows.Visibility.Visible; |
|
|
|
|
_availTxt.Visibility = System.Windows.Visibility.Visible; |
|
|
|
|
_projTxt.Visibility = System.Windows.Visibility.Visible; |
|
|
|
|
_cboTypes.ItemsSource = definitions; |
|
|
|
|
_cboTypes.SelectedIndex = 0; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
var data = new AbstractColumn("MyColumn", typeof(string)); |
|
|
|
|
items.Add(data); |
|
|
|
|
_projTxt.Text = ResourceService.GetString("SharpReport.Wizard.PushModel.NoProject"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
@ -88,13 +86,16 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
@@ -88,13 +86,16 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
|
|
|
|
|
#region Classes Combo
|
|
|
|
|
|
|
|
|
|
void _cboTypes_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e){ |
|
|
|
|
var typeDefinition = (ITypeDefinition)e.AddedItems[0]; |
|
|
|
|
var itemsList = CreateItemsSource(typeDefinition); |
|
|
|
|
if (itemsList.Count > 0) { |
|
|
|
|
_DataGrid.ItemsSource = itemsList; |
|
|
|
|
if (e.AddedItems.Count > 0) { |
|
|
|
|
var typeDefinition = (ITypeDefinition)e.AddedItems[0]; |
|
|
|
|
var itemsList = CreateItemsSource(typeDefinition); |
|
|
|
|
if (itemsList.Count > 0) { |
|
|
|
|
_DataGrid.ItemsSource = itemsList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
static List<AbstractColumn> CreateItemsSource(ITypeDefinition typeDefinitions){ |
|
|
|
|
return typeDefinitions.Properties.Select(p => new AbstractColumn(){ |
|
|
|
@ -102,7 +103,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
@@ -102,7 +103,7 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog
|
|
|
|
|
DataTypeName = p.ReturnType.ReflectionName |
|
|
|
|
}).ToList(); |
|
|
|
|
} |
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UpdateContext(){ |
|
|
|
|
context.Items = (List<AbstractColumn>)_DataGrid.ItemsSource; |
|
|
|
|