416 lines
14 KiB
C#
416 lines
14 KiB
C#
/*********************************************************************************************
|
|
* Copyright 2004 - Volian Enterprises, Inc. All rights reserved.
|
|
* Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
|
* ------------------------------------------------------------------------------
|
|
* $Workfile: PrcProperties.cs $ $Revision: 2 $
|
|
* $Author: Kathy $ $Date: 2/10/05 12:36p $
|
|
*
|
|
* $History: PrcProperties.cs $
|
|
*
|
|
* ***************** Version 2 *****************
|
|
* User: Kathy Date: 2/10/05 Time: 12:36p
|
|
* Updated in $/LibSource/VEObject
|
|
* B2005-012: No apply button for new
|
|
*
|
|
* ***************** Version 1 *****************
|
|
* User: Kathy Date: 7/27/04 Time: 8:53a
|
|
* Created in $/LibSource/VEObject
|
|
*********************************************************************************************/
|
|
/*********************************************************************************************
|
|
* Copyright 2004 - Volian Enterprises, Inc. All rights reserved.
|
|
* Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
|
* ------------------------------------------------------------------------------
|
|
* $Workfile: PrcProperties.cs $ $Revision: 2 $
|
|
* $Author: Kathy $ $Date: 2/10/05 12:36p $
|
|
*
|
|
* $History: PrcProperties.cs $
|
|
*
|
|
* ***************** Version 2 *****************
|
|
* User: Kathy Date: 2/10/05 Time: 12:36p
|
|
* Updated in $/LibSource/VEObject
|
|
* B2005-012: No apply button for new
|
|
*
|
|
* ***************** Version 1 *****************
|
|
* User: Kathy Date: 7/27/04 Time: 8:53a
|
|
* Created in $/LibSource/VEObject
|
|
*********************************************************************************************/
|
|
|
|
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
|
|
namespace VEObject
|
|
{
|
|
/// <summary>
|
|
/// Summary description for PrcProperties.
|
|
/// </summary>
|
|
public class PrcProperties : System.Windows.Forms.Form
|
|
{
|
|
private System.Windows.Forms.TabPage generalTPage;
|
|
private System.Windows.Forms.Button btnOK;
|
|
private System.Windows.Forms.Button btnCancel;
|
|
private System.Windows.Forms.Button btnApply;
|
|
private System.Windows.Forms.TabControl tabCtlProc;
|
|
private PropertyGrid genPropertyGrid;
|
|
private PropertyGrid extPropertyGrid;
|
|
private VEO_Base ParentObj;
|
|
private VEO_Base ProcObj;
|
|
private VEO_Base ProcExtObj;
|
|
private bool isnew;
|
|
private bool dosuffix;
|
|
private System.Windows.Forms.TabPage ExtTPage;
|
|
public GridItem CurrentGridItem;
|
|
private System.Windows.Forms.Label lblSuffix;
|
|
private System.Windows.Forms.ComboBox cmbSuffix;
|
|
private bool canedit;
|
|
/// <summary>
|
|
/// Required designer variable.
|
|
/// </summary>
|
|
private System.ComponentModel.Container components = null;
|
|
|
|
public PrcProperties(Object par, Object prc, Object ext)
|
|
{
|
|
ParentObj = (VEO_Base) par;
|
|
ProcObj = (VEO_Base) prc;
|
|
ProcExtObj = (VEO_Base) ext;
|
|
if(ProcObj.isNew)
|
|
isnew=true;
|
|
else
|
|
isnew=false;
|
|
|
|
//
|
|
// Required for Windows Form Designer support
|
|
//
|
|
InitializeComponent();
|
|
|
|
this.genPropertyGrid.SelectedObject=prc;
|
|
if (ext != null)
|
|
{
|
|
this.extPropertyGrid.SelectedObject=ext;
|
|
if (this.tabCtlProc.TabPages.Count<2)this.tabCtlProc.TabPages.Add(ExtTPage);
|
|
}
|
|
else
|
|
this.tabCtlProc.TabPages.Remove(ExtTPage);
|
|
|
|
// make apply button visible if modify
|
|
this.btnApply.Visible = !isnew;
|
|
|
|
// if the parent has suffixes as part of format, then
|
|
// turn visibility on to the suffix combo box & label, and
|
|
// add each character to the suffix combo box & set current
|
|
// value.
|
|
|
|
VEO_ProcSet ps = (VEO_ProcSet) ParentObj.parentObj;
|
|
if (ps.SuffixFlags != null && ps.SuffixFlags != "")
|
|
{
|
|
dosuffix=true;
|
|
this.lblSuffix.Visible=true;
|
|
this.cmbSuffix.Visible=true;
|
|
this.cmbSuffix.Items.Add("blank");
|
|
for (int i=0; i<ps.SuffixFlags.Length; i++)
|
|
this.cmbSuffix.Items.Add(ps.SuffixFlags.Substring(i,1));
|
|
VEO_Proc lprc = (VEO_Proc) ProcObj;
|
|
|
|
this.cmbSuffix.SelectedIndex = 0;
|
|
if (lprc._ProcCode != null && lprc._ProcCode != "")
|
|
{
|
|
for(int i=0;i<ps.SuffixFlags.Length; i++)
|
|
{
|
|
if(lprc._ProcCode==this.cmbSuffix.Items[i].ToString())
|
|
{
|
|
this.cmbSuffix.SelectedIndex = i;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.lblSuffix.Visible=false;
|
|
this.cmbSuffix.Visible=false;
|
|
dosuffix=false;
|
|
}
|
|
if((ProcObj.canEdit()==false)&&!isnew)
|
|
{
|
|
canedit=false;
|
|
this.genPropertyGrid.Enabled=false;
|
|
this.extPropertyGrid.Enabled=false;
|
|
this.cmbSuffix.Enabled=false;
|
|
}
|
|
else
|
|
{
|
|
canedit=true;
|
|
this.genPropertyGrid.Enabled=true;
|
|
this.extPropertyGrid.Enabled=true;
|
|
this.cmbSuffix.Enabled=true;
|
|
}
|
|
this.btnApply.Enabled=false;
|
|
// make apply button visible if modify
|
|
this.btnApply.Visible = !isnew;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
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(PrcProperties));
|
|
this.tabCtlProc = new System.Windows.Forms.TabControl();
|
|
this.generalTPage = new System.Windows.Forms.TabPage();
|
|
this.genPropertyGrid = new System.Windows.Forms.PropertyGrid();
|
|
this.ExtTPage = new System.Windows.Forms.TabPage();
|
|
this.extPropertyGrid = new System.Windows.Forms.PropertyGrid();
|
|
this.btnOK = new System.Windows.Forms.Button();
|
|
this.btnCancel = new System.Windows.Forms.Button();
|
|
this.btnApply = new System.Windows.Forms.Button();
|
|
this.cmbSuffix = new System.Windows.Forms.ComboBox();
|
|
this.lblSuffix = new System.Windows.Forms.Label();
|
|
this.tabCtlProc.SuspendLayout();
|
|
this.generalTPage.SuspendLayout();
|
|
this.ExtTPage.SuspendLayout();
|
|
this.SuspendLayout();
|
|
//
|
|
// tabCtlProc
|
|
//
|
|
this.tabCtlProc.Controls.Add(this.generalTPage);
|
|
this.tabCtlProc.Controls.Add(this.ExtTPage);
|
|
this.tabCtlProc.Location = new System.Drawing.Point(0, 0);
|
|
this.tabCtlProc.Name = "tabCtlProc";
|
|
this.tabCtlProc.SelectedIndex = 0;
|
|
this.tabCtlProc.Size = new System.Drawing.Size(704, 192);
|
|
this.tabCtlProc.TabIndex = 0;
|
|
//
|
|
// generalTPage
|
|
//
|
|
this.generalTPage.Controls.Add(this.genPropertyGrid);
|
|
this.generalTPage.Location = new System.Drawing.Point(4, 22);
|
|
this.generalTPage.Name = "generalTPage";
|
|
this.generalTPage.Size = new System.Drawing.Size(696, 166);
|
|
this.generalTPage.TabIndex = 0;
|
|
this.generalTPage.Text = "General";
|
|
//
|
|
// genPropertyGrid
|
|
//
|
|
this.genPropertyGrid.CommandsVisibleIfAvailable = true;
|
|
this.genPropertyGrid.Dock = System.Windows.Forms.DockStyle.Top;
|
|
this.genPropertyGrid.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.genPropertyGrid.HelpVisible = false;
|
|
this.genPropertyGrid.LargeButtons = false;
|
|
this.genPropertyGrid.LineColor = System.Drawing.SystemColors.ScrollBar;
|
|
this.genPropertyGrid.Location = new System.Drawing.Point(0, 0);
|
|
this.genPropertyGrid.Name = "genPropertyGrid";
|
|
this.genPropertyGrid.PropertySort = System.Windows.Forms.PropertySort.Categorized;
|
|
this.genPropertyGrid.Size = new System.Drawing.Size(696, 416);
|
|
this.genPropertyGrid.TabIndex = 1;
|
|
this.genPropertyGrid.Text = "Properties";
|
|
this.genPropertyGrid.ToolbarVisible = false;
|
|
this.genPropertyGrid.ViewBackColor = System.Drawing.SystemColors.Window;
|
|
this.genPropertyGrid.ViewForeColor = System.Drawing.SystemColors.WindowText;
|
|
this.genPropertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.genPropertyGrid_PropertyValueChanged);
|
|
//
|
|
// ExtTPage
|
|
//
|
|
this.ExtTPage.Controls.Add(this.extPropertyGrid);
|
|
this.ExtTPage.Location = new System.Drawing.Point(4, 22);
|
|
this.ExtTPage.Name = "ExtTPage";
|
|
this.ExtTPage.Size = new System.Drawing.Size(696, 166);
|
|
this.ExtTPage.TabIndex = 1;
|
|
this.ExtTPage.Text = "Extended";
|
|
//
|
|
// extPropertyGrid
|
|
//
|
|
this.extPropertyGrid.CommandsVisibleIfAvailable = true;
|
|
this.extPropertyGrid.Dock = System.Windows.Forms.DockStyle.Top;
|
|
this.extPropertyGrid.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.extPropertyGrid.HelpVisible = false;
|
|
this.extPropertyGrid.LargeButtons = false;
|
|
this.extPropertyGrid.LineColor = System.Drawing.SystemColors.ScrollBar;
|
|
this.extPropertyGrid.Location = new System.Drawing.Point(0, 0);
|
|
this.extPropertyGrid.Name = "extPropertyGrid";
|
|
this.extPropertyGrid.PropertySort = System.Windows.Forms.PropertySort.Categorized;
|
|
this.extPropertyGrid.Size = new System.Drawing.Size(696, 416);
|
|
this.extPropertyGrid.TabIndex = 0;
|
|
this.extPropertyGrid.Text = "PropertyGrid";
|
|
this.extPropertyGrid.ToolbarVisible = false;
|
|
this.extPropertyGrid.ViewBackColor = System.Drawing.SystemColors.Window;
|
|
this.extPropertyGrid.ViewForeColor = System.Drawing.SystemColors.WindowText;
|
|
this.extPropertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.extPropertyGrid_PropertyValueChanged);
|
|
//
|
|
// btnOK
|
|
//
|
|
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
|
|
this.btnOK.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.btnOK.Location = new System.Drawing.Point(400, 264);
|
|
this.btnOK.Name = "btnOK";
|
|
this.btnOK.Size = new System.Drawing.Size(88, 32);
|
|
this.btnOK.TabIndex = 1;
|
|
this.btnOK.Text = "OK";
|
|
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
|
|
//
|
|
// btnCancel
|
|
//
|
|
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.btnCancel.Location = new System.Drawing.Point(504, 264);
|
|
this.btnCancel.Name = "btnCancel";
|
|
this.btnCancel.Size = new System.Drawing.Size(88, 32);
|
|
this.btnCancel.TabIndex = 2;
|
|
this.btnCancel.Text = "Cancel";
|
|
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
|
//
|
|
// btnApply
|
|
//
|
|
this.btnApply.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.btnApply.Location = new System.Drawing.Point(608, 264);
|
|
this.btnApply.Name = "btnApply";
|
|
this.btnApply.Size = new System.Drawing.Size(88, 32);
|
|
this.btnApply.TabIndex = 3;
|
|
this.btnApply.Text = "Apply";
|
|
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
|
|
//
|
|
// cmbSuffix
|
|
//
|
|
this.cmbSuffix.Location = new System.Drawing.Point(72, 216);
|
|
this.cmbSuffix.Name = "cmbSuffix";
|
|
this.cmbSuffix.Size = new System.Drawing.Size(56, 21);
|
|
this.cmbSuffix.TabIndex = 4;
|
|
this.cmbSuffix.Text = "comboBox1";
|
|
this.cmbSuffix.SelectedIndexChanged += new System.EventHandler(this.cmbSuffix_SelectedIndexChanged);
|
|
//
|
|
// lblSuffix
|
|
//
|
|
this.lblSuffix.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
|
|
this.lblSuffix.Location = new System.Drawing.Point(16, 216);
|
|
this.lblSuffix.Name = "lblSuffix";
|
|
this.lblSuffix.Size = new System.Drawing.Size(48, 16);
|
|
this.lblSuffix.TabIndex = 5;
|
|
this.lblSuffix.Text = "Suffix:";
|
|
//
|
|
// PrcProperties
|
|
//
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
|
this.ClientSize = new System.Drawing.Size(720, 318);
|
|
this.Controls.Add(this.lblSuffix);
|
|
this.Controls.Add(this.cmbSuffix);
|
|
this.Controls.Add(this.btnApply);
|
|
this.Controls.Add(this.btnCancel);
|
|
this.Controls.Add(this.btnOK);
|
|
this.Controls.Add(this.tabCtlProc);
|
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
|
this.Name = "PrcProperties";
|
|
this.Text = "Procedure Properties";
|
|
this.tabCtlProc.ResumeLayout(false);
|
|
this.generalTPage.ResumeLayout(false);
|
|
this.ExtTPage.ResumeLayout(false);
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
#endregion
|
|
private void genPropertyGrid_Click(object sender, System.EventArgs e)
|
|
{
|
|
CurrentGridItem = this.genPropertyGrid.SelectedGridItem;
|
|
}
|
|
|
|
private void extPropertyGrid_Click(object sender, System.EventArgs e)
|
|
{
|
|
CurrentGridItem = this.extPropertyGrid.SelectedGridItem;
|
|
}
|
|
|
|
private void genPropertyGrid_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e)
|
|
{
|
|
btnApply.Enabled = true;
|
|
CurrentGridItem = this.genPropertyGrid.SelectedGridItem;
|
|
}
|
|
|
|
private void extPropertyGrid_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e)
|
|
{
|
|
btnApply.Enabled = true;
|
|
CurrentGridItem = this.extPropertyGrid.SelectedGridItem;
|
|
}
|
|
|
|
// save data for use by ok and apply button clicks
|
|
private bool saveclick()
|
|
{
|
|
bool success = true;
|
|
|
|
// save the suffix if using it. Note that this was done
|
|
// as a separate combo box since fields cannot be removed
|
|
// from the property grid at run time.
|
|
if (dosuffix)
|
|
{
|
|
VEO_Proc prc = (VEO_Proc)ProcObj;
|
|
if (cmbSuffix.SelectedIndex == 0)
|
|
prc._ProcCode = null;
|
|
else
|
|
prc._ProcCode = cmbSuffix.SelectedItem.ToString();
|
|
}
|
|
|
|
if (isnew)
|
|
{
|
|
if(ParentObj==null)
|
|
{
|
|
DialogResult=DialogResult.Cancel;
|
|
return success;
|
|
}
|
|
success=ParentObj.SaveChild(ProcObj);
|
|
}
|
|
else
|
|
{
|
|
success=ProcObj.Write();
|
|
}
|
|
return success;
|
|
}
|
|
|
|
// save was clicked, use the objects save methods.
|
|
private void btnOK_Click(object sender, System.EventArgs e)
|
|
{
|
|
bool success = true;
|
|
if(canedit)success = saveclick();
|
|
if (success==true)
|
|
{
|
|
DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
}
|
|
|
|
private void btnApply_Click(object sender, System.EventArgs e)
|
|
{
|
|
if(canedit)return;
|
|
bool success = saveclick();
|
|
if(success==true)btnApply.Enabled=false;
|
|
Refresh();
|
|
}
|
|
|
|
private void btnCancel_Click(object sender, System.EventArgs e)
|
|
{
|
|
if(!canedit)return;
|
|
ProcObj.Restore();
|
|
}
|
|
|
|
private void cmbSuffix_SelectedIndexChanged(object sender, System.EventArgs e)
|
|
{
|
|
btnApply.Enabled=true;
|
|
}
|
|
|
|
}
|
|
}
|