Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/reports@5793 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
32 changed files with 1248 additions and 136 deletions
@ -1,62 +0,0 @@ |
|||||||
/* |
|
||||||
* Erstellt mit SharpDevelop. |
|
||||||
* Benutzer: Peter Forstmeier |
|
||||||
* Datum: 15.10.2007 |
|
||||||
* Zeit: 11:26 |
|
||||||
* |
|
||||||
* Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern. |
|
||||||
*/ |
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.ComponentModel.Design; |
|
||||||
using System.Windows.Forms; |
|
||||||
using System.Windows.Forms.Design; |
|
||||||
using ICSharpCode.SharpDevelop.Commands; |
|
||||||
using ICSharpCode.Core; |
|
||||||
using ICSharpCode.SharpDevelop; |
|
||||||
using ICSharpCode.SharpDevelop.Gui; |
|
||||||
|
|
||||||
namespace ICSharpCode.Reports.Addin.Commands |
|
||||||
{ |
|
||||||
public class Cut : AbstractClipboardCommand |
|
||||||
{ |
|
||||||
protected override bool GetEnabled(IClipboardHandler editable) { |
|
||||||
return editable.EnableCut; |
|
||||||
} |
|
||||||
protected override void Run(IClipboardHandler editable) { |
|
||||||
editable.Cut(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public class Copy : AbstractClipboardCommand |
|
||||||
{ |
|
||||||
protected override bool GetEnabled(IClipboardHandler editable) { |
|
||||||
return editable.EnableCopy; |
|
||||||
} |
|
||||||
protected override void Run(IClipboardHandler editable) { |
|
||||||
editable.Copy(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public class Delete : AbstractClipboardCommand |
|
||||||
{ |
|
||||||
protected override bool GetEnabled(IClipboardHandler editable) { |
|
||||||
return editable.EnableDelete; |
|
||||||
} |
|
||||||
protected override void Run(IClipboardHandler editable) { |
|
||||||
editable.Delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public class Paste : AbstractClipboardCommand |
|
||||||
{ |
|
||||||
protected override bool GetEnabled(IClipboardHandler editable) { |
|
||||||
return editable.EnablePaste; |
|
||||||
} |
|
||||||
protected override void Run(IClipboardHandler editable) { |
|
||||||
editable.Paste(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
@ -0,0 +1,238 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Gui.XmlForms; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
public class AbstractOptionPanel : BaseSharpDevelopUserControl, IDialogPanel |
||||||
|
{ |
||||||
|
bool wasActivated = false; |
||||||
|
bool isFinished = true; |
||||||
|
object customizationObject; |
||||||
|
|
||||||
|
public Control Control { |
||||||
|
get { |
||||||
|
return this; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool WasActivated { |
||||||
|
get { |
||||||
|
return wasActivated; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public object CustomizationObject { |
||||||
|
get { |
||||||
|
return customizationObject; |
||||||
|
} |
||||||
|
set { |
||||||
|
customizationObject = value; |
||||||
|
OnCustomizationObjectChanged(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public virtual bool EnableFinish { |
||||||
|
get { |
||||||
|
return isFinished; |
||||||
|
} |
||||||
|
set { |
||||||
|
if (isFinished != value) { |
||||||
|
isFinished = value; |
||||||
|
OnEnableFinishChanged(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// public AbstractOptionPanel(string fileName) : base(fileName)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
public AbstractOptionPanel() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public virtual bool ReceiveDialogMessage(DialogMessage message) |
||||||
|
{ |
||||||
|
switch (message) { |
||||||
|
case DialogMessage.Activated: |
||||||
|
if (!wasActivated) { |
||||||
|
LoadPanelContents(); |
||||||
|
wasActivated = true; |
||||||
|
} |
||||||
|
break; |
||||||
|
case DialogMessage.OK: |
||||||
|
if (wasActivated) { |
||||||
|
return StorePanelContents(); |
||||||
|
} |
||||||
|
break; |
||||||
|
} |
||||||
|
|
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
public virtual void LoadPanelContents() |
||||||
|
{ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public virtual bool StorePanelContents() |
||||||
|
{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
protected string baseDirectory; |
||||||
|
|
||||||
|
protected void ConnectBrowseButton(string browseButton, string target, string fileFilter, TextBoxEditMode textBoxEditMode) |
||||||
|
{ |
||||||
|
if (ControlDictionary[browseButton] == null) { |
||||||
|
|
||||||
|
MessageService.ShowError(browseButton + " not found!"); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (ControlDictionary[target] == null) { |
||||||
|
MessageService.ShowError(target + " not found!"); |
||||||
|
return; |
||||||
|
} |
||||||
|
ControlDictionary[browseButton].Click += new EventHandler(new BrowseButtonEvent(this, ControlDictionary[target], fileFilter, textBoxEditMode).Event); |
||||||
|
} |
||||||
|
|
||||||
|
protected void ConnectBrowseFolder(string browseButton, string target, TextBoxEditMode textBoxEditMode) |
||||||
|
{ |
||||||
|
ConnectBrowseFolder(browseButton, target, "${res:Dialog.ProjectOptions.SelectFolderTitle}", textBoxEditMode); |
||||||
|
} |
||||||
|
protected void ConnectBrowseFolder(string browseButton, string target, string description, TextBoxEditMode textBoxEditMode) |
||||||
|
{ |
||||||
|
if (ControlDictionary[browseButton] == null) { |
||||||
|
MessageService.ShowError(browseButton + " not found!"); |
||||||
|
return; |
||||||
|
} |
||||||
|
if (ControlDictionary[target] == null) { |
||||||
|
MessageService.ShowError(target + " not found!"); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
ControlDictionary[browseButton].Click += new EventHandler(new BrowseFolderEvent(this, target, description, textBoxEditMode).Event); |
||||||
|
} |
||||||
|
protected void BrowseForFile(Control target, string filter, TextBoxEditMode textBoxEditMode) |
||||||
|
{ |
||||||
|
if (target == null) { |
||||||
|
throw new ArgumentNullException("target"); |
||||||
|
} |
||||||
|
new BrowseButtonEvent(this, target, filter, textBoxEditMode).Event(null, null); |
||||||
|
} |
||||||
|
|
||||||
|
sealed class BrowseButtonEvent |
||||||
|
{ |
||||||
|
AbstractOptionPanel panel; |
||||||
|
Control target; |
||||||
|
string filter; |
||||||
|
TextBoxEditMode textBoxEditMode; |
||||||
|
|
||||||
|
public BrowseButtonEvent(AbstractOptionPanel panel, Control target, string filter, TextBoxEditMode textBoxEditMode) |
||||||
|
{ |
||||||
|
this.panel = panel; |
||||||
|
this.filter = filter; |
||||||
|
this.target = target; |
||||||
|
this.textBoxEditMode = textBoxEditMode; |
||||||
|
} |
||||||
|
|
||||||
|
public void Event(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
using (OpenFileDialog fdiag = new OpenFileDialog()) { |
||||||
|
fdiag.Filter = StringParser.Parse(filter); |
||||||
|
fdiag.Multiselect = false; |
||||||
|
try { |
||||||
|
string initialDir = System.IO.Path.GetDirectoryName(System.IO.Path.Combine(panel.baseDirectory, target.Text)); |
||||||
|
if (FileUtility.IsValidPath(initialDir) && System.IO.Directory.Exists(initialDir)) { |
||||||
|
fdiag.InitialDirectory = initialDir; |
||||||
|
} |
||||||
|
} catch {} |
||||||
|
if(fdiag.ShowDialog() == DialogResult.OK) { |
||||||
|
string file = fdiag.FileName; |
||||||
|
if (panel.baseDirectory != null) { |
||||||
|
file = FileUtility.GetRelativePath(panel.baseDirectory, file); |
||||||
|
} |
||||||
|
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) { |
||||||
|
target.Text = file; |
||||||
|
} else { |
||||||
|
target.Text = MSBuildInternals.Escape(file); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
sealed class BrowseFolderEvent |
||||||
|
{ |
||||||
|
AbstractOptionPanel panel; |
||||||
|
string target; |
||||||
|
string description; |
||||||
|
TextBoxEditMode textBoxEditMode; |
||||||
|
|
||||||
|
internal BrowseFolderEvent(AbstractOptionPanel panel, string target, string description, TextBoxEditMode textBoxEditMode) |
||||||
|
{ |
||||||
|
this.panel = panel; |
||||||
|
this.description = description; |
||||||
|
this.target = target; |
||||||
|
this.textBoxEditMode = textBoxEditMode; |
||||||
|
} |
||||||
|
|
||||||
|
public void Event(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
string startLocation = panel.baseDirectory; |
||||||
|
if (startLocation != null) { |
||||||
|
string text = panel.ControlDictionary[target].Text; |
||||||
|
if (textBoxEditMode == TextBoxEditMode.EditRawProperty) |
||||||
|
text = MSBuildInternals.Unescape(text); |
||||||
|
startLocation = FileUtility.GetAbsolutePath(startLocation, text); |
||||||
|
} |
||||||
|
|
||||||
|
using (FolderBrowserDialog fdiag = FileService.CreateFolderBrowserDialog(description, startLocation)) { |
||||||
|
if (fdiag.ShowDialog() == DialogResult.OK) { |
||||||
|
string path = fdiag.SelectedPath; |
||||||
|
if (panel.baseDirectory != null) { |
||||||
|
path = FileUtility.GetRelativePath(panel.baseDirectory, path); |
||||||
|
} |
||||||
|
if (!path.EndsWith("\\") && !path.EndsWith("/")) |
||||||
|
path += "\\"; |
||||||
|
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) { |
||||||
|
panel.ControlDictionary[target].Text = path; |
||||||
|
} else { |
||||||
|
panel.ControlDictionary[target].Text = MSBuildInternals.Escape(path); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected virtual void OnEnableFinishChanged() |
||||||
|
{ |
||||||
|
if (EnableFinishChanged != null) { |
||||||
|
EnableFinishChanged(this, null); |
||||||
|
} |
||||||
|
} |
||||||
|
protected virtual void OnCustomizationObjectChanged() |
||||||
|
{ |
||||||
|
if (CustomizationObjectChanged != null) { |
||||||
|
CustomizationObjectChanged(this, null); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public event EventHandler CustomizationObjectChanged; |
||||||
|
public event EventHandler EnableFinishChanged; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,140 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
public abstract class AbstractWizardPanel : AbstractOptionPanel, IWizardPanel |
||||||
|
{ |
||||||
|
string nextWizardPanelID = String.Empty; |
||||||
|
bool enablePrevious = true; |
||||||
|
bool enableNext = true; |
||||||
|
bool isLastPanel = false; |
||||||
|
bool enableCancel = true; |
||||||
|
|
||||||
|
public string NextWizardPanelID { |
||||||
|
get { |
||||||
|
return nextWizardPanelID; |
||||||
|
} |
||||||
|
set { |
||||||
|
if (nextWizardPanelID != value) { |
||||||
|
nextWizardPanelID = value; |
||||||
|
OnNextWizardPanelIDChanged(EventArgs.Empty); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsLastPanel { |
||||||
|
get { |
||||||
|
return isLastPanel; |
||||||
|
} |
||||||
|
set { |
||||||
|
if (isLastPanel != value) { |
||||||
|
isLastPanel = value; |
||||||
|
OnIsLastPanelChanged(EventArgs.Empty); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool EnableNext { |
||||||
|
get { |
||||||
|
return enableNext; |
||||||
|
} |
||||||
|
set { |
||||||
|
if (enableNext != value) { |
||||||
|
enableNext = value; |
||||||
|
OnEnableNextChanged(EventArgs.Empty); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool EnablePrevious { |
||||||
|
get { |
||||||
|
return enablePrevious; |
||||||
|
} |
||||||
|
set { |
||||||
|
if (enablePrevious != value) { |
||||||
|
enablePrevious = value; |
||||||
|
OnEnablePreviousChanged(EventArgs.Empty); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool EnableCancel { |
||||||
|
get { |
||||||
|
return enableCancel; |
||||||
|
} |
||||||
|
set { |
||||||
|
if (enableCancel != value) { |
||||||
|
enableCancel = value; |
||||||
|
OnEnableCancelChanged(EventArgs.Empty); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
// public AbstractWizardPanel(string fileName) : base(fileName)
|
||||||
|
// {
|
||||||
|
// }
|
||||||
|
|
||||||
|
public AbstractWizardPanel() : base() |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void FinishPanel() |
||||||
|
{ |
||||||
|
if (FinishPanelRequested != null) { |
||||||
|
FinishPanelRequested(this, EventArgs.Empty); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnEnableNextChanged(EventArgs e) |
||||||
|
{ |
||||||
|
if (EnableNextChanged != null) { |
||||||
|
EnableNextChanged(this, e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnEnablePreviousChanged(EventArgs e) |
||||||
|
{ |
||||||
|
if (EnablePreviousChanged != null) { |
||||||
|
EnablePreviousChanged(this, e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnEnableCancelChanged(EventArgs e) |
||||||
|
{ |
||||||
|
if (EnableCancelChanged != null) { |
||||||
|
EnableCancelChanged(this, e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected virtual void OnNextWizardPanelIDChanged(EventArgs e) |
||||||
|
{ |
||||||
|
if (NextWizardPanelIDChanged != null) { |
||||||
|
NextWizardPanelIDChanged(this, e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected virtual void OnIsLastPanelChanged(EventArgs e) |
||||||
|
{ |
||||||
|
if (IsLastPanelChanged != null) { |
||||||
|
IsLastPanelChanged(this, e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public event EventHandler EnablePreviousChanged; |
||||||
|
public event EventHandler EnableNextChanged; |
||||||
|
public event EventHandler EnableCancelChanged; |
||||||
|
|
||||||
|
public event EventHandler NextWizardPanelIDChanged; |
||||||
|
public event EventHandler IsLastPanelChanged; |
||||||
|
|
||||||
|
public event EventHandler FinishPanelRequested; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,59 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
using System.Drawing.Drawing2D; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
using ICSharpCode.Core.WinForms; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
public class CurrentPanelPanel : UserControl |
||||||
|
{ |
||||||
|
WizardDialog wizard; |
||||||
|
|
||||||
|
Font normalFont; |
||||||
|
|
||||||
|
|
||||||
|
public CurrentPanelPanel(WizardDialog wizard) |
||||||
|
{ |
||||||
|
normalFont = WinFormsResourceService.LoadFont("SansSerif", 18, GraphicsUnit.World); |
||||||
|
|
||||||
|
this.wizard = wizard; |
||||||
|
Size = new Size(wizard.Width - 220, 30); |
||||||
|
ResizeRedraw = false; |
||||||
|
|
||||||
|
SetStyle(ControlStyles.UserPaint, true); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnPaintBackground(PaintEventArgs pe) |
||||||
|
{ |
||||||
|
// base.OnPaintBackground(pe);
|
||||||
|
Graphics g = pe.Graphics; |
||||||
|
// g.FillRectangle(new SolidBrush(SystemColors.Control), pe.ClipRectangle);
|
||||||
|
|
||||||
|
using (Brush brush = new LinearGradientBrush(new Point(0, 0), new Point(Width, Height), |
||||||
|
Color.White, |
||||||
|
SystemColors.Control)) { |
||||||
|
g.FillRectangle(brush, new Rectangle(0, 0, Width, Height)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnPaint(PaintEventArgs pe) |
||||||
|
{ |
||||||
|
// base.OnPaint(pe);
|
||||||
|
Graphics g = pe.Graphics; |
||||||
|
g.DrawString(((IDialogPanelDescriptor)wizard.WizardPanels[wizard.ActivePanelNumber]).Label, normalFont, Brushes.Black, |
||||||
|
10, |
||||||
|
24 - normalFont.Height, |
||||||
|
StringFormat.GenericTypographic); |
||||||
|
g.DrawLine(Pens.Black, 10, 24, Width - 10, 24); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,78 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
public class DefaultDialogPanelDescriptor : IDialogPanelDescriptor |
||||||
|
{ |
||||||
|
string id = String.Empty; |
||||||
|
string label = String.Empty; |
||||||
|
List<IDialogPanelDescriptor> dialogPanelDescriptors = null; |
||||||
|
IDialogPanel dialogPanel = null; |
||||||
|
|
||||||
|
public string ID { |
||||||
|
get { |
||||||
|
return id; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string Label { |
||||||
|
get { |
||||||
|
return label; |
||||||
|
} |
||||||
|
set { |
||||||
|
label = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public IEnumerable<IDialogPanelDescriptor> ChildDialogPanelDescriptors { |
||||||
|
get { |
||||||
|
return dialogPanelDescriptors; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
AddIn addin; |
||||||
|
string dialogPanelPath; |
||||||
|
|
||||||
|
public IDialogPanel DialogPanel { |
||||||
|
get { |
||||||
|
if (dialogPanelPath != null) { |
||||||
|
if (dialogPanel == null) { |
||||||
|
dialogPanel = (IDialogPanel)addin.CreateObject(dialogPanelPath); |
||||||
|
} |
||||||
|
dialogPanelPath = null; |
||||||
|
addin = null; |
||||||
|
} |
||||||
|
return dialogPanel; |
||||||
|
} |
||||||
|
set { |
||||||
|
dialogPanel = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public DefaultDialogPanelDescriptor(string id, string label) |
||||||
|
{ |
||||||
|
this.id = id; |
||||||
|
this.label = label; |
||||||
|
} |
||||||
|
|
||||||
|
public DefaultDialogPanelDescriptor(string id, string label, List<IDialogPanelDescriptor> dialogPanelDescriptors) : this(id, label) |
||||||
|
{ |
||||||
|
this.dialogPanelDescriptors = dialogPanelDescriptors; |
||||||
|
} |
||||||
|
|
||||||
|
public DefaultDialogPanelDescriptor(string id, string label, AddIn addin, string dialogPanelPath) : this(id, label) |
||||||
|
{ |
||||||
|
this.addin = addin; |
||||||
|
this.dialogPanelPath = dialogPanelPath; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,68 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Creates DefaultDialogPanelDescriptor objects that are used in option dialogs.
|
||||||
|
/// </summary>
|
||||||
|
/// <attribute name="class">
|
||||||
|
/// Name of the IDialogPanel class. Optional if the page has subpages.
|
||||||
|
/// </attribute>
|
||||||
|
/// <attribute name="label" use="required">
|
||||||
|
/// Caption of the dialog panel.
|
||||||
|
/// </attribute>
|
||||||
|
/// <children childTypes="DialogPanel">
|
||||||
|
/// In the SharpDevelop options, option pages can have subpages by specifying them
|
||||||
|
/// as children in the AddInTree.
|
||||||
|
/// </children>
|
||||||
|
/// <returns>
|
||||||
|
/// A DefaultDialogPanelDescriptor object.
|
||||||
|
/// </returns>
|
||||||
|
public class DialogPanelDoozer : IDoozer |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Gets if the doozer handles codon conditions on its own.
|
||||||
|
/// If this property return false, the item is excluded when the condition is not met.
|
||||||
|
/// </summary>
|
||||||
|
public bool HandleConditions { |
||||||
|
get { |
||||||
|
return false; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an item with the specified sub items. And the current
|
||||||
|
/// Condition status for this item.
|
||||||
|
/// </summary>
|
||||||
|
public object BuildItem(object caller, Codon codon, ArrayList subItems) |
||||||
|
{ |
||||||
|
string label = codon.Properties["label"]; |
||||||
|
|
||||||
|
if (subItems == null || subItems.Count == 0) { |
||||||
|
if (codon.Properties.Contains("class")) { |
||||||
|
return new DefaultDialogPanelDescriptor(codon.Id, StringParser.Parse(label), codon.AddIn, codon.Properties["class"]); |
||||||
|
} else { |
||||||
|
return new DefaultDialogPanelDescriptor(codon.Id, StringParser.Parse(label)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
List<IDialogPanelDescriptor> newList = new List<IDialogPanelDescriptor>(); |
||||||
|
foreach (IDialogPanelDescriptor d in subItems) { |
||||||
|
newList.Add(d); |
||||||
|
} |
||||||
|
|
||||||
|
return new DefaultDialogPanelDescriptor(codon.Id, StringParser.Parse(label), newList); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,50 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
public enum DialogMessage { |
||||||
|
OK, |
||||||
|
Cancel, |
||||||
|
Help, |
||||||
|
Next, |
||||||
|
Prev, |
||||||
|
Finish, |
||||||
|
Activated |
||||||
|
} |
||||||
|
|
||||||
|
public interface IDialogPanel |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Some panels do get an object which they can customize, like
|
||||||
|
/// Wizard Dialogs. Check the dialog description for more details
|
||||||
|
/// about this.
|
||||||
|
/// </summary>
|
||||||
|
object CustomizationObject { |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
Control Control { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
bool EnableFinish { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
/// <returns>
|
||||||
|
/// true, if the DialogMessage could be executed.
|
||||||
|
/// </returns>
|
||||||
|
bool ReceiveDialogMessage(DialogMessage message); |
||||||
|
|
||||||
|
event EventHandler EnableFinishChanged; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
public interface IDialogPanelDescriptor |
||||||
|
{ |
||||||
|
/// <value>
|
||||||
|
/// Returns the ID of the dialog panel codon
|
||||||
|
/// </value>
|
||||||
|
string ID { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// Returns the label of the dialog panel
|
||||||
|
/// </value>
|
||||||
|
string Label { |
||||||
|
get; |
||||||
|
set; |
||||||
|
} |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The child dialog panels (e.g. for treeviews)
|
||||||
|
/// </summary>
|
||||||
|
IEnumerable<IDialogPanelDescriptor> ChildDialogPanelDescriptors { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// Returns the dialog panel object
|
||||||
|
/// </value>
|
||||||
|
IDialogPanel DialogPanel { |
||||||
|
get; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,89 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// This interface extends the IDialogPanel interface with wizard specific
|
||||||
|
/// funcitons.
|
||||||
|
/// </summary>
|
||||||
|
public interface IWizardPanel : IDialogPanel |
||||||
|
{ |
||||||
|
/// <remarks>
|
||||||
|
/// This is used for wizards which has more than one path, this
|
||||||
|
/// may be null for a standard wizard.
|
||||||
|
/// </remarks>
|
||||||
|
/// <value>The ID of the panel that follows this panel</value>
|
||||||
|
string NextWizardPanelID { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// true, if this panel has no successor and is the last panel in it's path.
|
||||||
|
/// This is only used for wizard that have no linear endings.
|
||||||
|
/// </value>
|
||||||
|
bool IsLastPanel { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// If true, the user can access the next panel.
|
||||||
|
/// </value>
|
||||||
|
bool EnableNext { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// If true, the user can access the previous panel.
|
||||||
|
/// </value>
|
||||||
|
bool EnablePrevious { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
/// <value>
|
||||||
|
/// If true, the user can cancel the wizard
|
||||||
|
/// </value>
|
||||||
|
bool EnableCancel { |
||||||
|
get; |
||||||
|
} |
||||||
|
|
||||||
|
/// <remarks>
|
||||||
|
/// Is fired when the EnableNext property has changed.
|
||||||
|
/// </remarks>
|
||||||
|
event EventHandler EnableNextChanged; |
||||||
|
|
||||||
|
/// <remarks>
|
||||||
|
/// Is fired when the NextWizardPanelID property has changed.
|
||||||
|
/// </remarks>
|
||||||
|
event EventHandler NextWizardPanelIDChanged; |
||||||
|
|
||||||
|
/// <remarks>
|
||||||
|
/// Is fired when the IsLastPanel property has changed.
|
||||||
|
/// </remarks>
|
||||||
|
event EventHandler IsLastPanelChanged; |
||||||
|
|
||||||
|
/// <remarks>
|
||||||
|
/// Is fired when the EnablePrevious property has changed.
|
||||||
|
/// </remarks>
|
||||||
|
event EventHandler EnablePreviousChanged; |
||||||
|
|
||||||
|
/// <remarks>
|
||||||
|
/// Is fired when the EnableCancel property has changed.
|
||||||
|
/// </remarks>
|
||||||
|
event EventHandler EnableCancelChanged; |
||||||
|
|
||||||
|
/// <remarks>
|
||||||
|
/// Is fired when the panel wants that the wizard goes over
|
||||||
|
/// to the next panel. This event overrides the EnableNext
|
||||||
|
/// property. (You can move over to the next with EnableNext
|
||||||
|
/// == false)
|
||||||
|
/// </remarks>
|
||||||
|
event EventHandler FinishPanelRequested; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,63 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Drawing; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.Core.WinForms; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
public class StatusPanel : UserControl |
||||||
|
{ |
||||||
|
WizardDialog wizard; |
||||||
|
|
||||||
|
Font smallFont; |
||||||
|
Font normalFont; |
||||||
|
Font boldFont; |
||||||
|
|
||||||
|
public StatusPanel(WizardDialog wizard) |
||||||
|
{ |
||||||
|
smallFont = WinFormsResourceService.LoadFont("Tahoma", 14, GraphicsUnit.World); |
||||||
|
normalFont = WinFormsResourceService.LoadFont("Tahoma", 14, GraphicsUnit.World); |
||||||
|
boldFont = WinFormsResourceService.LoadFont("Tahoma", 14, FontStyle.Bold, GraphicsUnit.World); |
||||||
|
|
||||||
|
this.wizard = wizard; |
||||||
|
this.BackgroundImage = WinFormsResourceService.GetBitmap("GeneralWizardBackground"); |
||||||
|
Size = new Size(198, 400); |
||||||
|
ResizeRedraw = false; |
||||||
|
|
||||||
|
SetStyle(ControlStyles.UserPaint, true); |
||||||
|
SetStyle(ControlStyles.OptimizedDoubleBuffer, true); |
||||||
|
SetStyle(ControlStyles.AllPaintingInWmPaint, true); |
||||||
|
} |
||||||
|
|
||||||
|
protected override void OnPaint(PaintEventArgs pe) |
||||||
|
{ |
||||||
|
// base.OnPaint(pe);
|
||||||
|
Graphics g = pe.Graphics; |
||||||
|
|
||||||
|
g.DrawString(ResourceService.GetString("SharpDevelop.Gui.Dialogs.WizardDialog.StepsLabel"), |
||||||
|
smallFont, |
||||||
|
SystemBrushes.WindowText, |
||||||
|
10, |
||||||
|
24 - smallFont.Height); |
||||||
|
|
||||||
|
g.DrawLine(SystemPens.WindowText, 10, 24, Width - 10, 24); |
||||||
|
|
||||||
|
int curNumber = 0; |
||||||
|
for (int i = 0; i < wizard.WizardPanels.Count; i = wizard.GetSuccessorNumber(i)) { |
||||||
|
Font curFont = wizard.ActivePanelNumber == i ? boldFont : normalFont; |
||||||
|
IDialogPanelDescriptor descriptor = ((IDialogPanelDescriptor)wizard.WizardPanels[i]); |
||||||
|
g.DrawString((1 + curNumber) + ". " + descriptor.Label, curFont, SystemBrushes.WindowText, 10, 40 + curNumber * curFont.Height); |
||||||
|
++curNumber; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,347 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Drawing; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Addin.ReportWizard |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// TreeView options are used, when more options will be edited (for something like
|
||||||
|
/// IDE Options + Plugin Options)
|
||||||
|
/// </summary>
|
||||||
|
public class WizardDialog : System.Windows.Forms.Form |
||||||
|
{ |
||||||
|
StatusPanel statusPanel = null; |
||||||
|
CurrentPanelPanel curPanel = null; |
||||||
|
|
||||||
|
Panel dialogPanel = new Panel(); |
||||||
|
|
||||||
|
/// <remarks>
|
||||||
|
/// On this stack the indices of the previous active wizard panels. This
|
||||||
|
/// is used to restore the path the user gone. (for the back button)
|
||||||
|
/// </remarks>
|
||||||
|
Stack idStack = new Stack(); |
||||||
|
|
||||||
|
ArrayList wizardPanels = new ArrayList(); |
||||||
|
int activePanelNumber = 0; |
||||||
|
|
||||||
|
EventHandler enableNextChangedHandler; |
||||||
|
EventHandler enableCancelChangedHandler; |
||||||
|
EventHandler nextWizardPanelIDChangedHandler; |
||||||
|
EventHandler finishPanelHandler; |
||||||
|
|
||||||
|
public ArrayList WizardPanels { |
||||||
|
get { |
||||||
|
return wizardPanels; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int ActivePanelNumber { |
||||||
|
get { |
||||||
|
return activePanelNumber; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public IWizardPanel CurrentWizardPane { |
||||||
|
get { |
||||||
|
return (IWizardPanel)((IDialogPanelDescriptor)wizardPanels[activePanelNumber]).DialogPanel; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
int GetPanelNumber(string id) |
||||||
|
{ |
||||||
|
for (int i = 0; i < wizardPanels.Count; ++i) { |
||||||
|
IDialogPanelDescriptor descriptor = (IDialogPanelDescriptor)wizardPanels[i]; |
||||||
|
if (descriptor.ID == id) { |
||||||
|
return i; |
||||||
|
} |
||||||
|
} |
||||||
|
return -1; |
||||||
|
} |
||||||
|
|
||||||
|
public int GetSuccessorNumber(int curNr) |
||||||
|
{ |
||||||
|
IWizardPanel panel = (IWizardPanel)((IDialogPanelDescriptor)wizardPanels[curNr]).DialogPanel; |
||||||
|
|
||||||
|
if (panel.IsLastPanel) { |
||||||
|
return wizardPanels.Count + 1; |
||||||
|
} |
||||||
|
|
||||||
|
int nextID = GetPanelNumber(panel.NextWizardPanelID); |
||||||
|
if (nextID < 0) { |
||||||
|
return curNr + 1; |
||||||
|
} |
||||||
|
return nextID; |
||||||
|
} |
||||||
|
|
||||||
|
/// <value> returns true, if all dialog panels could be finished</value>
|
||||||
|
bool CanFinish { |
||||||
|
get { |
||||||
|
int currentNr = 0; |
||||||
|
while (currentNr < wizardPanels.Count) { |
||||||
|
IDialogPanelDescriptor descriptor = (IDialogPanelDescriptor)wizardPanels[currentNr]; |
||||||
|
if (!descriptor.DialogPanel.EnableFinish) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
currentNr = GetSuccessorNumber(currentNr); |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Label label1 = new Label(); |
||||||
|
|
||||||
|
Button backButton = new Button(); |
||||||
|
Button nextButton = new Button(); |
||||||
|
Button finishButton = new Button(); |
||||||
|
Button cancelButton = new Button(); |
||||||
|
Button helpButton = new Button(); |
||||||
|
|
||||||
|
void CheckFinishedState(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
finishButton.Enabled = CanFinish; |
||||||
|
} |
||||||
|
|
||||||
|
void AddNodes(object customizer, IEnumerable<IDialogPanelDescriptor> dialogPanelDescriptors) |
||||||
|
{ |
||||||
|
foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) { |
||||||
|
|
||||||
|
if (descriptor.DialogPanel != null) { // may be null, if it is only a "path"
|
||||||
|
descriptor.DialogPanel.EnableFinishChanged += new EventHandler(CheckFinishedState); |
||||||
|
descriptor.DialogPanel.CustomizationObject = customizer; |
||||||
|
wizardPanels.Add(descriptor); |
||||||
|
} |
||||||
|
|
||||||
|
if (descriptor.ChildDialogPanelDescriptors != null) { |
||||||
|
AddNodes(customizer, descriptor.ChildDialogPanelDescriptors); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void EnableCancelChanged(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
cancelButton.Enabled = CurrentWizardPane.EnableCancel; |
||||||
|
} |
||||||
|
|
||||||
|
void EnableNextChanged(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
nextButton.Enabled = CurrentWizardPane.EnableNext && GetSuccessorNumber(activePanelNumber) < wizardPanels.Count; |
||||||
|
backButton.Enabled = CurrentWizardPane.EnablePrevious && idStack.Count > 0; |
||||||
|
} |
||||||
|
|
||||||
|
void NextWizardPanelIDChanged(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
EnableNextChanged(null, null); |
||||||
|
finishButton.Enabled = CanFinish; |
||||||
|
statusPanel.Refresh(); |
||||||
|
} |
||||||
|
|
||||||
|
void ActivatePanel(int number) |
||||||
|
{ |
||||||
|
// take out old event handlers
|
||||||
|
if (CurrentWizardPane != null) { |
||||||
|
CurrentWizardPane.EnableNextChanged -= enableNextChangedHandler; |
||||||
|
CurrentWizardPane.EnableCancelChanged -= enableCancelChangedHandler; |
||||||
|
CurrentWizardPane.EnablePreviousChanged -= enableNextChangedHandler; |
||||||
|
CurrentWizardPane.NextWizardPanelIDChanged -= nextWizardPanelIDChangedHandler; |
||||||
|
CurrentWizardPane.IsLastPanelChanged -= nextWizardPanelIDChangedHandler; |
||||||
|
CurrentWizardPane.FinishPanelRequested -= finishPanelHandler; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
// set new active panel
|
||||||
|
activePanelNumber = number; |
||||||
|
|
||||||
|
// insert new event handlers
|
||||||
|
if (CurrentWizardPane != null) { |
||||||
|
CurrentWizardPane.EnableNextChanged += enableNextChangedHandler; |
||||||
|
CurrentWizardPane.EnableCancelChanged += enableCancelChangedHandler; |
||||||
|
CurrentWizardPane.EnablePreviousChanged += enableNextChangedHandler; |
||||||
|
CurrentWizardPane.NextWizardPanelIDChanged += nextWizardPanelIDChangedHandler; |
||||||
|
CurrentWizardPane.IsLastPanelChanged += nextWizardPanelIDChangedHandler; |
||||||
|
CurrentWizardPane.FinishPanelRequested += finishPanelHandler; |
||||||
|
} |
||||||
|
|
||||||
|
// initialize panel status
|
||||||
|
EnableNextChanged(null, null); |
||||||
|
NextWizardPanelIDChanged(null, null); |
||||||
|
EnableCancelChanged(null, null); |
||||||
|
|
||||||
|
// take out panel control & show new one
|
||||||
|
statusPanel.Refresh(); |
||||||
|
curPanel.Refresh(); |
||||||
|
dialogPanel.Controls.Clear(); |
||||||
|
|
||||||
|
Control panelControl = CurrentWizardPane.Control; |
||||||
|
panelControl.Dock = DockStyle.Fill; |
||||||
|
dialogPanel.Controls.Add(panelControl); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public WizardDialog(string title, object customizer, string treePath) |
||||||
|
{ |
||||||
|
|
||||||
|
AddInTreeNode node = AddInTree.GetTreeNode(treePath); |
||||||
|
this.Text = title; |
||||||
|
|
||||||
|
if (node != null) { |
||||||
|
AddNodes(customizer, node.BuildChildItems<IDialogPanelDescriptor>(this)); |
||||||
|
} |
||||||
|
InitializeComponents(); |
||||||
|
|
||||||
|
enableNextChangedHandler = new EventHandler(EnableNextChanged); |
||||||
|
nextWizardPanelIDChangedHandler = new EventHandler(NextWizardPanelIDChanged); |
||||||
|
enableCancelChangedHandler = new EventHandler(EnableCancelChanged); |
||||||
|
finishPanelHandler = new EventHandler(FinishPanelEvent); |
||||||
|
ActivatePanel(0); |
||||||
|
} |
||||||
|
|
||||||
|
void FinishPanelEvent(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
AbstractWizardPanel panel = (AbstractWizardPanel)CurrentWizardPane; |
||||||
|
bool isLast = panel.IsLastPanel; |
||||||
|
panel.IsLastPanel = false; |
||||||
|
ShowNextPanelEvent(sender, e); |
||||||
|
panel.IsLastPanel = isLast; |
||||||
|
} |
||||||
|
|
||||||
|
void ShowNextPanelEvent(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
int nextID = GetSuccessorNumber(this.ActivePanelNumber); |
||||||
|
System.Diagnostics.Debug.Assert(nextID < wizardPanels.Count && nextID >= 0); |
||||||
|
if (!CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Next)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
idStack.Push(activePanelNumber); |
||||||
|
ActivatePanel(nextID); |
||||||
|
CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Activated); |
||||||
|
} |
||||||
|
|
||||||
|
void ShowPrevPanelEvent(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
System.Diagnostics.Debug.Assert(idStack.Count > 0); |
||||||
|
if (!CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Prev)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
ActivatePanel((int)idStack.Pop()); |
||||||
|
} |
||||||
|
|
||||||
|
void FinishEvent(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
foreach (IDialogPanelDescriptor descriptor in wizardPanels) { |
||||||
|
if (!descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Finish)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
DialogResult = DialogResult.OK; |
||||||
|
} |
||||||
|
|
||||||
|
void CancelEvent(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
foreach (IDialogPanelDescriptor descriptor in wizardPanels) { |
||||||
|
if (!descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Cancel)) { |
||||||
|
return; |
||||||
|
} |
||||||
|
} |
||||||
|
DialogResult = DialogResult.Cancel; |
||||||
|
} |
||||||
|
|
||||||
|
void HelpEvent(object sender, EventArgs e) |
||||||
|
{ |
||||||
|
CurrentWizardPane.ReceiveDialogMessage(DialogMessage.Help); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
void InitializeComponents() |
||||||
|
{ |
||||||
|
|
||||||
|
|
||||||
|
this.SuspendLayout(); |
||||||
|
|
||||||
|
ShowInTaskbar = false; |
||||||
|
StartPosition = FormStartPosition.CenterScreen; |
||||||
|
FormBorderStyle = FormBorderStyle.FixedDialog; |
||||||
|
MinimizeBox = MaximizeBox = false; |
||||||
|
Icon = null; |
||||||
|
ClientSize = new Size(640, 440); |
||||||
|
|
||||||
|
int buttonSize = 92; |
||||||
|
int buttonYLoc = 464 - 2 * 24 - 4; |
||||||
|
int buttonXStart = Width - ((buttonSize + 4) * 4) - 4; |
||||||
|
|
||||||
|
label1.Size = new Size(Width - 4, 1); |
||||||
|
label1.BorderStyle = BorderStyle.Fixed3D; |
||||||
|
label1.Location = new Point(2, 404 - 2); |
||||||
|
label1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left; |
||||||
|
Controls.Add(label1); |
||||||
|
|
||||||
|
backButton.Text = ResourceService.GetString("Global.BackButtonText"); |
||||||
|
backButton.Location = new Point(buttonXStart, buttonYLoc); |
||||||
|
backButton.ClientSize = new Size(buttonSize, 26); |
||||||
|
backButton.Click += new EventHandler(ShowPrevPanelEvent); |
||||||
|
backButton.FlatStyle = FlatStyle.System; |
||||||
|
backButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; |
||||||
|
Controls.Add(backButton); |
||||||
|
|
||||||
|
nextButton.Text = ResourceService.GetString("Global.NextButtonText"); |
||||||
|
nextButton.Location = new Point(buttonXStart + buttonSize + 4, buttonYLoc); |
||||||
|
nextButton.ClientSize = new Size(buttonSize, 26); |
||||||
|
nextButton.Click += new EventHandler(ShowNextPanelEvent); |
||||||
|
nextButton.FlatStyle = FlatStyle.System; |
||||||
|
nextButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; |
||||||
|
Controls.Add(nextButton); |
||||||
|
|
||||||
|
finishButton.Text = ResourceService.GetString("Dialog.WizardDialog.FinishButton"); |
||||||
|
finishButton.Location = new Point(buttonXStart + 2 * (buttonSize + 4), buttonYLoc); |
||||||
|
finishButton.ClientSize = new Size(buttonSize, 26); |
||||||
|
finishButton.Click += new EventHandler(FinishEvent); |
||||||
|
finishButton.FlatStyle = FlatStyle.System; |
||||||
|
finishButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; |
||||||
|
Controls.Add(finishButton); |
||||||
|
|
||||||
|
cancelButton.Text = ResourceService.GetString("Global.CancelButtonText"); |
||||||
|
cancelButton.Location = new Point(buttonXStart + 3 * (buttonSize + 4), buttonYLoc); |
||||||
|
cancelButton.ClientSize = new Size(buttonSize, 26); |
||||||
|
cancelButton.Click += new EventHandler(CancelEvent); |
||||||
|
cancelButton.FlatStyle = FlatStyle.System; |
||||||
|
cancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; |
||||||
|
Controls.Add(cancelButton); |
||||||
|
|
||||||
|
// helpButton.Text = ResourceService.GetString("Global.HelpButtonText");
|
||||||
|
// helpButton.Location = new Point(buttonXStart + 4 * (buttonSize + 4), buttonYLoc);
|
||||||
|
// helpButton.ClientSize = new Size(buttonSize, 26);
|
||||||
|
// helpButton.Click += new EventHandler(HelpEvent);
|
||||||
|
// helpButton.FlatStyle = FlatStyle.System;
|
||||||
|
// helpButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||||
|
// Controls.Add(helpButton);
|
||||||
|
|
||||||
|
statusPanel = new StatusPanel(this); |
||||||
|
statusPanel.Location = new Point(2, 2); |
||||||
|
statusPanel.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left; |
||||||
|
Controls.Add(statusPanel); |
||||||
|
|
||||||
|
curPanel = new CurrentPanelPanel(this); |
||||||
|
curPanel.Location = new Point(200, 2); |
||||||
|
curPanel.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left; |
||||||
|
Controls.Add(curPanel); |
||||||
|
|
||||||
|
dialogPanel.Location = new Point(200, 27); |
||||||
|
// dialogPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
||||||
|
dialogPanel.Size = new Size(Width - 8 - statusPanel.Bounds.Right, |
||||||
|
label1.Location.Y - dialogPanel.Location.Y); |
||||||
|
dialogPanel.Anchor = AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom; |
||||||
|
Controls.Add(dialogPanel); |
||||||
|
this.ResumeLayout(true); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue