You've already forked linux-packaging-mono
Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
@ -0,0 +1,185 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="DesignerForm.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Design;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
namespace System.Web.UI.Design.WebControls.Util
|
||||
{
|
||||
/// <devdoc>
|
||||
/// Represents a form used by a designer.
|
||||
/// </devdoc>
|
||||
internal abstract class DesignerForm : Form
|
||||
{
|
||||
private const int SC_CONTEXTHELP = 0xF180;
|
||||
private const int WM_SYSCOMMAND = 0x0112;
|
||||
|
||||
private IServiceProvider _serviceProvider;
|
||||
private bool _firstActivate;
|
||||
#if DEBUG
|
||||
private bool _formInitialized;
|
||||
#endif
|
||||
|
||||
/// <devdoc>
|
||||
/// Creates a new DesignerForm with a given service provider.
|
||||
/// </devdoc>
|
||||
protected DesignerForm(IServiceProvider serviceProvider)
|
||||
{
|
||||
Debug.Assert(serviceProvider != null);
|
||||
_serviceProvider = serviceProvider;
|
||||
|
||||
_firstActivate = true;
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// The service provider for the form.
|
||||
/// </devdoc>
|
||||
protected internal IServiceProvider ServiceProvider
|
||||
{
|
||||
get
|
||||
{
|
||||
return _serviceProvider;
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Frees up resources.
|
||||
/// </devdoc>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_serviceProvider = null;
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
protected void InitializeForm()
|
||||
{
|
||||
Font dialogFont = UIHelper.GetDialogFont(ServiceProvider);
|
||||
if (dialogFont != null)
|
||||
{
|
||||
Font = dialogFont;
|
||||
}
|
||||
|
||||
// Set RightToLeft mode based on resource file
|
||||
string rtlText = Strings.RTL;
|
||||
if (!String.Equals(rtlText, "RTL_False", StringComparison.Ordinal))
|
||||
{
|
||||
RightToLeft = RightToLeft.Yes;
|
||||
RightToLeftLayout = true;
|
||||
}
|
||||
|
||||
#pragma warning disable 618
|
||||
AutoScaleBaseSize = new System.Drawing.Size(5, 14);
|
||||
#pragma warning restore 618
|
||||
HelpButton = true;
|
||||
MinimizeBox = false;
|
||||
MaximizeBox = false;
|
||||
ShowIcon = false;
|
||||
ShowInTaskbar = false;
|
||||
FormBorderStyle = FormBorderStyle.Sizable;
|
||||
SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
|
||||
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
MinimumSize = Size;
|
||||
#if DEBUG
|
||||
_formInitialized = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Gets a service of the desired entitySetNameItem. Returns null if the service does not exist or there is no service provider.
|
||||
/// </devdoc>
|
||||
protected override object GetService(Type serviceType)
|
||||
{
|
||||
if (_serviceProvider != null)
|
||||
{
|
||||
return _serviceProvider.GetService(serviceType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override void OnActivated(EventArgs e)
|
||||
{
|
||||
base.OnActivated(e);
|
||||
|
||||
if (_firstActivate)
|
||||
{
|
||||
_firstActivate = false;
|
||||
OnInitialActivated(e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Returns the help topic for the form. Consult with your UE contact on
|
||||
/// what the appropriate help topic is for your dialog.
|
||||
/// </devdoc>
|
||||
protected abstract string HelpTopic
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
protected sealed override void OnHelpRequested(HelpEventArgs hevent)
|
||||
{
|
||||
ShowHelp();
|
||||
hevent.Handled = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raised upon first activation of the form.
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected virtual void OnInitialActivated(EventArgs e)
|
||||
{
|
||||
#if DEBUG
|
||||
Debug.Assert(_formInitialized, "All classes deriving from DesignerForm must call InitializeForm() from within InitializeComponent().");
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Launches the help for this form.
|
||||
/// </devdoc>
|
||||
private void ShowHelp()
|
||||
{
|
||||
if (ServiceProvider != null)
|
||||
{
|
||||
IHelpService helpService = (IHelpService)ServiceProvider.GetService(typeof(IHelpService));
|
||||
if (helpService != null)
|
||||
{
|
||||
helpService.ShowHelpFromKeyword(HelpTopic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Overridden to reroute the context-help button to our own handler.
|
||||
/// </devdoc>
|
||||
protected override void WndProc(ref Message m)
|
||||
{
|
||||
if ((m.Msg == WM_SYSCOMMAND) && ((int)m.WParam == SC_CONTEXTHELP))
|
||||
{
|
||||
ShowHelp();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.WndProc(ref m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="RTLAwareMessageBox.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Design;
|
||||
|
||||
namespace System.Web.UI.Design.WebControls
|
||||
{
|
||||
/// <devdoc>
|
||||
/// <para>
|
||||
/// The Show method displays a message box that can contain text, buttons, and symbols that
|
||||
/// inform and instruct the user. This MessageBox will be RTL, if the resources
|
||||
/// for this dll have been localized to a RTL language.
|
||||
/// </para>
|
||||
/// </devdoc>
|
||||
internal static class RTLAwareMessageBox
|
||||
{
|
||||
/// <devdoc>
|
||||
/// <para>
|
||||
/// Displays a message box with specified text, caption, and style.
|
||||
/// Makes the dialog RTL if the resources for this dll have been localized to a RTL language.
|
||||
/// </para>
|
||||
/// </devdoc>
|
||||
public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon,
|
||||
MessageBoxDefaultButton defaultButton, MessageBoxOptions options)
|
||||
{
|
||||
if (RTLAwareMessageBox.IsRTLResources)
|
||||
{
|
||||
options |= (MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
|
||||
}
|
||||
return MessageBox.Show(owner, text, caption, buttons, icon, defaultButton, options);
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Tells whether the current resources for this dll have been
|
||||
/// localized for a RTL language.
|
||||
/// </devdoc>
|
||||
public static bool IsRTLResources
|
||||
{
|
||||
get
|
||||
{
|
||||
return Strings.RTL != "RTL_False";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ResourceDescriptionAttribute.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace System.Web.UI.Design.WebControls.Util
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Event, Inherited = true, AllowMultiple = false)]
|
||||
internal sealed class ResourceDescriptionAttribute : DescriptionAttribute
|
||||
{
|
||||
private bool _resourceLoaded;
|
||||
private readonly string _descriptionResourceName;
|
||||
|
||||
public ResourceDescriptionAttribute(string descriptionResourceName)
|
||||
{
|
||||
_descriptionResourceName = descriptionResourceName;
|
||||
}
|
||||
|
||||
public override string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_resourceLoaded)
|
||||
{
|
||||
_resourceLoaded = true;
|
||||
DescriptionValue = System.Web.UI.Design.WebControlsRes.GetString(_descriptionResourceName);
|
||||
}
|
||||
return base.Description;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="TaskFormBase.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Design;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
namespace System.Web.UI.Design.WebControls.Util
|
||||
{
|
||||
/// <devdoc>
|
||||
/// Represents a wizard used to guide users through configuration processes.
|
||||
/// </devdoc>
|
||||
internal abstract class TaskFormBase : DesignerForm
|
||||
{
|
||||
|
||||
private System.Windows.Forms.Panel _taskPanel;
|
||||
private System.Windows.Forms.Label _bottomDividerLabel;
|
||||
private System.Windows.Forms.Panel _headerPanel;
|
||||
private System.Windows.Forms.Label _captionLabel;
|
||||
private System.Windows.Forms.PictureBox _glyphPictureBox;
|
||||
|
||||
/// <devdoc>
|
||||
/// Creates a new TaskForm with a given service provider.
|
||||
/// </devdoc>
|
||||
public TaskFormBase(IServiceProvider serviceProvider)
|
||||
: base(serviceProvider)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeUI();
|
||||
}
|
||||
|
||||
protected System.Windows.Forms.Label CaptionLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _captionLabel;
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// A glyph for the wizard.
|
||||
/// </devdoc>
|
||||
protected void SetGlyph(System.Drawing.Image value)
|
||||
{
|
||||
_glyphPictureBox.Image = value;
|
||||
}
|
||||
|
||||
protected System.Windows.Forms.Panel TaskPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _taskPanel;
|
||||
}
|
||||
}
|
||||
|
||||
#region 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._taskPanel = new System.Windows.Forms.Panel();
|
||||
this._bottomDividerLabel = new System.Windows.Forms.Label();
|
||||
this._captionLabel = new System.Windows.Forms.Label();
|
||||
this._headerPanel = new System.Windows.Forms.Panel();
|
||||
this._glyphPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this._headerPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this._glyphPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
|
||||
//
|
||||
// _taskPanel
|
||||
//
|
||||
this._taskPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._taskPanel.Location = new System.Drawing.Point(0, 63);
|
||||
this._taskPanel.Name = "_taskPanel";
|
||||
this._taskPanel.Size = new System.Drawing.Size(528, 319);
|
||||
this._taskPanel.TabIndex = 30;
|
||||
//
|
||||
// _bottomDividerLabel
|
||||
//
|
||||
this._bottomDividerLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._bottomDividerLabel.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this._bottomDividerLabel.Location = new System.Drawing.Point(0, 382);
|
||||
this._bottomDividerLabel.Name = "_bottomDividerLabel";
|
||||
this._bottomDividerLabel.Size = new System.Drawing.Size(572, 1);
|
||||
this._bottomDividerLabel.TabIndex = 40;
|
||||
//
|
||||
// _headerPanel
|
||||
//
|
||||
this._headerPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._headerPanel.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this._headerPanel.Controls.Add(this._glyphPictureBox);
|
||||
this._headerPanel.Controls.Add(this._captionLabel);
|
||||
this._headerPanel.Location = new System.Drawing.Point(0, 0);
|
||||
this._headerPanel.Name = "_headerPanel";
|
||||
this._headerPanel.Size = new System.Drawing.Size(572, 63);
|
||||
this._headerPanel.TabIndex = 10;
|
||||
//
|
||||
// _glyphPictureBox
|
||||
//
|
||||
this._glyphPictureBox.Location = new System.Drawing.Point(0, 0);
|
||||
this._glyphPictureBox.Name = "_glyphPictureBox";
|
||||
this._glyphPictureBox.Size = new System.Drawing.Size(65, 63);
|
||||
this._glyphPictureBox.TabIndex = 20;
|
||||
this._glyphPictureBox.TabStop = false;
|
||||
//
|
||||
// _captionLabel
|
||||
//
|
||||
this._captionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._captionLabel.Location = new System.Drawing.Point(71, 17);
|
||||
this._captionLabel.Name = "_captionLabel";
|
||||
this._captionLabel.Size = new System.Drawing.Size(487, 47);
|
||||
this._captionLabel.TabIndex = 10;
|
||||
//
|
||||
// TaskForm
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(530, 423);
|
||||
this.Controls.Add(this._headerPanel);
|
||||
this.Controls.Add(this._bottomDividerLabel);
|
||||
this.Controls.Add(this._taskPanel);
|
||||
this.Name = "TaskForm";
|
||||
this._headerPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this._glyphPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <devdoc>
|
||||
/// Called after InitializeComponent to perform additional actions that
|
||||
/// are not supported by the designer.
|
||||
/// </devdoc>
|
||||
private void InitializeUI()
|
||||
{
|
||||
UpdateFonts();
|
||||
}
|
||||
|
||||
protected override void OnFontChanged(EventArgs e)
|
||||
{
|
||||
base.OnFontChanged(e);
|
||||
UpdateFonts();
|
||||
}
|
||||
|
||||
private void UpdateFonts()
|
||||
{
|
||||
_captionLabel.Font = new Font(Font.FontFamily, Font.Size + 2.0f, FontStyle.Bold, Font.Unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="UIHelper.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//
|
||||
// Helper methods for UI functionality like displaying dialogs
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
namespace System.Web.UI.Design.WebControls.Util
|
||||
{
|
||||
internal static class UIHelper
|
||||
{
|
||||
internal static Font GetDialogFont(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (serviceProvider != null)
|
||||
{
|
||||
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
|
||||
if (uiService != null)
|
||||
{
|
||||
IDictionary uiStyles = uiService.Styles;
|
||||
if (uiStyles != null)
|
||||
{
|
||||
return (Font)uiStyles["DialogFont"];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static DialogResult ShowDialog(IServiceProvider serviceProvider, Form form)
|
||||
{
|
||||
if (serviceProvider != null)
|
||||
{
|
||||
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
|
||||
if (uiService != null)
|
||||
{
|
||||
return uiService.ShowDialog(form);
|
||||
}
|
||||
}
|
||||
|
||||
return form.ShowDialog();
|
||||
}
|
||||
|
||||
public static void ShowError(IServiceProvider serviceProvider, string message)
|
||||
{
|
||||
if (serviceProvider != null)
|
||||
{
|
||||
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
|
||||
if (uiService != null)
|
||||
{
|
||||
uiService.ShowError(message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RTLAwareMessageBox.Show(null, message, Strings.UIHelper_ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, 0);
|
||||
}
|
||||
|
||||
public static void ShowWarning(IServiceProvider serviceProvider, string message)
|
||||
{
|
||||
if (serviceProvider != null)
|
||||
{
|
||||
IUIService uiService = (IUIService)serviceProvider.GetService(typeof(IUIService));
|
||||
if (uiService != null)
|
||||
{
|
||||
uiService.ShowError(message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
RTLAwareMessageBox.Show(null, message, Strings.UIHelper_WarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, 0);
|
||||
}
|
||||
}
|
||||
}
|
413
external/referencesource/System.Web.Entity.Design/System/Data/WebControls/Design/Util/WizardForm.cs
vendored
Normal file
413
external/referencesource/System.Web.Entity.Design/System/Data/WebControls/Design/Util/WizardForm.cs
vendored
Normal file
@ -0,0 +1,413 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="WizardForm.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Design;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
namespace System.Web.UI.Design.WebControls.Util
|
||||
{
|
||||
/// <devdoc>
|
||||
/// Represents a wizard used to guide users through configuration processes.
|
||||
/// </devdoc>
|
||||
internal abstract class WizardForm : TaskFormBase
|
||||
{
|
||||
|
||||
private System.Windows.Forms.Button _nextButton;
|
||||
private System.Windows.Forms.Button _previousButton;
|
||||
private System.Windows.Forms.Button _cancelButton;
|
||||
private System.Windows.Forms.Button _finishButton;
|
||||
private System.Windows.Forms.TableLayoutPanel _wizardButtonsTableLayoutPanel;
|
||||
private System.Windows.Forms.Label _dummyLabel1;
|
||||
private System.Windows.Forms.Label _dummyLabel2;
|
||||
private System.Windows.Forms.Label _dummyLabel3;
|
||||
|
||||
System.Collections.Generic.Stack<WizardPanel> _panelHistory;
|
||||
private WizardPanel _initialPanel;
|
||||
|
||||
/// <devdoc>
|
||||
/// Creates a new WizardForm with a given service provider.
|
||||
/// </devdoc>
|
||||
public WizardForm(IServiceProvider serviceProvider)
|
||||
: base(serviceProvider)
|
||||
{
|
||||
_panelHistory = new System.Collections.Generic.Stack<WizardPanel>();
|
||||
|
||||
InitializeComponent();
|
||||
InitializeUI();
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// The Finish button of the wizard.
|
||||
/// </devdoc>
|
||||
public System.Windows.Forms.Button FinishButton
|
||||
{
|
||||
get
|
||||
{
|
||||
return _finishButton;
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// The Next button of the wizard.
|
||||
/// </devdoc>
|
||||
public System.Windows.Forms.Button NextButton
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nextButton;
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// The Back button of the wizard.
|
||||
/// </devdoc>
|
||||
public System.Windows.Forms.Button PreviousButton
|
||||
{
|
||||
get
|
||||
{
|
||||
return _previousButton;
|
||||
}
|
||||
}
|
||||
|
||||
#region 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._wizardButtonsTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
|
||||
this._previousButton = new System.Windows.Forms.Button();
|
||||
this._nextButton = new System.Windows.Forms.Button();
|
||||
this._dummyLabel2 = new System.Windows.Forms.Label();
|
||||
this._finishButton = new System.Windows.Forms.Button();
|
||||
this._dummyLabel3 = new System.Windows.Forms.Label();
|
||||
this._cancelButton = new System.Windows.Forms.Button();
|
||||
this._dummyLabel1 = new System.Windows.Forms.Label();
|
||||
this._wizardButtonsTableLayoutPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
|
||||
//
|
||||
// _wizardButtonsTableLayoutPanel
|
||||
//
|
||||
this._wizardButtonsTableLayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._wizardButtonsTableLayoutPanel.AutoSize = true;
|
||||
this._wizardButtonsTableLayoutPanel.ColumnCount = 7;
|
||||
this._wizardButtonsTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this._wizardButtonsTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 3F));
|
||||
this._wizardButtonsTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this._wizardButtonsTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 7F));
|
||||
this._wizardButtonsTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this._wizardButtonsTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 7F));
|
||||
this._wizardButtonsTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
|
||||
this._wizardButtonsTableLayoutPanel.Controls.Add(this._previousButton);
|
||||
this._wizardButtonsTableLayoutPanel.Controls.Add(this._dummyLabel1);
|
||||
this._wizardButtonsTableLayoutPanel.Controls.Add(this._nextButton);
|
||||
this._wizardButtonsTableLayoutPanel.Controls.Add(this._dummyLabel2);
|
||||
this._wizardButtonsTableLayoutPanel.Controls.Add(this._finishButton);
|
||||
this._wizardButtonsTableLayoutPanel.Controls.Add(this._dummyLabel3);
|
||||
this._wizardButtonsTableLayoutPanel.Controls.Add(this._cancelButton);
|
||||
this._wizardButtonsTableLayoutPanel.Location = new System.Drawing.Point(205, 394);
|
||||
this._wizardButtonsTableLayoutPanel.Name = "_wizardButtonsTableLayoutPanel";
|
||||
this._wizardButtonsTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this._wizardButtonsTableLayoutPanel.Size = new System.Drawing.Size(317, 20);
|
||||
this._wizardButtonsTableLayoutPanel.TabIndex = 100;
|
||||
//
|
||||
// _previousButton
|
||||
//
|
||||
this._previousButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._previousButton.AutoSize = true;
|
||||
this._previousButton.Enabled = false;
|
||||
this._previousButton.Location = new System.Drawing.Point(0, 0);
|
||||
this._previousButton.Margin = new System.Windows.Forms.Padding(0);
|
||||
this._previousButton.MinimumSize = new System.Drawing.Size(75, 23);
|
||||
this._previousButton.Name = "_previousButton";
|
||||
this._previousButton.TabIndex = 10;
|
||||
this._previousButton.Click += new System.EventHandler(this.OnPreviousButtonClick);
|
||||
//
|
||||
// _dummyLabel1
|
||||
//
|
||||
this._dummyLabel1.Location = new System.Drawing.Point(75, 0);
|
||||
this._dummyLabel1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this._dummyLabel1.Name = "_dummyLabel1";
|
||||
this._dummyLabel1.Size = new System.Drawing.Size(3, 0);
|
||||
this._dummyLabel1.TabIndex = 20;
|
||||
//
|
||||
// _nextButton
|
||||
//
|
||||
this._nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._nextButton.AutoSize = true;
|
||||
this._nextButton.Location = new System.Drawing.Point(78, 0);
|
||||
this._nextButton.Margin = new System.Windows.Forms.Padding(0);
|
||||
this._nextButton.MinimumSize = new System.Drawing.Size(75, 23);
|
||||
this._nextButton.Name = "_nextButton";
|
||||
this._nextButton.TabIndex = 30;
|
||||
this._nextButton.Click += new System.EventHandler(this.OnNextButtonClick);
|
||||
//
|
||||
// _dummyLabel2
|
||||
//
|
||||
this._dummyLabel2.Location = new System.Drawing.Point(153, 0);
|
||||
this._dummyLabel2.Margin = new System.Windows.Forms.Padding(0);
|
||||
this._dummyLabel2.Name = "_dummyLabel2";
|
||||
this._dummyLabel2.Size = new System.Drawing.Size(7, 0);
|
||||
this._dummyLabel2.TabIndex = 40;
|
||||
//
|
||||
// _finishButton
|
||||
//
|
||||
this._finishButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._finishButton.AutoSize = true;
|
||||
this._finishButton.Enabled = false;
|
||||
this._finishButton.Location = new System.Drawing.Point(160, 0);
|
||||
this._finishButton.Margin = new System.Windows.Forms.Padding(0);
|
||||
this._finishButton.MinimumSize = new System.Drawing.Size(75, 23);
|
||||
this._finishButton.Name = "_finishButton";
|
||||
this._finishButton.TabIndex = 50;
|
||||
this._finishButton.Click += new System.EventHandler(this.OnFinishButtonClick);
|
||||
//
|
||||
// _dummyLabel3
|
||||
//
|
||||
this._dummyLabel3.Location = new System.Drawing.Point(235, 0);
|
||||
this._dummyLabel3.Margin = new System.Windows.Forms.Padding(0);
|
||||
this._dummyLabel3.Name = "_dummyLabel3";
|
||||
this._dummyLabel3.Size = new System.Drawing.Size(7, 0);
|
||||
this._dummyLabel3.TabIndex = 60;
|
||||
//
|
||||
// _cancelButton
|
||||
//
|
||||
this._cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._cancelButton.AutoSize = true;
|
||||
this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this._cancelButton.Location = new System.Drawing.Point(242, 0);
|
||||
this._cancelButton.Margin = new System.Windows.Forms.Padding(0);
|
||||
this._cancelButton.MinimumSize = new System.Drawing.Size(75, 23);
|
||||
this._cancelButton.Name = "_cancelButton";
|
||||
this._cancelButton.TabIndex = 70;
|
||||
this._cancelButton.Click += new System.EventHandler(this.OnCancelButtonClick);
|
||||
//
|
||||
// TaskForm
|
||||
//
|
||||
this.AcceptButton = this._nextButton;
|
||||
this.CancelButton = this._cancelButton;
|
||||
this.Controls.Add(this._wizardButtonsTableLayoutPanel);
|
||||
|
||||
this._wizardButtonsTableLayoutPanel.ResumeLayout(false);
|
||||
this._wizardButtonsTableLayoutPanel.PerformLayout();
|
||||
|
||||
InitializeForm();
|
||||
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <devdoc>
|
||||
/// Called after InitializeComponent to perform additional actions that
|
||||
/// are not supported by the designer.
|
||||
/// </devdoc>
|
||||
private void InitializeUI()
|
||||
{
|
||||
_cancelButton.Text = Strings.CancelButton;
|
||||
_cancelButton.AccessibleName = Strings.CancelButtonAccessibleName;
|
||||
_nextButton.Text = Strings.Wizard_NextButton;
|
||||
_nextButton.AccessibleName = Strings.Wizard_NextButtonAccessibleName;
|
||||
_previousButton.Text = Strings.Wizard_PreviousButton;
|
||||
_previousButton.AccessibleName = Strings.Wizard_PreviousButtonAccessibleName;
|
||||
_finishButton.Text = Strings.Wizard_FinishButton;
|
||||
_finishButton.AccessibleName = Strings.Wizard_FinishButtonAccessibleName;
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Goes to the next panel in the wizard.
|
||||
/// </devdoc>
|
||||
public void NextPanel()
|
||||
{
|
||||
WizardPanel currentPanel = _panelHistory.Peek();
|
||||
if (currentPanel.OnNext())
|
||||
{
|
||||
currentPanel.Hide();
|
||||
WizardPanel nextPanel = currentPanel.NextPanel;
|
||||
if (nextPanel != null)
|
||||
{
|
||||
RegisterPanel(nextPanel);
|
||||
_panelHistory.Push(nextPanel);
|
||||
OnPanelChanging(new WizardPanelChangingEventArgs(currentPanel));
|
||||
ShowPanel(nextPanel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Click event handler for the Cancel button.
|
||||
/// </devdoc>
|
||||
protected virtual void OnCancelButtonClick(object sender, System.EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Raises the InitialActivated event.
|
||||
/// </devdoc>
|
||||
protected override void OnInitialActivated(EventArgs e)
|
||||
{
|
||||
base.OnInitialActivated(e);
|
||||
|
||||
if (_initialPanel != null)
|
||||
{
|
||||
RegisterPanel(_initialPanel);
|
||||
_panelHistory.Push(_initialPanel);
|
||||
ShowPanel(_initialPanel);
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Click event handler for the Finish button.
|
||||
/// </devdoc>
|
||||
protected virtual void OnFinishButtonClick(object sender, System.EventArgs e)
|
||||
{
|
||||
WizardPanel currentPanel = _panelHistory.Peek();
|
||||
if (currentPanel.OnNext())
|
||||
{
|
||||
// Call OnComplete for every panel on the stack
|
||||
WizardPanel[] panels = _panelHistory.ToArray();
|
||||
Array.Reverse(panels);
|
||||
foreach (WizardPanel panel in panels)
|
||||
{
|
||||
panel.OnComplete();
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Click event handler for the Next button.
|
||||
/// </devdoc>
|
||||
protected virtual void OnNextButtonClick(object sender, System.EventArgs e)
|
||||
{
|
||||
NextPanel();
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Called when a panel is about to change.
|
||||
/// </devdoc>
|
||||
protected virtual void OnPanelChanging(WizardPanelChangingEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Click event handler for the Previous button.
|
||||
/// </devdoc>
|
||||
protected virtual void OnPreviousButtonClick(object sender, System.EventArgs e)
|
||||
{
|
||||
PreviousPanel();
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Goes to the back panel in the wizard.
|
||||
/// </devdoc>
|
||||
public void PreviousPanel()
|
||||
{
|
||||
if (_panelHistory.Count > 1)
|
||||
{
|
||||
WizardPanel currentPanel = _panelHistory.Pop();
|
||||
WizardPanel backPanel = _panelHistory.Peek();
|
||||
currentPanel.OnPrevious();
|
||||
currentPanel.Hide();
|
||||
OnPanelChanging(new WizardPanelChangingEventArgs(currentPanel));
|
||||
ShowPanel(backPanel);
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Registers a panel for use in this wizard.
|
||||
/// </devdoc>
|
||||
internal void RegisterPanel(WizardPanel panel)
|
||||
{
|
||||
if (!TaskPanel.Controls.Contains(panel))
|
||||
{
|
||||
panel.Dock = DockStyle.Fill;
|
||||
panel.SetParentWizard(this);
|
||||
panel.Hide();
|
||||
TaskPanel.Controls.Add(panel);
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Initializes a WizardForm to use an ordered array of panels.
|
||||
/// </devdoc>
|
||||
protected void SetPanels(WizardPanel[] panels)
|
||||
{
|
||||
if ((panels != null) && (panels.Length > 0))
|
||||
{
|
||||
RegisterPanel(panels[0]);
|
||||
_initialPanel = panels[0];
|
||||
|
||||
for (int i = 0; i < panels.Length - 1; i++)
|
||||
{
|
||||
RegisterPanel(panels[i + 1]);
|
||||
panels[i].NextPanel = panels[i + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Shows the panel specified by the given index.
|
||||
/// </devdoc>
|
||||
private void ShowPanel(WizardPanel panel)
|
||||
{
|
||||
if (_panelHistory.Count == 1)
|
||||
{
|
||||
// If we're on the first panel, disable the back button
|
||||
PreviousButton.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Otherwise, enable it
|
||||
PreviousButton.Enabled = true;
|
||||
}
|
||||
|
||||
if (panel.NextPanel == null)
|
||||
{
|
||||
// If we're on the last panel, change the button text
|
||||
NextButton.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
NextButton.Enabled = true;
|
||||
}
|
||||
|
||||
// Show the specified panel
|
||||
panel.Show();
|
||||
|
||||
// Set the description and caption of the task bar
|
||||
AccessibleDescription = panel.Caption;
|
||||
CaptionLabel.Text = panel.Caption;
|
||||
|
||||
if (IsHandleCreated)
|
||||
{
|
||||
// Refresh the screen
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
// Focus the newly shown panel
|
||||
panel.Focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
123
external/referencesource/System.Web.Entity.Design/System/Data/WebControls/Design/Util/WizardPanel.cs
vendored
Normal file
123
external/referencesource/System.Web.Entity.Design/System/Data/WebControls/Design/Util/WizardPanel.cs
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="WizardPanel.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace System.Web.UI.Design.WebControls.Util
|
||||
{
|
||||
/// <devdoc>
|
||||
/// Represents a single step in a wizard.
|
||||
/// WizardPanels are contained within a single WizardForm.
|
||||
/// </devdoc>
|
||||
internal class WizardPanel : System.Windows.Forms.UserControl
|
||||
{
|
||||
|
||||
private WizardForm _parentWizard;
|
||||
private string _caption;
|
||||
private WizardPanel _nextPanel;
|
||||
private bool _needsToInvalidate;
|
||||
|
||||
/// <devdoc>
|
||||
/// Creates a new WizardPanel.
|
||||
/// </devdoc>
|
||||
public WizardPanel()
|
||||
{
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// The caption to be shown on the WizardForm
|
||||
/// </devdoc>
|
||||
public string Caption
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_caption == null)
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
return _caption;
|
||||
}
|
||||
set
|
||||
{
|
||||
_caption = value;
|
||||
if (_parentWizard != null)
|
||||
{
|
||||
_parentWizard.Invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
_needsToInvalidate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// The panel to go to when the Next button is clicked. This can be set dynamically in
|
||||
/// the OnNext() event to customize the order in which panels are used.
|
||||
/// </devdoc>
|
||||
public WizardPanel NextPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nextPanel;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nextPanel = value;
|
||||
Debug.Assert(_parentWizard != null);
|
||||
if (_parentWizard != null)
|
||||
{
|
||||
_parentWizard.RegisterPanel(_nextPanel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// This method is called when the wizard's Finish button is clicked.
|
||||
/// It is called once for each wizard panel on the panel stack, in the order from the first panel to the last (current) panel.
|
||||
/// </devdoc>
|
||||
protected internal virtual void OnComplete()
|
||||
{
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Runs when the next button is clicked while this panel is showing.
|
||||
/// Returns true if the wizard should proceed to the next panel.
|
||||
/// </devdoc>
|
||||
public virtual bool OnNext()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// Runs when the previous button of the parent wizard form is clicked while this panel is active
|
||||
/// </devdoc>
|
||||
public virtual void OnPrevious()
|
||||
{
|
||||
}
|
||||
|
||||
/// <devdoc>
|
||||
/// </devdoc>
|
||||
internal void SetParentWizard(WizardForm parent)
|
||||
{
|
||||
_parentWizard = parent;
|
||||
if ((_parentWizard != null) && _needsToInvalidate)
|
||||
{
|
||||
_parentWizard.Invalidate();
|
||||
_needsToInvalidate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="WizardPanelChangingEventArgs.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//
|
||||
// @owner [....]
|
||||
// @backupOwner [....]
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace System.Web.UI.Design.WebControls.Util
|
||||
{
|
||||
/// <devdoc>
|
||||
/// </devdoc>
|
||||
internal class WizardPanelChangingEventArgs : EventArgs
|
||||
{
|
||||
|
||||
private WizardPanel _currentPanel;
|
||||
|
||||
/// <devdoc>
|
||||
/// </devdoc>
|
||||
public WizardPanelChangingEventArgs(WizardPanel currentPanel)
|
||||
{
|
||||
_currentPanel = currentPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user