if running a Demo (demo CD/DVD) version, version is set to Demo and it will display the demo EULA

Will force a “SAMPLE” watermark when running a Demo version (demo CD/DVD)
if running a Demo (demo CD/DVD) display the demo EULA the first time PROMS is run
gets for ReleaseMode and EULA file names
Disable RO Editor when running a Demo version
This commit is contained in:
John Jenko 2012-06-14 14:21:57 +00:00
parent 46b11369e6
commit 2be97c8cfd
6 changed files with 75 additions and 5 deletions

View File

@ -7,6 +7,7 @@ using System.Reflection;
using Volian.Controls.Library;
using VEPROMS.CSLA.Library;
using System.Text.RegularExpressions;
using Volian.Base.Library;
namespace VEPROMS
{
@ -22,14 +23,16 @@ namespace VEPROMS
// - AssemblyInfo.cs
//"Data Source=.\\SQLEXPRESS;Initial Catalog=VEPROMS_RGE_SAMG_Convert;Integrated Security=True"
DateTime buildDateTime = new System.IO.FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
// If the AssemblyConfiguration is "DEMO" then we are running a Demo version
string demoTxt = VlnSettings.ReleaseMode.Equals("DEMO")?"(Demo)": "";
string connectionString = Database.VEPROMS_Connection;
Match mServer = Regex.Match(connectionString,".*Data Source=([^;]*).*");
string server = (mServer.Success)?mServer.Groups[1].Value:"unknown";
if (server.StartsWith(@".\")) server = @"Local \ " + server.Substring(2);
string databaseName = Database.SelectedDatabase;
this.Text = String.Format("About {0}", AssemblyTitle);
this.Text = String.Format("About {0}", AssemblyTitle + " " + demoTxt);
this.labelProductName.Text = AssemblyProduct;
this.labelVersion.Text = String.Format("Version {0}", AssemblyVersion);
this.labelVersion.Text = String.Format("Version {0}", (demoTxt.Equals(""))? AssemblyVersion : demoTxt);
this.labelVersionDateTime.Text = String.Format("Build Date: {0}", buildDateTime.ToString());
this.labelCopyright.Text = AssemblyCopyright;
this.labelCompanyName.Text = AssemblyCompany;
@ -146,7 +149,8 @@ namespace VEPROMS
private void btnViewEULA_Click(object sender, EventArgs e)
{
string strEULA = System.Environment.CurrentDirectory + "\\EULA.TXT";
string EulaFile = string.Format(@"\{0}", VlnSettings.EULAfile);
string strEULA = System.Environment.CurrentDirectory + EulaFile;
frmViewTextFile ViewFile = new frmViewTextFile(strEULA,RichTextBoxStreamType.PlainText);
ViewFile.Text = "End-User License Agreement";
ViewFile.ShowDialog();

View File

@ -7,6 +7,7 @@ using System.Text;
using System.Windows.Forms;
using Volian.Print.Library;
using VEPROMS.CSLA.Library;
using Volian.Base.Library;
namespace VEPROMS
{
@ -45,7 +46,9 @@ namespace VEPROMS
{
OpenPDF = openPDF;
InitializeComponent();
MyPromsPrinter = new PromsPrinter(myItem, rev, revDate, watermark, debugOutput, origPgBrk, pdfPath + @"\\Compare", false, overWrite, cbd, pdfFile);//openPDF);
// if the version number of PROMS is 1.0, then we are running a Demo version.
// When running a Demo version, force a "Sample" watermark when printing.
MyPromsPrinter = new PromsPrinter(myItem, rev, revDate, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\\Compare", false, overWrite, cbd, pdfFile);//openPDF);
PDFPath = pdfPath;
this.Text = "Creating PDF of " + myItem.DisplayNumber;
_NewLocation = newLocation;

View File

@ -463,7 +463,8 @@ namespace VEPROMS
}
private DialogResult ShowEULA()
{
string strEULA = System.Environment.CurrentDirectory + "\\EULA.TXT";
string eulaFile = string.Format(@"\{0}", VlnSettings.EULAfile);
string strEULA = System.Environment.CurrentDirectory + eulaFile;
frmViewTextFile ViewFile = new frmViewTextFile(strEULA, RichTextBoxStreamType.PlainText);
ViewFile.Text = "End-User License Agreement";
ViewFile.ButtonText = "Agree";

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Configuration;
using System.Reflection;
namespace Volian.Base.Library
{
@ -114,5 +115,45 @@ namespace Volian.Base.Library
get { return VlnSettings._StepTypeToolTip; }
set { VlnSettings._StepTypeToolTip = value; }
}
private static string _ReleaseMode = null;
public static string ReleaseMode
{
get
{
if (_ReleaseMode == null)
{
string relType = "RELEASE"; // default to normal Release Mode setting
// Get the type of release:
// "Demo", "Westinghouse", "Release"
object[] attributes = Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false);
if (attributes.Length > 0)
relType = ((AssemblyConfigurationAttribute)attributes[0]).Configuration.ToUpper();
_ReleaseMode = relType;
}
return _ReleaseMode;
}
}
private static string _EULAfile = null;
public static string EULAfile
{
get {
if (_EULAfile == null)
{
switch (ReleaseMode)
{
case "DEMO": // Demo CD/DVD release
_EULAfile = "DemoEULA.txt";
break;
case "WESTINGHOUSE":
_EULAfile = "WestinghouseEULA.txt";
break;
default:
_EULAfile = "EULA.txt";
break;
}
}
return _EULAfile;
}
}
}
}

View File

@ -740,6 +740,11 @@ namespace Volian.Controls.Library
private void lbROId_DoubleClick(object sender, EventArgs e)
{
if (tvROFST.SelectedNode == null) return;
if (VlnSettings.ReleaseMode.Equals("DEMO"))
{
MessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version");
return;
}
string roapp = Environment.GetEnvironmentVariable("roapp");
Object obj = tvROFST.SelectedNode.Tag;
if (obj is ROFSTLookup.rochild)
@ -769,6 +774,11 @@ namespace Volian.Controls.Library
private void RunRoEditor()
{
if (VlnSettings.ReleaseMode.Equals("DEMO"))
{
MessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version");
return;
}
string roapp = Environment.GetEnvironmentVariable("roapp");
Object obj = tvROFST.SelectedNode.Tag;
if (obj is ROFSTLookup.rochild)

View File

@ -9,6 +9,7 @@ using System.IO;
using System.Text.RegularExpressions;
using VEPROMS.CSLA.Library;
using Accentra.Controls;
using Volian.Base.Library;
namespace Volian.Controls.Library
{
@ -1240,6 +1241,11 @@ namespace Volian.Controls.Library
}
else
{
if (VlnSettings.ReleaseMode.Equals("DEMO"))
{
MessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version");
return;
}
string myROID;
RODbInfo myRODB;
if (MyFlexGrid != null && MyFlexGrid.IsRoTable)
@ -1326,6 +1332,11 @@ namespace Volian.Controls.Library
private void btnROEdit_Click(object sender, EventArgs e)
{
if (VlnSettings.ReleaseMode.Equals("DEMO"))
{
MessageBox.Show("Referenced Object Editor not available in the Demo version.", "PROMS Demo Version");
return;
}
string roapp = Environment.GetEnvironmentVariable("roapp");
if (roapp == null)
{