Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1623 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
12 changed files with 334 additions and 21 deletions
@ -0,0 +1,101 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Peter |
||||||
|
* Date: 24.07.2006 |
||||||
|
* Time: 11:55 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
namespace ReportSamples{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of ReportFromCollection.
|
||||||
|
/// </summary>
|
||||||
|
public class ContributersList |
||||||
|
{ |
||||||
|
public ContributersList(){ |
||||||
|
} |
||||||
|
|
||||||
|
public void Run () { |
||||||
|
string reportFileName; |
||||||
|
try |
||||||
|
{ |
||||||
|
OpenFileDialog dg = new OpenFileDialog(); |
||||||
|
dg.Filter = "SharpReport files|*.srd"; |
||||||
|
dg.Title = "Select a report file: "; |
||||||
|
if (dg.ShowDialog() == DialogResult.OK){ |
||||||
|
SharpReportCore.SharpReportEngine engine = new SharpReportCore.SharpReportEngine(); |
||||||
|
reportFileName = dg.FileName.ToString(); |
||||||
|
|
||||||
|
TestList list = new TestList(); |
||||||
|
|
||||||
|
list.Add(new LastFirst("Bernhard","Spuida","Core")); |
||||||
|
list.Add(new LastFirst("Daniel","Grünwald","Core")); |
||||||
|
list.Add(new LastFirst("Cristoph","Wille","Core")); |
||||||
|
|
||||||
|
list.Add(new LastFirst("Markus","Palme","Prg.")); |
||||||
|
list.Add(new LastFirst("Georg","Brandl","Prg.")); |
||||||
|
list.Add(new LastFirst("David","Srbecky","Debugger")); |
||||||
|
list.Add(new LastFirst("Dickon","Field","DBTools")); |
||||||
|
list.Add(new LastFirst("Matt","Ward","NUnit")); |
||||||
|
list.Add(new LastFirst("Troy","Simson","Prg.")); |
||||||
|
list.Add(new LastFirst("Peter","Forstmeier","SharpReport")); |
||||||
|
list.Add(new LastFirst("David","Albert","Prg.")); |
||||||
|
|
||||||
|
// list.Add(new LastFirst("Sylvana","Schmid"));
|
||||||
|
|
||||||
|
|
||||||
|
// engine.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting);
|
||||||
|
// engine.SectionRendered += new EventHandler<SectionRenderEventArgs>(PushPrinted);
|
||||||
|
engine.PreviewPushDataReport(reportFileName,list); |
||||||
|
|
||||||
|
// }
|
||||||
|
} |
||||||
|
} |
||||||
|
catch (Exception){ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class LastFirst { |
||||||
|
string last; |
||||||
|
string first; |
||||||
|
string job; |
||||||
|
|
||||||
|
public LastFirst(string last, string first,string job) |
||||||
|
{ |
||||||
|
this.last = last; |
||||||
|
this.first = first; |
||||||
|
this.job = job; |
||||||
|
} |
||||||
|
|
||||||
|
public string Last { |
||||||
|
get { |
||||||
|
return last; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public string First { |
||||||
|
get { |
||||||
|
return first; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public string Job { |
||||||
|
get { |
||||||
|
return job; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public class TestList: List<LastFirst>{ |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,144 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Forstmeier Peter |
||||||
|
* Date: 26.07.2006 |
||||||
|
* Time: 08:07 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.Drawing; |
||||||
|
using System.Resources; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
using SharpReportCore; |
||||||
|
using System.Reflection; |
||||||
|
//using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace ReportSamples |
||||||
|
{ |
||||||
|
// public class EventList: List<EventLogEntry>{
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
/// <summary>
|
||||||
|
/// Description of EventLogger.
|
||||||
|
/// </summary>
|
||||||
|
public class EventLogger |
||||||
|
{ |
||||||
|
ImageList imageList ; |
||||||
|
public EventLogger() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public void Run() { |
||||||
|
EventLog ev = new EventLog(); |
||||||
|
ev.Log = "System"; |
||||||
|
ev.MachineName = "."; // Lokale Maschine
|
||||||
|
|
||||||
|
FillImageList(); |
||||||
|
|
||||||
|
string reportFileName; |
||||||
|
|
||||||
|
try |
||||||
|
{ |
||||||
|
OpenFileDialog dg = new OpenFileDialog(); |
||||||
|
dg.Filter = "SharpReport files|*.srd"; |
||||||
|
dg.Title = "Select a report file: "; |
||||||
|
if (dg.ShowDialog() == DialogResult.OK){ |
||||||
|
SharpReportCore.SharpReportEngine engine = new SharpReportCore.SharpReportEngine(); |
||||||
|
reportFileName = dg.FileName.ToString(); |
||||||
|
// EventLog dosn#t implement IList, so we have to convert it to the 'cheapest'
|
||||||
|
// IList implementaion
|
||||||
|
ArrayList ar = new ArrayList(); |
||||||
|
ar.AddRange(ev.Entries); |
||||||
|
|
||||||
|
engine.SectionRendering += new EventHandler<SectionRenderEventArgs>(PushPrinting); |
||||||
|
engine.SectionRendered += new EventHandler<SectionRenderEventArgs>(PushPrinted); |
||||||
|
engine.PreviewPushDataReport(reportFileName,ar); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
catch (Exception){ |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
private void PushPrinting (object sender,SectionRenderEventArgs e) { |
||||||
|
// System.Console.WriteLine("SimpleUnboundPullPrinting");
|
||||||
|
// CheckItems(e.Section.Items);
|
||||||
|
switch (e.CurrentSection) { |
||||||
|
case GlobalEnums.enmSection.ReportHeader: |
||||||
|
// System.Console.WriteLine("\tI found the ReportHeader");
|
||||||
|
break; |
||||||
|
|
||||||
|
case GlobalEnums.enmSection.ReportPageHeader: |
||||||
|
|
||||||
|
// System.Console.WriteLine("\tI found the Pageheader");
|
||||||
|
break; |
||||||
|
|
||||||
|
case GlobalEnums.enmSection.ReportDetail: |
||||||
|
// System.Console.WriteLine("\tI found the ReportDetail");
|
||||||
|
// this.rowNr ++;
|
||||||
|
RowItem ri = e.Section.Items[0] as RowItem; |
||||||
|
if (ri != null) { |
||||||
|
BaseDataItem r = (BaseDataItem)ri.Items.Find("reportDbTextItem1"); |
||||||
|
|
||||||
|
if (r != null) { |
||||||
|
BaseImageItem image = (BaseImageItem)ri.Items.Find("Image"); |
||||||
|
switch (r.DbValue) { |
||||||
|
case "Information": |
||||||
|
image.Image = this.imageList.Images["Info"]; |
||||||
|
break; |
||||||
|
case "Error": |
||||||
|
image.Image = this.imageList.Images["Error"]; |
||||||
|
break; |
||||||
|
case "Warning" : |
||||||
|
image.Image = this.imageList.Images["Warning"]; |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
break; |
||||||
|
|
||||||
|
case GlobalEnums.enmSection.ReportPageFooter: |
||||||
|
// System.Console.WriteLine("\tI found the PageFooter");
|
||||||
|
break; |
||||||
|
|
||||||
|
case GlobalEnums.enmSection.ReportFooter: |
||||||
|
// System.Console.WriteLine("\tI found the ReportFooter");
|
||||||
|
break; |
||||||
|
|
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void PushPrinted (object sender,SectionRenderEventArgs e) { |
||||||
|
//// System.Console.WriteLine("MainForm:Rendering done for <{0}>",e.CurrentSection);
|
||||||
|
// System.Console.WriteLine("----------");
|
||||||
|
} |
||||||
|
|
||||||
|
void FillImageList() { |
||||||
|
string ns = this.GetType().Namespace; |
||||||
|
System.Console.WriteLine("\t{0}",ns); |
||||||
|
ResourceManager resMan = new ResourceManager(ns + |
||||||
|
".ImageResource", this.GetType().Assembly); |
||||||
|
|
||||||
|
|
||||||
|
this.imageList = new ImageList(); |
||||||
|
Image i = (Image)resMan.GetObject("Error"); |
||||||
|
this.imageList.Images.Add("Error",i); |
||||||
|
|
||||||
|
|
||||||
|
i = (Image)resMan.GetObject("Info"); |
||||||
|
this.imageList.Images.Add("Info",i); |
||||||
|
|
||||||
|
i = (Image)resMan.GetObject("Warning"); |
||||||
|
this.imageList.Images.Add("Warning",i); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 298 B |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 273 B |
Loading…
Reference in new issue