|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
namespace UniverseReport
{
/// <summary>
/// Summary description for frmLoadLayout.
/// </summary>
public class frmLoadLayout : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnShowFileDialog;
private System.Windows.Forms.OpenFileDialog ofd;
private System.Windows.Forms.Button btnLoad;
private System.ComponentModel.Container components = null;
private System.Windows.Forms.TextBox txtPath;
private StarReport sr=null;
public frmLoadLayout()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.btnShowFileDialog = new System.Windows.Forms.Button();
this.ofd = new System.Windows.Forms.OpenFileDialog();
this.btnLoad = new System.Windows.Forms.Button();
this.txtPath = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(184, 23);
this.label1.TabIndex = 1;
this.label1.Text = "Layout File Location:";
//
// btnShowFileDialog
//
this.btnShowFileDialog.Location = new System.Drawing.Point(232, 22);
this.btnShowFileDialog.Name = "btnShowFileDialog";
this.btnShowFileDialog.Size = new System.Drawing.Size(62, 23);
this.btnShowFileDialog.TabIndex = 3;
this.btnShowFileDialog.Text = "Browse...";
this.btnShowFileDialog.Click += new System.EventHandler(this.btnShowFileDialog_Click);
//
// btnLoad
//
this.btnLoad.Location = new System.Drawing.Point(219, 59);
this.btnLoad.Name = "btnLoad";
this.btnLoad.Size = new System.Drawing.Size(75, 23);
this.btnLoad.TabIndex = 4;
this.btnLoad.Text = "Load Layout";
this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
//
// txtPath
//
this.txtPath.Location = new System.Drawing.Point(8, 24);
this.txtPath.Name = "txtPath";
this.txtPath.Size = new System.Drawing.Size(218, 21);
this.txtPath.TabIndex = 5;
//
// frmLoadLayout
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
this.ClientSize = new System.Drawing.Size(304, 94);
this.Controls.Add(this.txtPath);
this.Controls.Add(this.btnLoad);
this.Controls.Add(this.btnShowFileDialog);
this.Controls.Add(this.label1);
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmLoadLayout";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Load Layout";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
public StarReport StarReport
{
set{ sr=value;}
}
private void btnShowFileDialog_Click(object sender, System.EventArgs e)
{
ofd.ShowDialog();
txtPath.Text=ofd.FileName;
}
private void btnLoad_Click(object sender, System.EventArgs e)
{
Stream stream=null;
try
{
stream=File.Open(@txtPath.Text.Trim(),FileMode.Open);
sr.LoadLayout(stream);
stream.Close();
}
catch(Exception ex)
{
MessageBox.Show("ss"+ex.Message);
try
{
Stream errorStream = File.Create(@"C:\StarReportErrorLog.txt");
StreamWriter errorStreamWriter = new StreamWriter(errorStream);
errorStreamWriter .Write(ex.Message+"\n" + (ex.InnerException!=null?ex.InnerException.StackTrace:""));
errorStream.Close();
errorStreamWriter .Close();
}
catch
{
}
}
finally
{
if (stream!=null) stream.Close();
}
this.Close();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Currently pursuing 'Programming Nirvana' (The ineffable ultimate in which one has attained disinterested wisdom and compassion as it relates to programming)
Respected Technologies
1. Confusor (https://confuser.codeplex.com/)
2. Power Threading (http://www.wintellect.com/Resources/visit-the-power-threading-library)
3. EDI Parsers (http://www.rdpcrystal.com)
Acknowledgements:
Microsoft Certified Technologist for WPF and .Net 3.5 (MCTS)
Microsoft Certified Technologist for WCF and .Net 3.5 (MCTS)
Microsoft Certified Application Developer for .Net (MCAD)
Microsoft Certified Systems Engineer (MCSE)
Microsoft Certified Professional (MCP)
Sun Certified Developer for Java 2 Platform (SCD)
Sun Certified Programmer for Java 2 Platform (SCP)
Sun Certified Web Component Developer (SCWCD)
CompTIA A+ Certified Professional
Registered Business School Teacher for Computer Programming and Computer Applications (2004)
(University of the State of New York Education Department)
Graduated from University At Stony Brook