Skip to content

Commit

Permalink
update examples to 5.0.3-alpha
Browse files Browse the repository at this point in the history
Updated `Directory.Packages.props` to change `Majorsilence.Reporting` packages from `5.0.1-alpha` to `5.0.3-alpha`. Refactored `Form1` to improve asynchronous handling and dynamic path usage. Removed `SourceFile` property from `RdlViewer1` and updated `ButtonReloadReport` text. Improved initialization of controls in `Form1.Designer.cs`. Reformatted XML comments in `Form1.resx` for better readability. Changed `DataProvider` in `SampleApp2-TestReport.rdl` to `Microsoft.Data.Sqlite` and added a new package reference in `HyperLinkExample.csproj`.
  • Loading branch information
majorsilence committed Feb 8, 2025
1 parent 3d203b0 commit 500d335
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 138 deletions.
10 changes: 4 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
<PackageVersion Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageVersion Include="dotConnect.Express.for.PostgreSQL" Version="8.3.10" />
<PackageVersion Include="iTextSharp.LGPLv2.Core" Version="3.4.18" />
<PackageVersion Include="MajorsilenceReporting-Core" Version="5.0.1-alpha" />
<PackageVersion Include="MajorsilenceReporting-Viewer" Version="5.0.1-alpha" />
<PackageVersion Include="Majorsilence.Reporting.RdlViewer" Version="5.0.1-alpha" />
<PackageVersion Include="Majorsilence.Reporting.RdlEngine" Version="5.0.1-alpha" />
<PackageVersion Include="Majorsilence.Reporting.RdlCri" Version="5.0.1-alpha" />
<PackageVersion Include="Majorsilence.Reporting.ReportDesigner" Version="5.0.1-alpha" />
<PackageVersion Include="Majorsilence.Reporting.RdlViewer" Version="5.0.3-alpha" />
<PackageVersion Include="Majorsilence.Reporting.RdlEngine" Version="5.0.3-alpha" />
<PackageVersion Include="Majorsilence.Reporting.RdlCri" Version="5.0.3-alpha" />
<PackageVersion Include="Majorsilence.Reporting.ReportDesigner" Version="5.0.3-alpha" />
<PackageVersion Include="Microsoft.Data.Edm" Version="5.8.5" />
<PackageVersion Include="Microsoft.Data.OData" Version="5.8.5" />
<PackageVersion Include="Microsoft.Data.Services.Client" Version="5.8.5" />
Expand Down
1 change: 0 additions & 1 deletion Examples/SampleApp/SampleReportApp/Form1.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Examples/SampleApp/SampleReportApp/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

End Sub

Private Sub ButtonReloadReport_Click(sender As Object, e As EventArgs) Handles ButtonReloadReport.Click
RdlViewer1.SourceFile = New Uri(file)
Private Async Sub ButtonReloadReport_Click(sender As Object, e As EventArgs) Handles ButtonReloadReport.Click
Await RdlViewer1.SetSourceFile(New Uri(file))
RdlViewer1.Parameters = "ConnectionString=" & TextBox1.Text
RdlViewer1.Rebuild()
Await RdlViewer1.Rebuild()
End Sub


Expand Down
61 changes: 9 additions & 52 deletions Examples/SampleApp2-SetData/SampleApp2-SetData/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 18 additions & 13 deletions Examples/SampleApp2-SetData/SampleApp2-SetData/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using Microsoft.Data.Sqlite;

namespace SampleApp2_SetData
Expand All @@ -17,26 +16,32 @@ public partial class Form1 : Form
public Form1()
{
InitializeComponent();
rdlViewer1 = new fyiReporting.RdlViewer.RdlViewer();
rdlViewer1.Dock = DockStyle.Fill;
this.Controls.Add(rdlViewer1);
}

private async void Form1_Load(object sender, EventArgs e)
{
// TODO: You must change this connection string to match where your database is
string connectionString = @"Data Source=C:\Users\Peter\Projects\My-FyiReporting\Examples\northwindEF.db;Version=3;Pooling=True;Max Pool Size=100;";
SqliteConnection cn = new SqliteConnection(connectionString);
SqliteCommand cmd = new SqliteCommand();
string sqlFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\", @"..\", @"..\", @"..\", @"..\", "northwindEF.db");
string connectionString = $"Data Source={sqlFile}";

using SqliteConnection cn = new SqliteConnection(connectionString);
using SqliteCommand cmd = new SqliteCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT CategoryID, CategoryName, Description FROM Categories;";
cmd.Connection = cn;
DataTable dt = GetTable(cmd);

DataTable dt = await GetTable(cmd);

string filepath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory() , "SampleApp2-TestReport.rdl");
rdlViewer1.SourceFile = new Uri(filepath);
rdlViewer1.Report.DataSets["Data"].SetData(dt);
//rdlViewer1.Report.DataSets["Data"].SetSource("SELECT CategoryID, CategoryName, Description FROM Categories where CategoryName = 'SeaFood'");
rdlViewer1.Rebuild();
string filepath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SampleApp2-TestReport.rdl");
await rdlViewer1.SetSourceFile(new Uri(filepath));
await (await rdlViewer1.Report()).DataSets["Data"].SetData(dt);
await rdlViewer1.Rebuild();
}


public DataTable GetTable(SqliteCommand cmd)
public async Task<DataTable> GetTable(SqliteCommand cmd)
{
System.Data.ConnectionState original = cmd.Connection.State;
if (cmd.Connection.State == ConnectionState.Closed)
Expand All @@ -47,7 +52,7 @@ public DataTable GetTable(SqliteCommand cmd)
DataTable dt = new DataTable();
SqliteDataReader dr;

dr = cmd.ExecuteReader();
dr = await cmd.ExecuteReaderAsync();
dt.Load(dr);
dr.Close();
dr.Dispose();
Expand Down
54 changes: 27 additions & 27 deletions Examples/SampleApp2-SetData/SampleApp2-SetData/Form1.resx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
Expand All @@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<DataSources>
<DataSource Name="DS1">
<ConnectionProperties>
<DataProvider>SQLite</DataProvider>
<ConnectString>Data Source=C:\Path\Does\Not\Exist\northwindEF.db;Version=3;Pooling=True;Max Pool Size=100;</ConnectString>
<DataProvider>Microsoft.Data.Sqlite</DataProvider>
<ConnectString>Data Source=C:\Path\Does\Not\Exist\northwindEF.db</ConnectString>
</ConnectionProperties>
</DataSource>
</DataSources>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 11 additions & 5 deletions Examples/SampleAppHyperLinkCustomAction/HyperLinkExample/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
Expand All @@ -12,18 +13,23 @@ namespace HyperLinkExample
{
public partial class Form1 : Form
{

private string file = @"C:\Users\Peter\Projects\My-FyiReporting\Examples\SqliteExamples\SimpleTest1.rdl";
private string file = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
@"..\", @"..\", @"..\", @"..\", @"..\", @"SqliteExamples\SimpleTest1.rdl");

public Form1()
{
InitializeComponent();
}

private void ButtonReloadReport_Click(object sender, EventArgs e)
private async void ButtonReloadReport_Click(object sender, EventArgs e)
{
await LoadReport();
}

private async Task LoadReport()
{
rdlViewer1.SourceFile = new Uri(file);
rdlViewer1.Rebuild();
await rdlViewer1.SetSourceFile(new Uri(file));
await rdlViewer1.Rebuild();
}

private void rdlViewer1_Hyperlink(object source, fyiReporting.RdlViewer.HyperlinkEventArgs e)
Expand Down
Loading

0 comments on commit 500d335

Please sign in to comment.