From 8247fde3313f8aa7edd18021e074e2f5dc4e2f23 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Thu, 26 Jun 2014 20:09:32 +0200 Subject: [PATCH 1/5] Cleanup - FxCop --- .../src/Designer/ReportRootDesigner.cs | 4 ++-- .../src/Globals/StringWriterWithEncoding.cs | 2 +- .../src/TypeProvider/AbstractItemTypeProvider.cs | 16 +++++----------- .../src/TypeProvider/CircleItemTypeProvider.cs | 6 +++--- .../src/TypeProvider/DataItemTypeProvider.cs | 8 ++++---- .../src/TypeProvider/GroupedRowTypeProvider.cs | 15 ++++----------- .../src/TypeProvider/LineItemTypeProvider.cs | 11 ++++------- .../TypeProvider/RectangleItemTypeProvider.cs | 8 ++++---- .../src/TypeProvider/RowItemTypeProvider.cs | 14 ++++---------- .../src/TypeProvider/SectionItemTypeProvider.cs | 4 ++-- .../src/TypeProvider/TextItemTypeProvider.cs | 6 ++---- .../src/Views/DesignerView.cs | 2 +- .../src/XML/MycroWriter.cs | 3 ++- .../src/XML/ReportDefinitionParser.cs | 14 +++++++------- .../src/XML/ReportDesignerWriter.cs | 9 ++++----- .../Src/DataSource/ExtendedTypeDescriptor.cs | 2 +- .../ICSharpCode.Reporting/Src/Xml/MycroParser.cs | 7 ++++--- 17 files changed, 54 insertions(+), 77 deletions(-) diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/ReportRootDesigner.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/ReportRootDesigner.cs index 21f779209a..d7da7e7886 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/ReportRootDesigner.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Designer/ReportRootDesigner.cs @@ -24,6 +24,7 @@ using System.ComponentModel.Design; using System.Drawing; using System.Drawing.Design; using System.Drawing.Printing; +using System.Globalization; using System.Windows.Forms; using System.Windows.Forms.Design; using ICSharpCode.Core; @@ -217,7 +218,6 @@ namespace ICSharpCode.Reporting.Addin.Designer if (section != null) { sections.Add(section); section.SizeChanged += new EventHandler( OnSectionSizeChanged); - Console.Write("reportRootDesigner:OnComponentAdded"); foreach (Control ctrl in section.Controls) { AddToHost(ctrl); host.Container.Add(ctrl); @@ -240,7 +240,7 @@ namespace ICSharpCode.Reporting.Addin.Designer private void OnComponentChanged(object sender, ComponentChangedEventArgs ce) { LoggingService.InfoFormatted("RootDesigner:OnComponentChanged"); - String str = String.Format("RootDesigner:OnComponentChanged <{0}> from <{1}> to <{2}>",ce.Component.ToString(),ce.OldValue,ce.NewValue); + var str = String.Format(CultureInfo.CurrentCulture,"RootDesigner:OnComponentChanged <{0}> from <{1}> to <{2}>",ce.Component.ToString(),ce.OldValue,ce.NewValue); LoggingService.InfoFormatted(str); var section = ce.Component as BaseSection; diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Globals/StringWriterWithEncoding.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Globals/StringWriterWithEncoding.cs index ece8f2e807..7cbb7e2694 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Globals/StringWriterWithEncoding.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Globals/StringWriterWithEncoding.cs @@ -16,7 +16,7 @@ namespace ICSharpCode.Reporting.Addin.Globals /// class StringWriterWithEncoding:System.IO.StringWriter { - private readonly Encoding encoding; + readonly Encoding encoding; public StringWriterWithEncoding(Encoding encoding) { diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/AbstractItemTypeProvider.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/AbstractItemTypeProvider.cs index 1a3175bfd2..fae180edad 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/AbstractItemTypeProvider.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/AbstractItemTypeProvider.cs @@ -22,26 +22,20 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider { } -// public AbstractItemTypeProvider(TypeDescriptionProvider parent): base(parent) -// { -// } - public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType, instance); - return new AbstractItemTypeDescriptor(td, instance); + return new AbstractItemTypeDescriptor(td); } } - internal class AbstractItemTypeDescriptor : CustomTypeDescriptor + class AbstractItemTypeDescriptor : CustomTypeDescriptor { -// private AbstractItem _instance; - public AbstractItemTypeDescriptor(ICustomTypeDescriptor parent, object instance) + public AbstractItemTypeDescriptor(ICustomTypeDescriptor parent) : base(parent) { -// _instance = instance as AbstractItem; } @@ -54,8 +48,8 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { - PropertyDescriptorCollection props = base.GetProperties(attributes); - List allProperties = new List(); + var props = base.GetProperties(attributes); + var allProperties = new List(); foreach (PropertyDescriptor p in props) { diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/CircleItemTypeProvider.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/CircleItemTypeProvider.cs index bb84b9472c..9f86469b8d 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/CircleItemTypeProvider.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/CircleItemTypeProvider.cs @@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); - return new CircleItemTypeDescriptor(td, instance); + return new CircleItemTypeDescriptor(td); } } @@ -34,7 +34,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider class CircleItemTypeDescriptor : CustomTypeDescriptor { - public CircleItemTypeDescriptor(ICustomTypeDescriptor parent, object instance): base(parent) + public CircleItemTypeDescriptor(ICustomTypeDescriptor parent): base(parent) { } @@ -48,7 +48,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { PropertyDescriptorCollection props = base.GetProperties(attributes); - List allProperties = new List(); + var allProperties = new List(); TypeProviderHelper.AddDefaultProperties(allProperties,props); TypeProviderHelper.AddGraphicProperties(allProperties,props); diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/DataItemTypeProvider.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/DataItemTypeProvider.cs index dbaabc703d..d92f052fd6 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/DataItemTypeProvider.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/DataItemTypeProvider.cs @@ -27,7 +27,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); - return new DataItemTypeDescriptor(td, instance); + return new DataItemTypeDescriptor(td); } } @@ -36,7 +36,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider class DataItemTypeDescriptor : CustomTypeDescriptor { - public DataItemTypeDescriptor(ICustomTypeDescriptor parent, object instance) + public DataItemTypeDescriptor(ICustomTypeDescriptor parent) : base(parent) { } @@ -50,8 +50,8 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { - PropertyDescriptorCollection props = base.GetProperties(attributes); - List allProperties = new List(); + var props = base.GetProperties(attributes); + var allProperties = new List(); TypeProviderHelper.AddDefaultProperties(allProperties,props); TypeProviderHelper.AddTextBasedProperties(allProperties,props); diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/GroupedRowTypeProvider.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/GroupedRowTypeProvider.cs index d1e32d1ee2..b900e3e324 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/GroupedRowTypeProvider.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/GroupedRowTypeProvider.cs @@ -26,14 +26,14 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); - return new GroupedRowItemTypeDescriptor(td, instance); + return new GroupedRowItemTypeDescriptor(td); } } class GroupedRowItemTypeDescriptor : CustomTypeDescriptor { - public GroupedRowItemTypeDescriptor(ICustomTypeDescriptor parent, object instance) + public GroupedRowItemTypeDescriptor(ICustomTypeDescriptor parent) : base(parent) { } @@ -47,8 +47,8 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { - PropertyDescriptorCollection props = base.GetProperties(attributes); - List allProperties = new List(); + var props = base.GetProperties(attributes); + var allProperties = new List(); TypeProviderHelper.AddDefaultProperties(allProperties,props); @@ -69,16 +69,9 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider prop = props.Find("Controls",true); allProperties.Add(prop); -// prop = props.Find("AlternateBackColor",true); -// allProperties.Add(prop); -// -// prop = props.Find("ChangeBackColorEveryNRow",true); -// allProperties.Add(prop); - prop = props.Find("PageBreakOnGroupChange",true); allProperties.Add(prop); - return new PropertyDescriptorCollection(allProperties.ToArray()); } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/LineItemTypeProvider.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/LineItemTypeProvider.cs index 00929e7a2a..359e11def0 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/LineItemTypeProvider.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/LineItemTypeProvider.cs @@ -25,7 +25,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); - return new LineItemTypeDescriptor(td, instance); + return new LineItemTypeDescriptor(td); } } @@ -35,7 +35,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider { - public LineItemTypeDescriptor(ICustomTypeDescriptor parent, object instance) + public LineItemTypeDescriptor(ICustomTypeDescriptor parent) : base(parent) { @@ -50,8 +50,8 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { - PropertyDescriptorCollection props = base.GetProperties(attributes); - List allProperties = new List(); + var props = base.GetProperties(attributes); + var allProperties = new List(); TypeProviderHelper.AddDefaultProperties(allProperties,props); @@ -71,9 +71,6 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider prop = props.Find("EndLineCap",true); allProperties.Add(prop); -// prop = props.Find("DashLineCap",true); -// allProperties.Add(prop); - prop = props.Find("DashStyle",true); allProperties.Add(prop); diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/RectangleItemTypeProvider.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/RectangleItemTypeProvider.cs index 34371541f2..45229f76c4 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/RectangleItemTypeProvider.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/RectangleItemTypeProvider.cs @@ -25,7 +25,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); - return new RectangleItemTypeDescriptor(td, instance); + return new RectangleItemTypeDescriptor(td); } } @@ -33,7 +33,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider class RectangleItemTypeDescriptor : CustomTypeDescriptor { - public RectangleItemTypeDescriptor(ICustomTypeDescriptor parent, object instance) + public RectangleItemTypeDescriptor(ICustomTypeDescriptor parent) : base(parent) { } @@ -47,8 +47,8 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { - PropertyDescriptorCollection props = base.GetProperties(attributes); - List allProperties = new List(); + var props = base.GetProperties(attributes); + var allProperties = new List(); TypeProviderHelper.AddDefaultProperties(allProperties,props); TypeProviderHelper.AddGraphicProperties(allProperties,props); diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/RowItemTypeProvider.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/RowItemTypeProvider.cs index 1eeec71092..89245e2e48 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/RowItemTypeProvider.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/RowItemTypeProvider.cs @@ -26,14 +26,14 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); - return new RowItemTypeDescriptor(td, instance); + return new RowItemTypeDescriptor(td); } } internal class RowItemTypeDescriptor : CustomTypeDescriptor { - public RowItemTypeDescriptor(ICustomTypeDescriptor parent, object instance) + public RowItemTypeDescriptor(ICustomTypeDescriptor parent) : base(parent) { } @@ -47,8 +47,8 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override PropertyDescriptorCollection GetProperties(Attribute[] attributes) { - PropertyDescriptorCollection props = base.GetProperties(attributes); - List allProperties = new List(); + var props = base.GetProperties(attributes); + var allProperties = new List(); TypeProviderHelper.AddDefaultProperties(allProperties,props); @@ -69,12 +69,6 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider prop = props.Find("Controls",true); allProperties.Add(prop); -// prop = props.Find("AlternateBackColor",true); -// allProperties.Add(prop); -// -// prop = props.Find("ChangeBackColorEveryNRow",true); -// allProperties.Add(prop); - return new PropertyDescriptorCollection(allProperties.ToArray()); } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/SectionItemTypeProvider.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/SectionItemTypeProvider.cs index a3521a9622..6e96413e35 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/SectionItemTypeProvider.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/SectionItemTypeProvider.cs @@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); - return new SectionItemDescriptor(td, instance); + return new SectionItemDescriptor(td); } } @@ -35,7 +35,7 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider { - public SectionItemDescriptor(ICustomTypeDescriptor parent, object instance) + public SectionItemDescriptor(ICustomTypeDescriptor parent) : base(parent) { } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/TextItemTypeProvider.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/TextItemTypeProvider.cs index f00be1b76c..6bbab5ee08 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/TextItemTypeProvider.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/TypeProvider/TextItemTypeProvider.cs @@ -26,19 +26,17 @@ namespace ICSharpCode.Reporting.Addin.TypeProvider public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance) { ICustomTypeDescriptor td = base.GetTypeDescriptor(objectType,instance); - return new TextItemTypeDescriptor(td, instance); + return new TextItemTypeDescriptor(td); } } class TextItemTypeDescriptor : CustomTypeDescriptor { -// BaseTextItem instance; - public TextItemTypeDescriptor(ICustomTypeDescriptor parent, object instance) + public TextItemTypeDescriptor(ICustomTypeDescriptor parent) : base(parent) { -// instance = instance as BaseTextItem; } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Views/DesignerView.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Views/DesignerView.cs index 14704122d8..bfa4dad25d 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Views/DesignerView.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/Views/DesignerView.cs @@ -212,7 +212,7 @@ namespace ICSharpCode.Reporting.Addin.Views abstractItem.Site.Name = abstractItem.Name; } } - UpdatePropertyPadSelection((ISelectionService)sender); + UpdatePropertyPadSelection(selectionService); } #endregion diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/MycroWriter.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/MycroWriter.cs index 5db3ffea39..e6935aa763 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/MycroWriter.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/MycroWriter.cs @@ -9,6 +9,7 @@ using System; using System.Collections; using System.ComponentModel; +using System.Globalization; using System.Reflection; using System.Xml; using System.Xml.Serialization; @@ -53,7 +54,7 @@ namespace ICSharpCode.Reporting.Addin.XML if (val is ICollection) { // PropertyInfo pinfo = t.GetProperty(info.Name); // Console.WriteLine("pinfo {0}",pinfo.Name); - if (info.Name.StartsWith("Contr")) { + if (info.Name.StartsWith("Contr",true,CultureInfo.CurrentCulture)) { writer.WriteStartElement("Items"); } else { writer.WriteStartElement(info.Name); diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/ReportDefinitionParser.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/ReportDefinitionParser.cs index 209e6f5951..8042fc0041 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/ReportDefinitionParser.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/ReportDefinitionParser.cs @@ -20,6 +20,7 @@ using System; using System.Collections; using System.ComponentModel; using System.Diagnostics; +using System.Globalization; using System.Reflection; using System.Xml; using System.Xml.XPath; @@ -118,7 +119,7 @@ namespace ICSharpCode.Reporting.Addin.XML // Special case--we're going to assume that the child is a class instance // not associated with the parent object // Trace.Fail("Unsupported property: "+pname); - System.Console.WriteLine("Unsupported property: "+pname); + Console.WriteLine("Unsupported property: "+pname); continue; } @@ -134,8 +135,8 @@ namespace ICSharpCode.Reporting.Addin.XML { object propObject=pi.GetValue(parent, null); object obj=ProcessNode(grandChild, propObject); - System.Windows.Forms.Control parentControl = parent as System.Windows.Forms.Control; - System.Windows.Forms.Control childControl = obj as System.Windows.Forms.Control; + var parentControl = parent as System.Windows.Forms.Control; + var childControl = obj as System.Windows.Forms.Control; // we have the Items Section if ((parentControl != null) && (childControl != null)){ parentControl.Controls.Add(childControl); @@ -228,8 +229,7 @@ namespace ICSharpCode.Reporting.Addin.XML { if (tc.CanConvertFrom(typeof(string))) { - object val=tc.ConvertFromInvariantString(value); -// Console.WriteLine("\tRDP -> SetPropertyToString {0} - {1}",pi.Name,value.ToString()); + object val=tc.ConvertFromInvariantString(value); pi.SetValue(obj, val, null); } else if (pi.PropertyType == typeof(Type)) { pi.SetValue(obj, Type.GetType(value), null); @@ -237,9 +237,9 @@ namespace ICSharpCode.Reporting.Addin.XML } catch(Exception e) { - String s = String.Format("Property setter for {0} failed {1}\r\n",pi.Name, + var s = String.Format(CultureInfo.CurrentCulture,"Property setter for {0} failed {1}\r\n",pi.Name, e.Message); - System.Console.WriteLine("MycroParser : {0}",s); + Console.WriteLine("MycroParser : {0}",s); } } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/ReportDesignerWriter.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/ReportDesignerWriter.cs index ff91334c1e..6b592f9717 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/ReportDesignerWriter.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/XML/ReportDesignerWriter.cs @@ -7,6 +7,7 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Globalization; namespace ICSharpCode.Reporting.Addin.XML { @@ -15,13 +16,11 @@ namespace ICSharpCode.Reporting.Addin.XML /// class ReportDesignerWriter:MycroWriter { - public ReportDesignerWriter() { - Console.WriteLine("ReportDesignerWriter"); - Console.WriteLine(); - } protected override string GetTypeName(Type t) { - if (t.BaseType != null && t.BaseType.Name.StartsWith("Base",StringComparison.InvariantCultureIgnoreCase)) { + if (t.BaseType != null && t.BaseType.Name.StartsWith("Base", StringComparison.OrdinalIgnoreCase)) { + + // return t.BaseType.Name; } return t.Name; diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ExtendedTypeDescriptor.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ExtendedTypeDescriptor.cs index 0611f8ac7a..64fd1dc6d4 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ExtendedTypeDescriptor.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/DataSource/ExtendedTypeDescriptor.cs @@ -28,7 +28,7 @@ namespace ICSharpCode.Reporting.DataSource /// class ExtendedTypeDescriptor { - static Hashtable collections = new Hashtable(); + static readonly Hashtable collections = new Hashtable(); static bool IsAllowedProperty(string name) { diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Xml/MycroParser.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Xml/MycroParser.cs index 5a3e5946ee..6095b99535 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Xml/MycroParser.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Xml/MycroParser.cs @@ -21,6 +21,7 @@ using System.ComponentModel; using System.Diagnostics; using System.Collections; using System.Collections.Generic; +using System.Globalization; using System.Xml; using System.Reflection; @@ -223,7 +224,7 @@ namespace ICSharpCode.Reporting.Xml static void SetPropertyToString(object obj, PropertyInfo pi, string value) { // it's string, so use a type converter. - TypeConverter tc=TypeDescriptor.GetConverter(pi.PropertyType); + var tc=TypeDescriptor.GetConverter(pi.PropertyType); try { if (tc.CanConvertFrom(typeof(string))) @@ -236,9 +237,9 @@ namespace ICSharpCode.Reporting.Xml } catch(Exception e) { - String s = String.Format("Property setter for {0} failed {1}\r\n",pi.Name, + var s = String.Format(CultureInfo.CurrentCulture,"Property setter for {0} failed {1}\r\n",pi.Name, e.Message); - System.Console.WriteLine("MycroParser : {0}",s); + Console.WriteLine("MycroParser : {0}",s); } } From 97677677c53503a4ad8d6f452bb20a7a45abf2ba Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Thu, 24 Jul 2014 20:39:12 +0200 Subject: [PATCH 2/5] Remove GlobalEnums.cs, start work on Wizard --- .../ICSharpCode.Reporting.Addin.csproj | 25 ++++++- .../src/DesignableItems/ReportSettings.cs | 8 +-- .../src/DesignerBinding/DesignerBinding.cs | 23 +++++-- .../ReportWizard/Dialog/BaseSettingsPage.xaml | 66 +++++++++++++++++++ .../Dialog/BaseSettingsPage.xaml.cs | 63 ++++++++++++++++++ .../src/ReportWizard/Dialog/IHasContext.cs | 22 +++++++ .../src/ReportWizard/Dialog/ReportWizard.xaml | 33 ++++++++++ .../ReportWizard/Dialog/ReportWizard.xaml.cs | 63 ++++++++++++++++++ .../src/ReportWizard/ReportGenerator.cs | 31 +++++++++ .../src/ReportWizard/ReportWizardCommand.cs | 48 ++++++++++++++ .../ReportWizard/ViewModels/PageOneContext.cs | 26 ++++++++ .../ViewModels/ReportWizardContext.cs | 39 +++++++++++ .../Src/Factories/ReportCreatorFactory.cs | 6 +- .../Src/Factories/ReportModelFactory.cs | 2 +- .../Src/Globals/GlobalEnums.cs | 53 +++++++++++---- .../Src/Items/ReportSettings.cs | 8 +-- .../Reportingfactory/GeneralReportLoading.cs | 2 +- 17 files changed, 485 insertions(+), 33 deletions(-) create mode 100644 src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml create mode 100644 src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs create mode 100644 src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/IHasContext.cs create mode 100644 src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml create mode 100644 src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs create mode 100644 src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs create mode 100644 src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs create mode 100644 src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs create mode 100644 src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/ReportWizardContext.cs diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj index 19879aca23..a5181ece13 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj @@ -73,9 +73,13 @@ 3.0 + + ..\..\..\..\Libraries\WPFExtendedToolkit\Xceed.Wpf.Toolkit.dll + + @@ -84,8 +88,10 @@ + + - + @@ -140,6 +146,19 @@ + + + BaseSettingsPage.xaml + Code + + + ReportWizard.xaml + Code + + + + + @@ -210,5 +229,9 @@ EditorDialog.cs + + + + \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs index e50e4043e7..50861beb18 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs @@ -34,9 +34,9 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems // this.GraphicsUnit = GraphicsUnit.Pixel; // this.Padding = new Padding(5); // this.DefaultFont = GlobalValues.DefaultFont; - this.ReportType = GlobalEnums.ReportType.FormSheet; + this.ReportType = ReportType.FormSheet; // - this.DataModel = GlobalEnums.PushPullModel.FormSheet; + this.DataModel = PushPullModel.FormSheet; // // this.CommandType = System.Data.CommandType.Text; // this.ConnectionString = String.Empty; @@ -130,11 +130,11 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems public bool Landscape {get;set;} // [Category("Data")] - public GlobalEnums.PushPullModel DataModel {get;set;} + public PushPullModel DataModel {get;set;} // [Browsable(true), Category("Base Settings")] - public GlobalEnums.ReportType ReportType {get;set;} + public ReportType ReportType {get;set;} // [Category("Parameters")] diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs index caa01485ba..e7a716d31c 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs @@ -13,10 +13,10 @@ using System.Xml; using ICSharpCode.Core; using ICSharpCode.Reporting.Factories; using ICSharpCode.Reporting.Items; -using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop.Workbench; using ICSharpCode.Reporting.Addin.Commands; using ICSharpCode.Reporting.Addin.Factory; +using ICSharpCode.Reporting.Addin.ReportWizard; namespace ICSharpCode.Reporting.Addin.DesignerBinding { @@ -44,6 +44,21 @@ namespace ICSharpCode.Reporting.Addin.DesignerBinding { public IViewContent CreateContentForFile(OpenedFile file) { + if (file.IsDirty) { + var cmd = new ReportWizardCommand(file); + cmd.Run(); + if (cmd.Canceled) { + LoggingService.Info("reportWizard canceled"); + return null; + } + } + + var viewCmd = new CreateDesignerCommand(file); + viewCmd.Run(); + LoggingService.Info("return DesignerView"); + return viewCmd.DesignerView; + + /* if (file.IsDirty) { var reportModel = ReportModelFactory.Create(); @@ -55,10 +70,8 @@ namespace ICSharpCode.Reporting.Addin.DesignerBinding { file.SetData(ar); } - var viewCmd = new CreateDesignerCommand(file); - viewCmd.Run(); - LoggingService.Info("return DesignerView"); - return viewCmd.DesignerView; + + */ } static byte[] XmlToArray(XmlDocument doc) diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml new file mode 100644 index 0000000000..bf2a81e6da --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs new file mode 100644 index 0000000000..126262eb96 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs @@ -0,0 +1,63 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 08.07.2014 + * Time: 20:26 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Windows; +using Xceed.Wpf.Toolkit; +using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; + +namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{ + + /// + /// Interaction logic for PageOne.xamlWizardPage,IHasContext + /// + public partial class BaseSettingsPage : WizardPage,IHasContext + { + PageOneContext context; + + public BaseSettingsPage() + { + InitializeComponent(); + this.context = new PageOneContext(); + } + + + public IWizardContext Context { + get{ + UpdateContext(); + return context;} + } + + public int PageNumber { + get {return 1;} + } + + + void WizardPage_Enter(object sender, RoutedEventArgs e) + { + + Console.Write("Create Context for PageOne"); + } + + void WizardPage_Leave(object sender, RoutedEventArgs e) + { +// NewMethod(); + } + + void UpdateContext() + { +// context.FormSheet = this._FormSheet.IsChecked == true; +// context.PushModel = this._PushModel.IsChecked == true; + context.ReportName = this._ReportName.Text; + context.FileName = this._Filename.Text; + context.Legal = _Legal.IsChecked == true; + ; + context.Landscape = _Landscape.IsChecked == true; + } + } +} \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/IHasContext.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/IHasContext.cs new file mode 100644 index 0000000000..d2479d2600 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/IHasContext.cs @@ -0,0 +1,22 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 16.07.2014 + * Time: 20:41 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; + +namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog +{ + /// + /// Description of IHasContext. + /// + public interface IHasContext + { + IWizardContext Context {get;} + int PageNumber {get;} + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml new file mode 100644 index 0000000000..8e3d9916e0 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs new file mode 100644 index 0000000000..736ae0ee53 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs @@ -0,0 +1,63 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 07.07.2014 + * Time: 20:18 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Windows; +using Xceed.Wpf.Toolkit; +using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; +using System.Linq; + +namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog +{ + /// + /// Interaction logic for Window1.xaml + /// + public partial class ReportWizard : Window + { + ReportWizardContext context; + BaseSettingsPage baseSettingsPage; + + public ReportWizard(ReportWizardContext context) + { + InitializeComponent(); + this.context = context; + baseSettingsPage = new BaseSettingsPage(); + _wizard.Items.Insert(2,baseSettingsPage); + + } + + + void _wizard_Next(object sender, Xceed.Wpf.Toolkit.Core.CancelRoutedEventArgs e) + { + } + + + void _wizard_PageChanged(object sender, RoutedEventArgs e) + { + + } + + void _wizard_Finish(object sender, RoutedEventArgs e) + { + var x = _wizard.Items; + + foreach (var element in this._wizard.Items) { + var isHasContext = element is IHasContext; + if (isHasContext) { + + var hasContext = (IHasContext) element; + Console.WriteLine(" {0} - {1}",hasContext.PageNumber,element.ToString()); + } + } + + context.PageOneContext = baseSettingsPage.Context; + + } + + } +} \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs new file mode 100644 index 0000000000..8f99a5e582 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs @@ -0,0 +1,31 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 22.07.2014 + * Time: 19:37 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; + +namespace ICSharpCode.Reporting.Addin.ReportWizard +{ + /// + /// Description of ReportGenerator. + /// + public class ReportGenerator + { + ReportWizardContext context; + + public ReportGenerator(ReportWizardContext context) + { + if (context == null) + throw new ArgumentNullException("context"); + this.context = context; + } + + + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs new file mode 100644 index 0000000000..ba524408af --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs @@ -0,0 +1,48 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 08.07.2014 + * Time: 19:47 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using ICSharpCode.Core; +using ICSharpCode.Reporting.Interfaces; +using ICSharpCode.SharpDevelop.Workbench; +using ICSharpCode.Reporting.Addin.ReportWizard.Dialog; +using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; + +namespace ICSharpCode.Reporting.Addin.ReportWizard +{ + /// + /// Description of ReportWizardCommand. + /// + class ReportWizardCommand: AbstractMenuCommand + { + readonly OpenedFile file; + + public ReportWizardCommand (OpenedFile file) { + if (file == null) + throw new ArgumentNullException("file"); + this.file = file; + } + + public override void Run() + { + var wizardViewModel = new ReportWizardContext(); + var reportWizard = new ICSharpCode.Reporting.Addin.ReportWizard.Dialog.ReportWizard(wizardViewModel); + + reportWizard.ShowDialog(); + if (reportWizard.DialogResult.HasValue && reportWizard.DialogResult.Value){ + LoggingService.Info("ReportWizard - CreateReport"); + var rg = new ReportGenerator(wizardViewModel); + + } else { + Canceled = true; + } + } + + public bool Canceled {get; private set;} + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs new file mode 100644 index 0000000000..a012d040eb --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs @@ -0,0 +1,26 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 07/12/2014 + * Time: 18:20 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using Xceed.Wpf.Toolkit; + +namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels +{ + /// + /// Description of PageOneViewModel. + /// + public class PageOneContext:IWizardContext + { + public bool FormSheet {get;set;} + public bool PushModel {get;set;} + public string ReportName {get;set;} + public string FileName {get;set;} + public bool Legal {get;set;} + public bool Landscape {get;set;} + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/ReportWizardContext.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/ReportWizardContext.cs new file mode 100644 index 0000000000..074f032a60 --- /dev/null +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/ReportWizardContext.cs @@ -0,0 +1,39 @@ +/* + * Created by SharpDevelop. + * User: Peter Forstmeier + * Date: 07/12/2014 + * Time: 18:10 + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; + +namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels +{ + + public interface IWizardContext { + + } + /// + /// Description of ReportWizardViewModel. + /// + public class ReportWizardContext:IWizardContext + { + + + public string Title { + get{ return "das ist der Title";} + } + + IWizardContext pageOneContext; + + public IWizardContext PageOneContext { + get { + return pageOneContext; + } + set { + pageOneContext = value; + } + } + } +} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportCreatorFactory.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportCreatorFactory.cs index 6ce850bbb8..7b87fe03d2 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportCreatorFactory.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportCreatorFactory.cs @@ -32,18 +32,18 @@ namespace ICSharpCode.Reporting.Factories { IReportCreator reportCreator = null; switch (reportModel.ReportSettings.DataModel) { - case GlobalEnums.PushPullModel.FormSheet: + case PushPullModel.FormSheet: { reportCreator = new FormPageBuilder(reportModel); break; } - case GlobalEnums.PushPullModel.PullData: + case PushPullModel.PullData: { break; } - case GlobalEnums.PushPullModel.PushData: + case PushPullModel.PushData: { break; diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportModelFactory.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportModelFactory.cs index b6fa62ec5e..ded5abbdbc 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportModelFactory.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Factories/ReportModelFactory.cs @@ -22,7 +22,7 @@ namespace ICSharpCode.Reporting.Factories { var reportModel = new ReportModel(); - foreach (var section in Enum.GetValues(typeof(GlobalEnums.ReportSection))) { + foreach (var section in Enum.GetValues(typeof(ReportSection))) { reportModel.SectionCollection.Add (SectionFactory.Create(section.ToString())); } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs index accba07f91..15be41d41e 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs @@ -23,12 +23,30 @@ namespace ICSharpCode.Reporting.Globals /// /// Description of GlobalEnums. /// - public sealed class GlobalEnums - { - private GlobalEnums() { - } - public enum ReportSection { + ///Technics to get the data + /// Push : report get's a ready filld dataset or something tah implements IList + /// Pull : report has to fill data by themself + /// FormSheet : FormSheet report, just labels and images are allowed + /// + /// + public enum PushPullModel { + PushData, + PullData, + FormSheet + } + + /// + /// FormSheet means a blank form with Labels, Lines and Checkboxes + /// DataReport handles all Reports with Data + /// + public enum ReportType { + FormSheet, + DataReport, + } + + +public enum ReportSection { ReportHeader, ReportPageHeader, ReportDetail, @@ -36,27 +54,34 @@ namespace ICSharpCode.Reporting.Globals ReportFooter } + public sealed class GlobalEnums + { + private GlobalEnums() { + } + + + ///Technics to get the data /// Push : report get's a ready filld dataset or something tah implements IList /// Pull : report has to fill data by themself /// FormSheet : FormSheet report, just labels and images are allowed /// /// - public enum PushPullModel { - PushData, - PullData, - FormSheet - } +// public enum PushPullModel { +// PushData, +// PullData, +// FormSheet +// } /// /// FormSheet means a blank form with Labels, Lines and Checkboxes /// DataReport handles all Reports with Data /// - public enum ReportType { - FormSheet, - DataReport, - } +// public enum ReportType { +// FormSheet, +// DataReport, +// } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs index 5193420945..ac960a1dd2 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/ReportSettings.cs @@ -65,9 +65,9 @@ namespace ICSharpCode.Reporting.Items // this.GraphicsUnit = GraphicsUnit.Pixel; // this.Padding = new Padding(5); // this.DefaultFont = GlobalValues.DefaultFont; - ReportType = GlobalEnums.ReportType.FormSheet; + ReportType = ReportType.FormSheet; // - this.DataModel = GlobalEnums.PushPullModel.FormSheet; + this.DataModel = PushPullModel.FormSheet; // // this.CommandType = System.Data.CommandType.Text; // this.ConnectionString = String.Empty; @@ -125,11 +125,11 @@ namespace ICSharpCode.Reporting.Items [Browsable(true), Category("Base Settings")] - public GlobalEnums.ReportType ReportType {get;set;} + public ReportType ReportType {get;set;} [Browsable(true), Category("Base Settings")] - public GlobalEnums.PushPullModel DataModel {get;set;} + public PushPullModel DataModel {get;set;} #endregion diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/GeneralReportLoading.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/GeneralReportLoading.cs index b1c1d5d25c..f19e89df84 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/GeneralReportLoading.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Test/ICSharpCode.Reporting.Test/src/Reportingfactory/GeneralReportLoading.cs @@ -68,7 +68,7 @@ namespace ICSharpCode.Reporting.Test.Reportingfactory { var rf = new ReportingFactory(); var model = rf.LoadReportModel(stream); - Assert.That(model.ReportSettings.DataModel,Is.EqualTo(GlobalEnums.PushPullModel.FormSheet)); + Assert.That(model.ReportSettings.DataModel,Is.EqualTo(PushPullModel.FormSheet)); } From 9f847f624fec3d0f6ebcb72defd67a77c57e55b7 Mon Sep 17 00:00:00 2001 From: Peter Forstmeier Date: Tue, 29 Jul 2014 21:00:53 +0200 Subject: [PATCH 3/5] First, very basic implementation for FormSheet Wizard --- .../ICSharpCode.Reporting.Addin.csproj | 1 - .../src/DesignableItems/ReportSettings.cs | 45 ++++++----- .../src/DesignerBinding/DesignerBinding.cs | 13 +++- .../src/DesignerBinding/DesignerGenerator.cs | 7 +- .../ReportWizard/Dialog/BaseSettingsPage.xaml | 65 +++++++++------- .../Dialog/BaseSettingsPage.xaml.cs | 19 ++--- .../src/ReportWizard/Dialog/ReportWizard.xaml | 7 +- .../ReportWizard/Dialog/ReportWizard.xaml.cs | 18 +---- .../src/ReportWizard/ReportGenerator.cs | 45 +++++++++++ .../src/ReportWizard/ReportWizardCommand.cs | 4 + .../ReportWizard/ViewModels/PageOneContext.cs | 5 +- .../Src/Globals/GlobalEnums.cs | 76 +++++-------------- .../Src/Items/BaseSection.cs | 2 +- .../Src/Items/BaseTextItem.cs | 1 + .../Src/Items/PrintableItem.cs | 1 + 15 files changed, 162 insertions(+), 147 deletions(-) diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj index a5181ece13..c1cdc982e4 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/ICSharpCode.Reporting.Addin.csproj @@ -79,7 +79,6 @@ - diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs index 50861beb18..43a4f72fdf 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignableItems/ReportSettings.cs @@ -42,10 +42,10 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems // this.ConnectionString = String.Empty; // this.CommandText = String.Empty; // -// this.TopMargin = GlobalValues.DefaultPageMargin.Left; -// this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom; -// this.LeftMargin = GlobalValues.DefaultPageMargin.Left; -// this.RightMargin = GlobalValues.DefaultPageMargin.Right; + this.TopMargin = GlobalValues.DefaultPageMargin.Left; + this.BottomMargin = GlobalValues.DefaultPageMargin.Bottom; + this.LeftMargin = GlobalValues.DefaultPageMargin.Left; + this.RightMargin = GlobalValues.DefaultPageMargin.Right; // // this.availableFields = new AvailableFieldsCollection(); // this.groupingsCollection = new GroupColumnCollection(); @@ -57,10 +57,9 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems } - private string reportName; + string reportName; -// [Category("Base Settings")] -// [DefaultValueAttribute ("")] + [Category("Base Settings")] public string ReportName { get { @@ -76,8 +75,9 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems } } - private string fileName; -// [Category("Base Settings")] + + string fileName; + [Category("Base Settings")] // [XmlIgnoreAttribute] public string FileName { @@ -93,25 +93,28 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems } -// [Category("Page Settings")] + [Browsable(true), Category("Base Settings")] + public ReportType ReportType {get;set;} + + + [Category("Page Settings")] public int BottomMargin {get;set;} -// [Category("Page Settings")] + [Category("Page Settings")] public int TopMargin {get;set;} - -// [Category("Page Settings")] + [Category("Page Settings")] public int LeftMargin {get;set;} - -// [Category("Page Settings")] + [Category("Page Settings")] public int RightMargin {get;set;} - private Size pageSize; + Size pageSize; + [Category("Page Settings")] public Size PageSize { get { if (!Landscape) { @@ -123,19 +126,15 @@ namespace ICSharpCode.Reporting.Addin.DesignableItems set { pageSize = value; } } -// [Category("Page Settings")] -// public Size PageSize {get;set;} + -// [Category("Page Settings")] + [Category("Page Settings")] public bool Landscape {get;set;} -// [Category("Data")] + [Category("Data")] public PushPullModel DataModel {get;set;} -// [Browsable(true), Category("Base Settings")] - public ReportType ReportType {get;set;} - // [Category("Parameters")] // [EditorAttribute ( typeof(ParameterCollectionEditor), diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs index e7a716d31c..93df61f344 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerBinding.cs @@ -47,8 +47,17 @@ namespace ICSharpCode.Reporting.Addin.DesignerBinding { if (file.IsDirty) { var cmd = new ReportWizardCommand(file); cmd.Run(); - if (cmd.Canceled) { + if (!cmd.Canceled) { LoggingService.Info("reportWizard canceled"); + //return null; + var reportModel = cmd.ReportModel; + + var xml = CreateFormSheetFromModel.ToXml(reportModel); + var doc = new XmlDocument(); + doc.LoadXml(xml.ToString()); + var ar = XmlToArray(doc); + file.SetData(ar); + } else { return null; } } @@ -71,7 +80,7 @@ namespace ICSharpCode.Reporting.Addin.DesignerBinding { } - */ + */ } static byte[] XmlToArray(XmlDocument doc) diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerGenerator.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerGenerator.cs index ea4dcfa3d4..6cde4855fa 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerGenerator.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/DesignerBinding/DesignerGenerator.cs @@ -78,9 +78,10 @@ namespace ICSharpCode.Reporting.Addin.DesignerBinding // we look only for Sections foreach (var component in viewContent.Host.Container.Components) { - var b = component as BaseSection; - if (b != null) { - reportDesignerWriter.Save(component,xml); + var section = component as BaseSection; + if (section != null) { +// reportDesignerWriter.Save(component,xml); + reportDesignerWriter.Save(section,xml); } } //SectionCollection diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml index bf2a81e6da..3fd65a42db 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml @@ -2,27 +2,31 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" - xmlns:System="clr-namespace:System;assembly=mscorlib" -xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting" - xmlns:ics="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting" + xmlns:System="clr-namespace:System;assembly=mscorlib" + xmlns:sdr="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Reporting" + Title="Base Settings" Description="Basic Settings and Layout" - Background="LightGray"> + Background="LightGray" + CanFinish="true"> - - - - - - - - + + + + + + + + + + + - - + + @@ -30,10 +34,10 @@ xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Repor - - - - + + + + @@ -43,14 +47,17 @@ xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Repor - - - + + + - - + + + @@ -59,8 +66,8 @@ xmlns:aa="clr-namespace:ICSharpCode.Reporting.Globals;assembly=ICSharpCode.Repor - - + + \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs index 126262eb96..191c6cb858 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/BaseSettingsPage.xaml.cs @@ -8,6 +8,7 @@ */ using System; using System.Windows; +using ICSharpCode.Reporting.Globals; using Xceed.Wpf.Toolkit; using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; @@ -23,6 +24,8 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{ public BaseSettingsPage() { InitializeComponent(); + _DataModel.SelectedItem = PushPullModel.FormSheet; + _ReportType.SelectedItem = ReportType.FormSheet; this.context = new PageOneContext(); } @@ -38,21 +41,11 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog{ } - void WizardPage_Enter(object sender, RoutedEventArgs e) - { - - Console.Write("Create Context for PageOne"); - } - - void WizardPage_Leave(object sender, RoutedEventArgs e) - { -// NewMethod(); - } - void UpdateContext() { -// context.FormSheet = this._FormSheet.IsChecked == true; -// context.PushModel = this._PushModel.IsChecked == true; + + context.DataModel = (PushPullModel) _DataModel.SelectedItem; + context.ReportType = (ReportType) _ReportType.SelectedItem; context.ReportName = this._ReportName.Text; context.FileName = this._Filename.Text; context.Legal = _Legal.IsChecked == true; diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml index 8e3d9916e0..59ba6244b3 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml @@ -20,14 +20,15 @@ - + \ No newline at end of file diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs index 736ae0ee53..cc0460698d 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/Dialog/ReportWizard.xaml.cs @@ -19,16 +19,15 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog /// public partial class ReportWizard : Window { - ReportWizardContext context; - BaseSettingsPage baseSettingsPage; + readonly ReportWizardContext context; + readonly BaseSettingsPage baseSettingsPage; public ReportWizard(ReportWizardContext context) { InitializeComponent(); this.context = context; baseSettingsPage = new BaseSettingsPage(); - _wizard.Items.Insert(2,baseSettingsPage); - + _wizard.Items.Insert(1,baseSettingsPage); } @@ -44,17 +43,6 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.Dialog void _wizard_Finish(object sender, RoutedEventArgs e) { - var x = _wizard.Items; - - foreach (var element in this._wizard.Items) { - var isHasContext = element is IHasContext; - if (isHasContext) { - - var hasContext = (IHasContext) element; - Console.WriteLine(" {0} - {1}",hasContext.PageNumber,element.ToString()); - } - } - context.PageOneContext = baseSettingsPage.Context; } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs index 8f99a5e582..807be02f9b 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportGenerator.cs @@ -7,7 +7,13 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using System.Drawing; +using ICSharpCode.Reporting.Factories; +using ICSharpCode.Reporting.Globals; using ICSharpCode.Reporting.Interfaces; + + +using ICSharpCode.Reporting.Items; using ICSharpCode.Reporting.Addin.ReportWizard.ViewModels; namespace ICSharpCode.Reporting.Addin.ReportWizard @@ -18,14 +24,53 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard public class ReportGenerator { ReportWizardContext context; + public ReportGenerator(ReportWizardContext context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; + ReportModel = ReportModelFactory.Create(); + } + + + public void Generate() { + PageOneGenerate(); + CreateReportHeader(); + } + + void PageOneGenerate() + { + var pageOne = (PageOneContext)context.PageOneContext; + var reportSettings = ReportModel.ReportSettings; + reportSettings.DataModel = pageOne.DataModel; + reportSettings.FileName = pageOne.FileName; + if (pageOne.Legal) { + reportSettings.Landscape = false; + } else { + reportSettings.Landscape = true; + } + reportSettings.ReportName = pageOne.ReportName; + reportSettings.ReportType = pageOne.ReportType; + } + + + void CreateReportHeader() + { + var headerText = new BaseTextItem(); + headerText.Text = "Header"; + headerText.Size = GlobalValues.PreferedSize; + var printableWith = ReportModel.ReportSettings.PageSize.Width - ReportModel.ReportSettings.LeftMargin - ReportModel.ReportSettings.RightMargin; + var x = (int)(printableWith - headerText.Size.Width) / 2; + + headerText.Location = new Point(x,4); + ReportModel.ReportHeader.Items.Add(headerText); + Console.WriteLine(""); + Console.WriteLine("Createreportheader Size {0}",ReportModel.ReportHeader.Size); } + public IReportModel ReportModel {get;private set;} } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs index ba524408af..387ca1acb5 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ReportWizardCommand.cs @@ -38,11 +38,15 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard LoggingService.Info("ReportWizard - CreateReport"); var rg = new ReportGenerator(wizardViewModel); + rg.Generate(); + ReportModel = rg.ReportModel; } else { Canceled = true; } } public bool Canceled {get; private set;} + + public IReportModel ReportModel {get;private set;} } } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs index a012d040eb..c6fc2d92df 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting.Addin/src/ReportWizard/ViewModels/PageOneContext.cs @@ -7,6 +7,7 @@ * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using System; +using ICSharpCode.Reporting.Globals; using Xceed.Wpf.Toolkit; namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels @@ -16,8 +17,8 @@ namespace ICSharpCode.Reporting.Addin.ReportWizard.ViewModels /// public class PageOneContext:IWizardContext { - public bool FormSheet {get;set;} - public bool PushModel {get;set;} + public PushPullModel DataModel {get;set;} + public ReportType ReportType {get;set;} public string ReportName {get;set;} public string FileName {get;set;} public bool Legal {get;set;} diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs index 15be41d41e..e3c34f027e 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Globals/GlobalEnums.cs @@ -20,69 +20,35 @@ using System; namespace ICSharpCode.Reporting.Globals { - /// - /// Description of GlobalEnums. - /// ///Technics to get the data - /// Push : report get's a ready filld dataset or something tah implements IList - /// Pull : report has to fill data by themself - /// FormSheet : FormSheet report, just labels and images are allowed - /// - /// + /// Push : report get's a ready filld dataset or something tah implements IList + /// Pull : report has to fill data by themself + /// FormSheet : FormSheet report, just labels and images are allowed + /// + public enum PushPullModel { - PushData, - PullData, - FormSheet + PushData, + PullData, + FormSheet } - + /// - /// FormSheet means a blank form with Labels, Lines and Checkboxes - /// DataReport handles all Reports with Data - /// + /// FormSheet means a blank form with Labels, Lines and Checkboxes + /// DataReport handles all Reports with Data + /// public enum ReportType { - FormSheet, - DataReport, + FormSheet, + DataReport, } -public enum ReportSection { - ReportHeader, - ReportPageHeader, - ReportDetail, - ReportPageFooter, - ReportFooter - } - - public sealed class GlobalEnums - { - private GlobalEnums() { - } - - - - ///Technics to get the data - /// Push : report get's a ready filld dataset or something tah implements IList - /// Pull : report has to fill data by themself - /// FormSheet : FormSheet report, just labels and images are allowed - /// - /// -// public enum PushPullModel { -// PushData, -// PullData, -// FormSheet -// } - - - /// - /// FormSheet means a blank form with Labels, Lines and Checkboxes - /// DataReport handles all Reports with Data - /// -// public enum ReportType { -// FormSheet, -// DataReport, -// } - - + public enum ReportSection { + ReportHeader, + ReportPageHeader, + ReportDetail, + ReportPageFooter, + ReportFooter } + } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs index a57b3614cd..2bfa2a8455 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseSection.cs @@ -26,7 +26,7 @@ namespace ICSharpCode.Reporting.Items /// Description of BaseSection. /// - public class BaseSection:ReportContainer,IReportContainer + public class BaseSection:ReportContainer { diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs index 242c524eed..571d00b4a0 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/BaseTextItem.cs @@ -45,6 +45,7 @@ namespace ICSharpCode.Reporting.Items public BaseTextItem(){ Name = "BaseTextItem"; Font = GlobalValues.DefaultFont; + } diff --git a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs index ec72ea1005..4be5b87cf5 100644 --- a/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs +++ b/src/AddIns/Misc/Reporting/ICSharpCode.Reporting/Src/Items/PrintableItem.cs @@ -18,6 +18,7 @@ using System; using System.Drawing; +using ICSharpCode.Reporting.Globals; using ICSharpCode.Reporting.Interfaces; using ICSharpCode.Reporting.Interfaces.Export; From a8a3391f2575f7d1da63b009408555fb3645342a Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Tue, 29 Jul 2014 21:53:49 +0200 Subject: [PATCH 4/5] fix problem with captured/local variables in a generic context while debugging --- src/AddIns/Debugger/Debugger.Core/TypeSystemExtensions.cs | 4 +++- src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/AddIns/Debugger/Debugger.Core/TypeSystemExtensions.cs b/src/AddIns/Debugger/Debugger.Core/TypeSystemExtensions.cs index fec6bd7158..75b0441eef 100644 --- a/src/AddIns/Debugger/Debugger.Core/TypeSystemExtensions.cs +++ b/src/AddIns/Debugger/Debugger.Core/TypeSystemExtensions.cs @@ -232,7 +232,9 @@ namespace Debugger { var info = GetInfo(method.ParentAssembly); var variableTypes = info.GetLocalVariableTypes(method.UnresolvedMember); - return variableTypes[index].Resolve(new SimpleTypeResolveContext(method)); + return variableTypes[index] + .Resolve(new SimpleTypeResolveContext(method)) + .AcceptVisitor(method.Substitution); } #endregion diff --git a/src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs b/src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs index 218178354b..24a89a5cb8 100644 --- a/src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs +++ b/src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs @@ -106,7 +106,7 @@ namespace ICSharpCode.ILSpyAddIn return symbols.LocalVariables.Where(v => v.OriginalVariable != null).Select( v => new Debugger.ILLocalVariable() { Index = v.OriginalVariable.Index, - Type = loader.ReadTypeReference(v.Type).Resolve(context), + Type = loader.ReadTypeReference(v.Type).Resolve(context).AcceptVisitor(method.Substitution), Name = v.Name, IsCompilerGenerated = false, ILRanges = new [] { new ILRange(0, int.MaxValue) } From 8063942775eedd7242edc7f771052ff6f03558df Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Wed, 30 Jul 2014 20:09:01 +0200 Subject: [PATCH 5/5] close #296: ArgumentNullException when debugging and pdb points to missing file + show StackFrames without file name as unreachable in CallStackPad --- src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.cs b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.cs index 4e0006a4d2..18b1f83dd2 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.cs @@ -150,7 +150,9 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads { bool showExternalMethods = DebuggingOptions.Instance.ShowExternalMethods; var symSource = WindowsDebugger.PdbSymbolSource; - bool hasSymbols = symSource.Handles(frame.MethodInfo) && !symSource.IsCompilerGenerated(frame.MethodInfo); + bool hasSymbols = symSource.Handles(frame.MethodInfo) + && !symSource.IsCompilerGenerated(frame.MethodInfo) + && frame.NextStatement != null && !string.IsNullOrWhiteSpace(frame.NextStatement.Filename); if (showExternalMethods || hasSymbols) { // Show the method in the list previousItemIsExternalMethod = false;