Procedure 'Export' / 'Import' implemented, ver. 2.12.524
This commit is contained in:
parent
049bbc8655
commit
5ad871a7e0
@ -1,6 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class ComponentProcedure
|
||||
@ -10,13 +13,32 @@ namespace Config.Entities
|
||||
public virtual string Parameters { get; set; }
|
||||
public virtual Procedure Procedure { get; set; }
|
||||
|
||||
public virtual ComponentProcedure Clone()
|
||||
public virtual ComponentProcedure Clone(Procedure newProcedure)
|
||||
{
|
||||
ComponentProcedure result = new ComponentProcedure();
|
||||
result.CmpntName = CmpntName;
|
||||
result.Parameters = Parameters;
|
||||
result.Procedure = Procedure;
|
||||
result.Procedure = newProcedure;
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(CmpntName);
|
||||
output.WriteLine(Parameters.Replace(Environment.NewLine, "~"));
|
||||
}
|
||||
|
||||
public static ComponentProcedure Import(StreamReader input, Procedure newProcedure)
|
||||
{
|
||||
string firstLine = input.ReadLine();
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
ComponentProcedure result = new ComponentProcedure();
|
||||
result.CmpntName = firstLine;
|
||||
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
result.Procedure = newProcedure;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
public class ComponentTest
|
||||
@ -18,5 +21,24 @@ namespace Config.Entities
|
||||
result.Test = Test;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(CmpntName);
|
||||
output.WriteLine(Parameters.Replace(Environment.NewLine, "~"));
|
||||
}
|
||||
|
||||
public static ComponentTest Import(StreamReader input, Test newTest)
|
||||
{
|
||||
string firstLine = input.ReadLine();
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
ComponentTest result = new ComponentTest();
|
||||
result.CmpntName = firstLine;
|
||||
result.Parameters = input.ReadLine().Replace("~", Environment.NewLine);
|
||||
result.Test = newTest;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@ -40,9 +41,6 @@ namespace Config.Entities
|
||||
public virtual IList<ComponentProcedure> MoreParams { get; set; }
|
||||
public virtual IList<Test> Tests { get; set; }
|
||||
|
||||
////public virtual string MetrologicalClass { get; set; }
|
||||
////public virtual IList<WMType> WMTypes { get; set; }
|
||||
|
||||
/// ------------- Additional stuff not mapped into the database -------------
|
||||
|
||||
public Procedure()
|
||||
@ -96,11 +94,77 @@ namespace Config.Entities
|
||||
result.TransitionStart = TransitionStart;
|
||||
result.TransitionEnd = TransitionEnd;
|
||||
|
||||
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone()); }
|
||||
foreach (var prms in MoreParams) { result.MoreParams.Add(prms.Clone(result)); }
|
||||
foreach (var test in Tests) { result.Tests.Add(test.Clone()); }
|
||||
|
||||
//result.MetrologicalClass = MetrologicalClass;
|
||||
//result.WMType = WMType.Clone();
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(ItemNr.ToString());
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(Description);
|
||||
output.WriteLine(CreationUser);
|
||||
output.WriteLine(CreationTime.ToString());
|
||||
output.WriteLine(LastChgUser);
|
||||
output.WriteLine(LastChgTime.ToString());
|
||||
output.WriteLine(MetersKind.ToString());
|
||||
output.WriteLine(Watermeters);
|
||||
output.WriteLine(ProtocolTitle);
|
||||
output.WriteLine(DataEntry);
|
||||
output.WriteLine(ResultsPrinter);
|
||||
output.WriteLine(ResultsWriter);
|
||||
output.WriteLine(TransitionStart);
|
||||
output.WriteLine(TransitionEnd);
|
||||
|
||||
foreach (var prms in MoreParams) { prms.Export(output); }
|
||||
output.WriteLine();
|
||||
|
||||
foreach (var test in Tests) { test.Export(output); }
|
||||
output.WriteLine();
|
||||
|
||||
output.Close();
|
||||
}
|
||||
|
||||
public static Procedure Import(StreamReader input)
|
||||
{
|
||||
Procedure result = new Procedure();
|
||||
|
||||
result.ItemNr = int.Parse(input.ReadLine());
|
||||
result.Name = input.ReadLine();
|
||||
result.Description = input.ReadLine();
|
||||
result.CreationUser = input.ReadLine();
|
||||
result.CreationTime = DateTime.Parse(input.ReadLine());
|
||||
result.LastChgUser = input.ReadLine();
|
||||
result.LastChgTime = DateTime.Parse(input.ReadLine());
|
||||
string line = input.ReadLine();
|
||||
result.MetersKind = line.Equals(MetersKind.Single.ToString()) ? MetersKind.Single : (line.Equals(MetersKind.Combined.ToString()) ? MetersKind.Combined : MetersKind.HeatMeter);
|
||||
result.Watermeters = input.ReadLine();
|
||||
result.ProtocolTitle = input.ReadLine();
|
||||
result.DataEntry = input.ReadLine();
|
||||
result.ResultsPrinter = input.ReadLine();
|
||||
result.ResultsWriter = input.ReadLine();
|
||||
result.TransitionStart = input.ReadLine();
|
||||
result.TransitionEnd = input.ReadLine();
|
||||
|
||||
while(true)
|
||||
{
|
||||
ComponentProcedure prms = ComponentProcedure.Import(input, result);
|
||||
if (prms == null)
|
||||
break;
|
||||
else
|
||||
result.MoreParams.Add(prms);
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
Test tst = Test.Import(input, result);
|
||||
if (tst == null)
|
||||
break;
|
||||
else
|
||||
result.Tests.Add(tst);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
///
|
||||
/// Copyright (c) 2013-2015 Sensus Metering Systems
|
||||
/// Author: Milan Hanajik
|
||||
/// Copyright (c) 2013-2017 Sensus Metering Systems
|
||||
///
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Config.Entities
|
||||
{
|
||||
@ -22,7 +22,7 @@ namespace Config.Entities
|
||||
public virtual float Qfrom { get; set; } /// Water flow low limit in [m3/h]
|
||||
public virtual float Qto { get; set; } /// Water flow high limit in [m3/h]
|
||||
public virtual float Volume { get; set; } /// Test volume (target) in [l]
|
||||
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
|
||||
public virtual float TstTime { get; set; } /// Test time (estimate) in [s]
|
||||
public virtual string Method { get; set; }
|
||||
public virtual float ErrLimLo { get; set; } /// in [%] (usually < 0)
|
||||
public virtual float ErrLimHi { get; set; } /// in [%] (usually > 0)
|
||||
@ -141,6 +141,96 @@ namespace Config.Entities
|
||||
return result;
|
||||
}
|
||||
|
||||
public virtual void Export(StreamWriter output)
|
||||
{
|
||||
output.WriteLine(Name);
|
||||
output.WriteLine(Part.ToString());
|
||||
output.WriteLine(Publish.ToString());
|
||||
output.WriteLine(Evaluate.ToString());
|
||||
output.WriteLine(Qfrom.ToString());
|
||||
output.WriteLine(Qto.ToString());
|
||||
output.WriteLine(Volume.ToString());
|
||||
output.WriteLine(TstTime.ToString());
|
||||
output.WriteLine(Method);
|
||||
output.WriteLine(ErrLimLo.ToString());
|
||||
output.WriteLine(ErrLimHi.ToString());
|
||||
output.WriteLine(Uncertainty.ToString());
|
||||
output.WriteLine(Repeats.ToString());
|
||||
output.WriteLine(Draining.ToString());
|
||||
output.WriteLine(Zeroing.ToString());
|
||||
output.WriteLine(PumpPower.ToString());
|
||||
output.WriteLine(MassRepeats.ToString());
|
||||
output.WriteLine(MassSpread.ToString());
|
||||
output.WriteLine(((byte)MassMethod).ToString());
|
||||
output.WriteLine(TimeBeforeFlow.ToString());
|
||||
output.WriteLine(TimeFlow2Mass.ToString());
|
||||
output.WriteLine(TimePump2StartV.ToString());
|
||||
output.WriteLine(TimeStop2Mass.ToString());
|
||||
output.WriteLine(FeedingPath);
|
||||
output.WriteLine(BenchPath);
|
||||
output.WriteLine(OutputPath);
|
||||
output.WriteLine(MetersPath);
|
||||
output.WriteLine(RelTransBefore);
|
||||
output.WriteLine(RelTransBetween);
|
||||
output.WriteLine(RelTransAfter);
|
||||
output.WriteLine(TransitionAfter);
|
||||
|
||||
foreach (var prms in MoreParams) { prms.Export(output); }
|
||||
output.WriteLine();
|
||||
}
|
||||
|
||||
public static Test Import(StreamReader input, Procedure newProcedure)
|
||||
{
|
||||
string firstLine = input.ReadLine();
|
||||
|
||||
if (string.IsNullOrEmpty(firstLine)) return null;
|
||||
|
||||
Test tst = new Test();
|
||||
tst.Name = firstLine;
|
||||
tst.Part = int.Parse(input.ReadLine());
|
||||
tst.Publish = sbyte.Parse(input.ReadLine());
|
||||
tst.Evaluate = bool.Parse(input.ReadLine());
|
||||
tst.Qfrom = float.Parse(input.ReadLine());
|
||||
tst.Qto = float.Parse(input.ReadLine());
|
||||
tst.Volume = float.Parse(input.ReadLine());
|
||||
tst.TstTime = float.Parse(input.ReadLine());
|
||||
tst.Method = input.ReadLine();
|
||||
tst.ErrLimLo = float.Parse(input.ReadLine());
|
||||
tst.ErrLimHi = float.Parse(input.ReadLine());
|
||||
tst.Uncertainty = float.Parse(input.ReadLine());
|
||||
tst.Repeats = int.Parse(input.ReadLine());
|
||||
tst.Draining = bool.Parse(input.ReadLine());
|
||||
tst.Zeroing = bool.Parse(input.ReadLine());
|
||||
tst.PumpPower = float.Parse(input.ReadLine());
|
||||
tst.MassRepeats = int.Parse(input.ReadLine());
|
||||
tst.MassSpread = float.Parse(input.ReadLine());
|
||||
tst.MassMethod = (MassMethod)byte.Parse(input.ReadLine());
|
||||
tst.TimeBeforeFlow = int.Parse(input.ReadLine());
|
||||
tst.TimeFlow2Mass = int.Parse(input.ReadLine());
|
||||
tst.TimePump2StartV = int.Parse(input.ReadLine());
|
||||
tst.TimeStop2Mass = int.Parse(input.ReadLine());
|
||||
tst.FeedingPath = input.ReadLine();
|
||||
tst.BenchPath = input.ReadLine();
|
||||
tst.OutputPath = input.ReadLine();
|
||||
tst.MetersPath = input.ReadLine();
|
||||
tst.RelTransBefore = input.ReadLine();
|
||||
tst.RelTransBetween = input.ReadLine();
|
||||
tst.RelTransAfter = input.ReadLine();
|
||||
tst.TransitionAfter = input.ReadLine();
|
||||
|
||||
while (true)
|
||||
{
|
||||
ComponentTest prms = ComponentTest.Import(input, tst);
|
||||
if (prms == null)
|
||||
break;
|
||||
else
|
||||
tst.MoreParams.Add(prms);
|
||||
}
|
||||
|
||||
tst.Procedure = newProcedure;
|
||||
return tst;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string partStr = (Part > 0) ? string.Format(", part {0}", Part) : string.Empty;
|
||||
|
||||
2
TestBenchFramework/ProceduresDlg.Designer.cs
generated
2
TestBenchFramework/ProceduresDlg.Designer.cs
generated
@ -76,7 +76,7 @@ namespace TBF
|
||||
//
|
||||
this.sharedButtons.Location = new System.Drawing.Point(1, 0);
|
||||
this.sharedButtons.Name = "sharedButtons";
|
||||
this.sharedButtons.Size = new System.Drawing.Size(100, 521);
|
||||
this.sharedButtons.Size = new System.Drawing.Size(100, 649);
|
||||
this.sharedButtons.TabIndex = 0;
|
||||
//
|
||||
// ProceduresDlg
|
||||
|
||||
@ -29,7 +29,8 @@ namespace TBF
|
||||
sharedButtons.RequiredGroupMembership = Users.Grp.GID.TestingSpecialists;
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add | SharedButtons.Buttons.Remove |
|
||||
SharedButtons.Buttons.Up | SharedButtons.Buttons.Down |
|
||||
SharedButtons.Buttons.Edit | SharedButtons.Buttons.Copy;
|
||||
SharedButtons.Buttons.Edit | SharedButtons.Buttons.Copy |
|
||||
SharedButtons.Buttons.Export | SharedButtons.Buttons.Import;
|
||||
|
||||
sharedButtons.Unlocked += Unlocked;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
@ -40,7 +41,9 @@ namespace TBF
|
||||
sharedButtons.DownClicked += downButton_Click;
|
||||
sharedButtons.EditClicked += proceduresCtrl.editButton_Click;
|
||||
sharedButtons.CopyClicked += proceduresCtrl.copyButton_Click;
|
||||
}
|
||||
sharedButtons.ExportClicked += proceduresCtrl.exportButton_Click;
|
||||
sharedButtons.ImportClicked += proceduresCtrl.importButton_Click;
|
||||
}
|
||||
|
||||
private void ProceduresDlg_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.12.521.1")]
|
||||
[assembly: AssemblyFileVersion("2.12.521.1")]
|
||||
[assembly: AssemblyVersion("2.12.524.1")]
|
||||
[assembly: AssemblyFileVersion("2.12.524.1")]
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using NHibernate;
|
||||
using log4net;
|
||||
@ -304,5 +305,58 @@ namespace TBF.UiControls
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void exportButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (SelectedItems.Count != 1) return;
|
||||
|
||||
Procedure selectedProcedure = (Procedure)SelectedItems[0].Tag;
|
||||
|
||||
SaveFileDialog dlg = new SaveFileDialog();
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
selectedProcedure.Export(new StreamWriter(dlg.FileName, false, System.Text.Encoding.UTF8));
|
||||
}
|
||||
}
|
||||
|
||||
public void importButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
|
||||
if (dlg.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
/// Import a procedure from a file
|
||||
Procedure newProcedure = Procedure.Import(new StreamReader(dlg.FileName, System.Text.Encoding.UTF8));
|
||||
|
||||
newProcedure.Name = newProcedure.Name + " imported";
|
||||
newProcedure.ItemNr = MyItems.Count;
|
||||
newProcedure.ProcedureState = ProcedureState.Active;
|
||||
newProcedure.Revision = 1;
|
||||
newProcedure.PredecessorId = 0;
|
||||
newProcedure.ObtainedByCopy = false;
|
||||
newProcedure.CreationUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.CreationTime = DateTime.Now;
|
||||
|
||||
if ((new ProcedureDlg(newProcedure)).ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
/// TODO: Make name uniqueness test
|
||||
parent.Unlock();
|
||||
|
||||
using (var transaction = session.BeginTransaction())
|
||||
{
|
||||
newProcedure.LastChgUser = Users.GlobalData.CurrentUser.UserName;
|
||||
newProcedure.LastChgTime = DateTime.Now;
|
||||
|
||||
base.AddOne(newProcedure);
|
||||
session.SaveOrUpdate(newProcedure);
|
||||
transaction.Commit();
|
||||
|
||||
MessageBox.Show(string.Format(Strings.Procedure_0_added, newProcedure.Name),
|
||||
Strings.Confirmation,
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
386
TestBenchFramework/UiControls/SharedButtons.Designer.cs
generated
386
TestBenchFramework/UiControls/SharedButtons.Designer.cs
generated
@ -31,185 +31,211 @@ namespace TBF.UiControls
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.removeButton = new System.Windows.Forms.Button();
|
||||
this.addButton = new System.Windows.Forms.Button();
|
||||
this.unlockButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.upButton = new System.Windows.Forms.Button();
|
||||
this.downButton = new System.Windows.Forms.Button();
|
||||
this.editButton = new System.Windows.Forms.Button();
|
||||
this.copyButton = new System.Windows.Forms.Button();
|
||||
this.newTabButton = new System.Windows.Forms.Button();
|
||||
this.renameTabButton = new System.Windows.Forms.Button();
|
||||
this.removeTabButton = new System.Windows.Forms.Button();
|
||||
this.moreButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// removeButton
|
||||
//
|
||||
this.removeButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.removeButton.Location = new System.Drawing.Point(10, 179);
|
||||
this.removeButton.Name = "removeButton";
|
||||
this.removeButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.removeButton.TabIndex = 4;
|
||||
this.removeButton.Text = " Remove";
|
||||
this.removeButton.UseVisualStyleBackColor = true;
|
||||
this.removeButton.Click += new System.EventHandler(this.removeBtn_Click);
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.addButton.Location = new System.Drawing.Point(10, 136);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.addButton.TabIndex = 3;
|
||||
this.addButton.Text = " Add";
|
||||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addBtn_Click);
|
||||
//
|
||||
// unlockButton
|
||||
//
|
||||
this.unlockButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.unlockButton.Location = new System.Drawing.Point(10, 7);
|
||||
this.unlockButton.Name = "unlockButton";
|
||||
this.unlockButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.unlockButton.TabIndex = 0;
|
||||
this.unlockButton.Text = "Unlock";
|
||||
this.unlockButton.UseVisualStyleBackColor = true;
|
||||
this.unlockButton.Click += new System.EventHandler(this.unlockBtn_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.cancelButton.Location = new System.Drawing.Point(10, 93);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelBtn_Click);
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.okButton.Location = new System.Drawing.Point(10, 50);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.okButton.TabIndex = 1;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okBtn_Click);
|
||||
//
|
||||
// upButton
|
||||
//
|
||||
this.upButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.upButton.Location = new System.Drawing.Point(10, 222);
|
||||
this.upButton.Name = "upButton";
|
||||
this.upButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.upButton.TabIndex = 5;
|
||||
this.upButton.Text = " Up";
|
||||
this.upButton.UseVisualStyleBackColor = true;
|
||||
this.upButton.Click += new System.EventHandler(this.upBtn_Click);
|
||||
//
|
||||
// downButton
|
||||
//
|
||||
this.downButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.downButton.Location = new System.Drawing.Point(10, 265);
|
||||
this.downButton.Name = "downButton";
|
||||
this.downButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.downButton.TabIndex = 6;
|
||||
this.downButton.Text = " Down";
|
||||
this.downButton.UseVisualStyleBackColor = true;
|
||||
this.downButton.Click += new System.EventHandler(this.downBtn_Click);
|
||||
//
|
||||
// editButton
|
||||
//
|
||||
this.editButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.editButton.Location = new System.Drawing.Point(10, 308);
|
||||
this.editButton.Name = "editButton";
|
||||
this.editButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.editButton.TabIndex = 7;
|
||||
this.editButton.Text = " Edit";
|
||||
this.editButton.UseVisualStyleBackColor = true;
|
||||
this.editButton.Click += new System.EventHandler(this.editBtn_Click);
|
||||
//
|
||||
// copyButton
|
||||
//
|
||||
this.copyButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.copyButton.Location = new System.Drawing.Point(10, 351);
|
||||
this.copyButton.Name = "copyButton";
|
||||
this.copyButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.copyButton.TabIndex = 8;
|
||||
this.copyButton.Text = " Copy";
|
||||
this.copyButton.UseVisualStyleBackColor = true;
|
||||
this.copyButton.Click += new System.EventHandler(this.copyBtn_Click);
|
||||
//
|
||||
// newTabButton
|
||||
//
|
||||
this.newTabButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.newTabButton.Location = new System.Drawing.Point(10, 394);
|
||||
this.newTabButton.Name = "newTabButton";
|
||||
this.newTabButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.newTabButton.TabIndex = 9;
|
||||
this.newTabButton.Text = "New Tab";
|
||||
this.newTabButton.UseVisualStyleBackColor = true;
|
||||
this.newTabButton.Click += new System.EventHandler(this.newTabButton_Click);
|
||||
//
|
||||
// renameTabButton
|
||||
//
|
||||
this.renameTabButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.renameTabButton.Location = new System.Drawing.Point(10, 437);
|
||||
this.renameTabButton.Name = "renameTabButton";
|
||||
this.renameTabButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.renameTabButton.TabIndex = 10;
|
||||
this.renameTabButton.Text = "Rename Tab";
|
||||
this.renameTabButton.UseVisualStyleBackColor = true;
|
||||
this.renameTabButton.Click += new System.EventHandler(this.renameTabButton_Click);
|
||||
//
|
||||
// removeTabButton
|
||||
//
|
||||
this.removeTabButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.removeTabButton.Location = new System.Drawing.Point(10, 480);
|
||||
this.removeTabButton.Name = "removeTabButton";
|
||||
this.removeTabButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.removeTabButton.TabIndex = 11;
|
||||
this.removeTabButton.Text = "Remove Tab";
|
||||
this.removeTabButton.UseVisualStyleBackColor = true;
|
||||
this.removeTabButton.Click += new System.EventHandler(this.removeTabButton_Click);
|
||||
//
|
||||
// moreButton
|
||||
//
|
||||
this.moreButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.moreButton.Location = new System.Drawing.Point(10, 523);
|
||||
this.moreButton.Name = "moreButton";
|
||||
this.moreButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.moreButton.TabIndex = 12;
|
||||
this.moreButton.Text = "More";
|
||||
this.moreButton.UseVisualStyleBackColor = true;
|
||||
this.moreButton.Click += new System.EventHandler(this.moreButton_Click);
|
||||
//
|
||||
// SharedButtons
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.moreButton);
|
||||
this.Controls.Add(this.removeTabButton);
|
||||
this.Controls.Add(this.renameTabButton);
|
||||
this.Controls.Add(this.newTabButton);
|
||||
this.Controls.Add(this.copyButton);
|
||||
this.Controls.Add(this.editButton);
|
||||
this.Controls.Add(this.downButton);
|
||||
this.Controls.Add(this.upButton);
|
||||
this.Controls.Add(this.removeButton);
|
||||
this.Controls.Add(this.addButton);
|
||||
this.Controls.Add(this.unlockButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Name = "SharedButtons";
|
||||
this.Size = new System.Drawing.Size(100, 649);
|
||||
this.Load += new System.EventHandler(this.SharedDlgButtons_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.removeButton = new System.Windows.Forms.Button();
|
||||
this.addButton = new System.Windows.Forms.Button();
|
||||
this.unlockButton = new System.Windows.Forms.Button();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.upButton = new System.Windows.Forms.Button();
|
||||
this.downButton = new System.Windows.Forms.Button();
|
||||
this.editButton = new System.Windows.Forms.Button();
|
||||
this.copyButton = new System.Windows.Forms.Button();
|
||||
this.newTabButton = new System.Windows.Forms.Button();
|
||||
this.renameTabButton = new System.Windows.Forms.Button();
|
||||
this.removeTabButton = new System.Windows.Forms.Button();
|
||||
this.moreButton = new System.Windows.Forms.Button();
|
||||
this.exportButton = new System.Windows.Forms.Button();
|
||||
this.importButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// removeButton
|
||||
//
|
||||
this.removeButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.removeButton.Location = new System.Drawing.Point(10, 179);
|
||||
this.removeButton.Name = "removeButton";
|
||||
this.removeButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.removeButton.TabIndex = 4;
|
||||
this.removeButton.Text = " Remove";
|
||||
this.removeButton.UseVisualStyleBackColor = true;
|
||||
this.removeButton.Click += new System.EventHandler(this.removeBtn_Click);
|
||||
//
|
||||
// addButton
|
||||
//
|
||||
this.addButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.addButton.Location = new System.Drawing.Point(10, 136);
|
||||
this.addButton.Name = "addButton";
|
||||
this.addButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.addButton.TabIndex = 3;
|
||||
this.addButton.Text = " Add";
|
||||
this.addButton.UseVisualStyleBackColor = true;
|
||||
this.addButton.Click += new System.EventHandler(this.addBtn_Click);
|
||||
//
|
||||
// unlockButton
|
||||
//
|
||||
this.unlockButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.unlockButton.Location = new System.Drawing.Point(10, 7);
|
||||
this.unlockButton.Name = "unlockButton";
|
||||
this.unlockButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.unlockButton.TabIndex = 0;
|
||||
this.unlockButton.Text = "Unlock";
|
||||
this.unlockButton.UseVisualStyleBackColor = true;
|
||||
this.unlockButton.Click += new System.EventHandler(this.unlockBtn_Click);
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.cancelButton.Location = new System.Drawing.Point(10, 93);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.cancelButton.TabIndex = 2;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelBtn_Click);
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.okButton.Location = new System.Drawing.Point(10, 50);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.okButton.TabIndex = 1;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okBtn_Click);
|
||||
//
|
||||
// upButton
|
||||
//
|
||||
this.upButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.upButton.Location = new System.Drawing.Point(10, 222);
|
||||
this.upButton.Name = "upButton";
|
||||
this.upButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.upButton.TabIndex = 5;
|
||||
this.upButton.Text = " Up";
|
||||
this.upButton.UseVisualStyleBackColor = true;
|
||||
this.upButton.Click += new System.EventHandler(this.upBtn_Click);
|
||||
//
|
||||
// downButton
|
||||
//
|
||||
this.downButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.downButton.Location = new System.Drawing.Point(10, 265);
|
||||
this.downButton.Name = "downButton";
|
||||
this.downButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.downButton.TabIndex = 6;
|
||||
this.downButton.Text = " Down";
|
||||
this.downButton.UseVisualStyleBackColor = true;
|
||||
this.downButton.Click += new System.EventHandler(this.downBtn_Click);
|
||||
//
|
||||
// editButton
|
||||
//
|
||||
this.editButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.editButton.Location = new System.Drawing.Point(10, 308);
|
||||
this.editButton.Name = "editButton";
|
||||
this.editButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.editButton.TabIndex = 7;
|
||||
this.editButton.Text = " Edit";
|
||||
this.editButton.UseVisualStyleBackColor = true;
|
||||
this.editButton.Click += new System.EventHandler(this.editBtn_Click);
|
||||
//
|
||||
// copyButton
|
||||
//
|
||||
this.copyButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.copyButton.Location = new System.Drawing.Point(10, 351);
|
||||
this.copyButton.Name = "copyButton";
|
||||
this.copyButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.copyButton.TabIndex = 8;
|
||||
this.copyButton.Text = " Copy";
|
||||
this.copyButton.UseVisualStyleBackColor = true;
|
||||
this.copyButton.Click += new System.EventHandler(this.copyBtn_Click);
|
||||
//
|
||||
// newTabButton
|
||||
//
|
||||
this.newTabButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.newTabButton.Location = new System.Drawing.Point(10, 394);
|
||||
this.newTabButton.Name = "newTabButton";
|
||||
this.newTabButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.newTabButton.TabIndex = 9;
|
||||
this.newTabButton.Text = "New Tab";
|
||||
this.newTabButton.UseVisualStyleBackColor = true;
|
||||
this.newTabButton.Click += new System.EventHandler(this.newTabButton_Click);
|
||||
//
|
||||
// renameTabButton
|
||||
//
|
||||
this.renameTabButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.renameTabButton.Location = new System.Drawing.Point(10, 437);
|
||||
this.renameTabButton.Name = "renameTabButton";
|
||||
this.renameTabButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.renameTabButton.TabIndex = 10;
|
||||
this.renameTabButton.Text = "Rename Tab";
|
||||
this.renameTabButton.UseVisualStyleBackColor = true;
|
||||
this.renameTabButton.Click += new System.EventHandler(this.renameTabButton_Click);
|
||||
//
|
||||
// removeTabButton
|
||||
//
|
||||
this.removeTabButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.removeTabButton.Location = new System.Drawing.Point(10, 480);
|
||||
this.removeTabButton.Name = "removeTabButton";
|
||||
this.removeTabButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.removeTabButton.TabIndex = 11;
|
||||
this.removeTabButton.Text = "Remove Tab";
|
||||
this.removeTabButton.UseVisualStyleBackColor = true;
|
||||
this.removeTabButton.Click += new System.EventHandler(this.removeTabButton_Click);
|
||||
//
|
||||
// moreButton
|
||||
//
|
||||
this.moreButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.moreButton.Location = new System.Drawing.Point(10, 523);
|
||||
this.moreButton.Name = "moreButton";
|
||||
this.moreButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.moreButton.TabIndex = 12;
|
||||
this.moreButton.Text = "More";
|
||||
this.moreButton.UseVisualStyleBackColor = true;
|
||||
this.moreButton.Click += new System.EventHandler(this.moreButton_Click);
|
||||
//
|
||||
// exportButton
|
||||
//
|
||||
this.exportButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.exportButton.Location = new System.Drawing.Point(10, 415);
|
||||
this.exportButton.Name = "exportButton";
|
||||
this.exportButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.exportButton.TabIndex = 13;
|
||||
this.exportButton.Text = "Export";
|
||||
this.exportButton.UseVisualStyleBackColor = true;
|
||||
this.exportButton.Click += new System.EventHandler(this.exportButton_Click);
|
||||
//
|
||||
// importButton
|
||||
//
|
||||
this.importButton.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.importButton.Location = new System.Drawing.Point(10, 458);
|
||||
this.importButton.Name = "importButton";
|
||||
this.importButton.Size = new System.Drawing.Size(80, 40);
|
||||
this.importButton.TabIndex = 14;
|
||||
this.importButton.Text = "Import";
|
||||
this.importButton.UseVisualStyleBackColor = true;
|
||||
this.importButton.Click += new System.EventHandler(this.importButton_Click);
|
||||
//
|
||||
// SharedButtons
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.importButton);
|
||||
this.Controls.Add(this.exportButton);
|
||||
this.Controls.Add(this.moreButton);
|
||||
this.Controls.Add(this.removeTabButton);
|
||||
this.Controls.Add(this.renameTabButton);
|
||||
this.Controls.Add(this.newTabButton);
|
||||
this.Controls.Add(this.copyButton);
|
||||
this.Controls.Add(this.editButton);
|
||||
this.Controls.Add(this.downButton);
|
||||
this.Controls.Add(this.upButton);
|
||||
this.Controls.Add(this.removeButton);
|
||||
this.Controls.Add(this.addButton);
|
||||
this.Controls.Add(this.unlockButton);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Name = "SharedButtons";
|
||||
this.Size = new System.Drawing.Size(100, 649);
|
||||
this.Load += new System.EventHandler(this.SharedDlgButtons_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
@ -228,5 +254,7 @@ namespace TBF.UiControls
|
||||
private System.Windows.Forms.Button renameTabButton;
|
||||
private System.Windows.Forms.Button removeTabButton;
|
||||
private System.Windows.Forms.Button moreButton;
|
||||
private System.Windows.Forms.Button exportButton;
|
||||
private System.Windows.Forms.Button importButton;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,9 @@ namespace TBF.UiControls
|
||||
RenameTab = 512, /// optional
|
||||
RemoveTab = 1024, /// optional
|
||||
More = 2048, /// optional
|
||||
}
|
||||
Export = 4096, /// optional
|
||||
Import = 8192, /// optional
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Optional buttons are Add, Remove, Up, Down, Edit and Copy.
|
||||
@ -109,6 +111,8 @@ namespace TBF.UiControls
|
||||
renameTabButton.Hide();
|
||||
removeTabButton.Hide();
|
||||
moreButton.Hide();
|
||||
exportButton.Hide();
|
||||
importButton.Hide();
|
||||
|
||||
/// Reposition 'Edit' and 'Copy" buttons in case both 'Up' and 'Down' are hidden
|
||||
if (((OptionalButtons & Buttons.Up) == 0) &&
|
||||
@ -162,6 +166,8 @@ namespace TBF.UiControls
|
||||
if ((OptionalButtons & Buttons.RenameTab) != 0) renameTabButton.Show();
|
||||
if ((OptionalButtons & Buttons.RemoveTab) != 0) removeTabButton.Show();
|
||||
if ((OptionalButtons & Buttons.More) != 0) moreButton.Show();
|
||||
if ((OptionalButtons & Buttons.Export) != 0) exportButton.Show();
|
||||
if ((OptionalButtons & Buttons.Import) != 0) importButton.Show();
|
||||
|
||||
lockState = LockState.Unlocked;
|
||||
}
|
||||
@ -196,7 +202,9 @@ namespace TBF.UiControls
|
||||
if ((buttons & Buttons.RenameTab) != 0) renameTabButton.Enabled = value;
|
||||
if ((buttons & Buttons.RemoveTab) != 0) removeTabButton.Enabled = value;
|
||||
if ((buttons & Buttons.More) != 0) moreButton.Enabled = value;
|
||||
}
|
||||
if ((buttons & Buttons.Export) != 0) exportButton.Enabled = value;
|
||||
if ((buttons & Buttons.Import) != 0) importButton.Enabled = value;
|
||||
}
|
||||
|
||||
void RestoreUser()
|
||||
{
|
||||
@ -220,6 +228,8 @@ namespace TBF.UiControls
|
||||
public event EventHandler RenameTabClicked;
|
||||
public event EventHandler RemoveTabClicked;
|
||||
public event EventHandler MoreClicked;
|
||||
public event EventHandler ExportClicked;
|
||||
public event EventHandler ImportClicked;
|
||||
|
||||
/// <summary>
|
||||
/// 'Unlock' button handler
|
||||
@ -283,15 +293,17 @@ namespace TBF.UiControls
|
||||
///
|
||||
/// All remaining handlers:
|
||||
///
|
||||
private void cancelBtn_Click(object s, EventArgs e) { if (CancelClicked != null) CancelClicked(s, e); }
|
||||
private void addBtn_Click(object s, EventArgs e) { if (AddClicked != null) AddClicked(s, e); }
|
||||
private void removeBtn_Click(object s, EventArgs e) { if (RemoveClicked != null) RemoveClicked(s, e); }
|
||||
private void upBtn_Click(object s, EventArgs e) { if (UpClicked != null) UpClicked(s, e); }
|
||||
private void downBtn_Click(object s, EventArgs e) { if (DownClicked != null) DownClicked(s, e); }
|
||||
private void editBtn_Click(object s, EventArgs e) { if (EditClicked != null) EditClicked(s, e); }
|
||||
private void copyBtn_Click(object s, EventArgs e) { if (CopyClicked != null) CopyClicked(s, e); }
|
||||
private void newTabButton_Click(object s, EventArgs e) { if (NewTabClicked != null) NewTabClicked(s, e); }
|
||||
private void cancelBtn_Click(object s, EventArgs e) { if (CancelClicked != null) CancelClicked(s, e); }
|
||||
private void addBtn_Click(object s, EventArgs e) { if (AddClicked != null) AddClicked(s, e); }
|
||||
private void removeBtn_Click(object s, EventArgs e) { if (RemoveClicked != null) RemoveClicked(s, e); }
|
||||
private void upBtn_Click(object s, EventArgs e) { if (UpClicked != null) UpClicked(s, e); }
|
||||
private void downBtn_Click(object s, EventArgs e) { if (DownClicked != null) DownClicked(s, e); }
|
||||
private void editBtn_Click(object s, EventArgs e) { if (EditClicked != null) EditClicked(s, e); }
|
||||
private void copyBtn_Click(object s, EventArgs e) { if (CopyClicked != null) CopyClicked(s, e); }
|
||||
private void newTabButton_Click(object s, EventArgs e) { if (NewTabClicked != null) NewTabClicked(s, e); }
|
||||
private void renameTabButton_Click(object s, EventArgs e) { if (RenameTabClicked != null) RenameTabClicked(s, e); }
|
||||
private void removeTabButton_Click(object s, EventArgs e) { if (RemoveTabClicked != null) RemoveTabClicked(s, e); }
|
||||
private void exportButton_Click(object s, EventArgs e) { if (ExportClicked != null) ExportClicked(s, e); }
|
||||
private void importButton_Click(object s, EventArgs e) { if (ImportClicked != null) ImportClicked(s, e); }
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user