|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using EasiReports.Algorithms;
namespace EasiReports
{
/// <summary>
/// Summary description for AlgorithmReferences.
/// </summary>
internal class CDlgAlgorithmReferences : System.Windows.Forms.Form
{
private System.Windows.Forms.ListBox listReferences;
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.Button buttonMoveUp;
private System.Windows.Forms.Button buttonDelete;
private System.Windows.Forms.Button buttonMoveDown;
private System.Windows.Forms.Button buttonNew;
private System.Windows.Forms.Button buttonEdit;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private HelpProvider HelpProvider = new HelpProvider();
private AlgorithmsMemoryAssembly _Algorithms = null;
internal CDlgAlgorithmReferences( AlgorithmsMemoryAssembly algorithms )
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
HelpProvider.HelpNamespace = Glob.HelpNamespace;
HelpProvider.SetHelpNavigator( this, Glob.HelpNavigator );
HelpProvider.SetHelpKeyword( this, "EasiReporter.Dialogs.AlgorithmReferences.htm" );
_Algorithms = algorithms;
SetFromAlgorithms();
}
/// <summary>Clean up any resources being used.</summary>
/// <param name="disposing"><b>true</b> to release both managed and unmanaged resources; <b>false</b> to release only unmanaged resources.</param>
/// <remarks>Releases the unmanaged resources and optionally releases the managed resources.</remarks>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(CDlgAlgorithmReferences));
this.listReferences = new System.Windows.Forms.ListBox();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.buttonMoveUp = new System.Windows.Forms.Button();
this.buttonDelete = new System.Windows.Forms.Button();
this.buttonMoveDown = new System.Windows.Forms.Button();
this.buttonNew = new System.Windows.Forms.Button();
this.buttonEdit = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listReferences
//
this.listReferences.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.listReferences.HorizontalScrollbar = true;
this.listReferences.Location = new System.Drawing.Point(8, 8);
this.listReferences.Name = "listReferences";
this.listReferences.Size = new System.Drawing.Size(224, 186);
this.listReferences.TabIndex = 0;
this.listReferences.DoubleClick += new System.EventHandler(this.listReferences_DoubleClick);
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonOK.Location = new System.Drawing.Point(64, 216);
this.buttonOK.Name = "buttonOK";
this.buttonOK.TabIndex = 1;
this.buttonOK.Text = "OK";
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonCancel.Location = new System.Drawing.Point(160, 216);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.TabIndex = 2;
this.buttonCancel.Text = "Cancel";
//
// buttonMoveUp
//
this.buttonMoveUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonMoveUp.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonMoveUp.Location = new System.Drawing.Point(240, 128);
this.buttonMoveUp.Name = "buttonMoveUp";
this.buttonMoveUp.TabIndex = 9;
this.buttonMoveUp.Text = "Move up";
this.buttonMoveUp.Click += new System.EventHandler(this.buttonMoveUp_Click);
//
// buttonDelete
//
this.buttonDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonDelete.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonDelete.Location = new System.Drawing.Point(240, 88);
this.buttonDelete.Name = "buttonDelete";
this.buttonDelete.TabIndex = 8;
this.buttonDelete.Text = "Delete";
this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
//
// buttonMoveDown
//
this.buttonMoveDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonMoveDown.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonMoveDown.Location = new System.Drawing.Point(240, 168);
this.buttonMoveDown.Name = "buttonMoveDown";
this.buttonMoveDown.TabIndex = 10;
this.buttonMoveDown.Text = "Move down";
this.buttonMoveDown.Click += new System.EventHandler(this.buttonMoveDown_Click);
//
// buttonNew
//
this.buttonNew.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonNew.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonNew.Location = new System.Drawing.Point(240, 8);
this.buttonNew.Name = "buttonNew";
this.buttonNew.TabIndex = 6;
this.buttonNew.Text = "New";
this.buttonNew.Click += new System.EventHandler(this.buttonNew_Click);
//
// buttonEdit
//
this.buttonEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buttonEdit.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buttonEdit.Location = new System.Drawing.Point(240, 48);
this.buttonEdit.Name = "buttonEdit";
this.buttonEdit.TabIndex = 7;
this.buttonEdit.Text = "Edit";
this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);
//
// CDlgAlgorithmReferences
//
this.AcceptButton = this.buttonOK;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(328, 254);
this.Controls.Add(this.buttonMoveUp);
this.Controls.Add(this.buttonDelete);
this.Controls.Add(this.buttonMoveDown);
this.Controls.Add(this.buttonNew);
this.Controls.Add(this.buttonEdit);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.listReferences);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "CDlgAlgorithmReferences";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Algorithm References";
this.ResumeLayout(false);
}
#endregion
private void SetFromAlgorithms()
{
foreach ( string s in _Algorithms.ReferencedAssemblies )
listReferences.Items.Add( s );
}
private void buttonNew_Click(object sender, System.EventArgs e)
{
CDlgAlgorithmReferencesSelect dlg = new CDlgAlgorithmReferencesSelect( null );
if ( dlg.ShowDialog( this ) != DialogResult.OK ) return;
if ( dlg.sReference.Length == 0 ) return;
listReferences.Items.Add( dlg.sReference );
}
private void buttonEdit_Click(object sender, System.EventArgs e)
{
Edit();
}
private void listReferences_DoubleClick(object sender, System.EventArgs e)
{
Edit();
}
private void Edit()
{
int i = listReferences.SelectedIndex;
if ( i < 0 ) return;
object o = listReferences.SelectedItem;
CDlgAlgorithmReferencesSelect dlg = new CDlgAlgorithmReferencesSelect( o.ToString() );
if ( dlg.ShowDialog( this ) != DialogResult.OK ) return;
if ( dlg.sReference.Length == 0 ) return;
listReferences.Items.RemoveAt( i );
listReferences.Items.Insert( i, dlg.sReference );
listReferences.SelectedIndex = i;
}
private void buttonDelete_Click(object sender, System.EventArgs e)
{
int i = listReferences.SelectedIndex;
if ( i < 0 ) return;
listReferences.Items.RemoveAt( i );
}
private void buttonMoveUp_Click(object sender, System.EventArgs e)
{
int i = listReferences.SelectedIndex;
if ( i <= 0 ) return;
object o = listReferences.SelectedItem;
listReferences.Items.RemoveAt( i );
listReferences.Items.Insert( i-1, o );
listReferences.SelectedItem = o;
}
private void buttonMoveDown_Click(object sender, System.EventArgs e)
{
int i = listReferences.SelectedIndex;
if ( i < 0 ) return;
if ( i >= listReferences.Items.Count-1 ) return;
object o = listReferences.SelectedItem;
listReferences.Items.RemoveAt( i );
listReferences.Items.Insert( i+1, o );
listReferences.SelectedItem = o;
}
private void buttonOK_Click(object sender, System.EventArgs e)
{
_Algorithms.ClearAssemblyReferences();
foreach ( string s in listReferences.Items )
_Algorithms.AddAssemblyReference( s );
}
}
}
|
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.
I discovered C# and .NET 1.0 Beta 1 in late 2000 and loved them immediately.
I have been writing software professionally in C# ever since
In real life, I have spent 3 years travelling abroad,
I have held a UK Private Pilots Licence for 20 years,
and I am a PADI Divemaster.
I now live near idyllic Bournemouth in England.
I can work 'virtually' anywhere!