|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CorKat.RegistrySettings;
using Microsoft.Win32;
public partial class _Default : System.Web.UI.Page
{
InternetExplorerExtender iee = new InternetExplorerExtender();
int currentStep;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
initialise();
}
else
{
currentStep = int.Parse(hiddenStep.Value);
}
}
private void initialise()
{
currentStep = 1;
}
private void Next()
{
currentStep += 1;
if (currentStep >= 2)
{
//hit the last step so set up the panels depending on what is selected
DisplayDetailsOptions();
// no more steps so disable the next button and enable the finish
cmdNext.Enabled = false;
cmdFinish.Enabled = CheckValues();
}
cmdPrev.Enabled = true;
MultiView1.ActiveViewIndex = currentStep;
}
private bool CheckValues()
{
//todo: add catch for when a value isnt entered.
return true;
}
private void DisplayDetailsOptions()
{
//hide all panels
pnlButton.Visible = false;
pnlApplication.Visible = false;
pnlTools.Visible = false;
pnlExplorerBar.Visible = false;
if (cboCreationType.Items[0].Selected) //button
{
pnlButton.Visible = true;
pnlApplication.Visible = true;
}
if (cboCreationType.Items[1].Selected) //menu
{
pnlMenu.Visible = true;
pnlApplication.Visible = true;
pnlTools.Visible = true;
}
if (cboCreationType.Items[2].Selected) // explorer bar
{
if (cboCreationType.Items[1].Selected) //menu
pnlApplication.Visible = true;
else
pnlApplication.Visible = false;
pnlMenu.Visible = true;
pnlExplorerBar.Visible = true;
}
}
private void Prev()
{
currentStep -= 1;
if (currentStep <= 0)
{
cmdPrev.Enabled = false;
}
cmdNext.Enabled = true;
MultiView1.ActiveViewIndex = currentStep;
}
protected void cmdPrev_Click(object sender, EventArgs e)
{
int intTemp = currentStep - 1;
hiddenStep.Value = intTemp.ToString();
Prev();
}
protected void cmdNext_Click(object sender, EventArgs e)
{
int intTemp = currentStep + 1;
hiddenStep.Value = intTemp.ToString();
Next();
}
protected void cmdFinish_Click(object sender, EventArgs e)
{
//set class properties
if (cboCreationType.Items[2].Selected) // explorer bar
{
iee.MenuText = txtMenuText.Text;
if (txtDll.PostedFile.FileName != "")
iee.Dll = txtDll.PostedFile.FileName;
if (txtURL.Text != "")
iee.URL = txtURL.Text;
iee.CreateNewExplorerBar();
}
if (cboCreationType.Items[0].Selected) //button
{
// set registry paths
if (cboCreationType.Items[2].Selected) // explorer bar //button for an explorer bar
iee.TypeOfDetail = IEEenums.DetailType.explorerbar;
else
{
iee.TypeOfDetail = IEEenums.DetailType.executable;
iee.ApplicationPath = txtApplication.PostedFile.FileName;
}
//set the registry paths
if (optLocalMachine.Checked)
iee.BaseRegistryKey = Registry.LocalMachine;
else
iee.BaseRegistryKey = Registry.CurrentUser;
iee.ButtonText = txtButtonText.Text;
iee.HotIcon = txtHotIcon.PostedFile.FileName;
iee.Icon = txtIcon.PostedFile.FileName;
// call the registry creation function for a button
iee.CreateRegistryEntry_Button();
}
if (cboCreationType.Items[1].Selected) //menu
{
iee.TypeOfDetail = IEEenums.DetailType.executable;
//set the registry paths
if (optLocalMachine.Checked)
iee.BaseRegistryKey = Registry.LocalMachine;
else
iee.BaseRegistryKey = Registry.CurrentUser;
if (optHelp.Checked)
iee.MenuItem = IEEenums.MenuItem.help;
else
{
// don't need to set to tools as this is the default
}
iee.MenuText = txtMenuText.Text;
iee.ApplicationPath = txtApplication.PostedFile.FileName;
// call the registry creation function for a menu item
iee.CreateRegistryEntry_MenuItem();
}
}
}
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.