ResultsBrowser : Synchronized with branch 2.9, ver. 2.12.384

This commit is contained in:
Milan Hanajik 2016-11-16 15:57:23 +01:00
parent 16d471f12e
commit a5799290c9
4 changed files with 74 additions and 29 deletions

View File

@ -59,6 +59,9 @@ namespace ResultsBrowser
public bool ManiWndMaximized;
public int SplitterDistance;
/// Last configuration file name
public string LastConfigFileName;
/// Purchase order history
public string LastPurchaseOrder;
public string[] PurchaseOrderHistory;

View File

@ -65,7 +65,7 @@ namespace ResultsBrowser
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
static void Main(string[] args)
{
///
/// Load the local settings
@ -133,7 +133,7 @@ namespace ResultsBrowser
log.Info("Opening the main window");
Application.Run(MainWnd);
#else
ResultsBrowserWnd = new ResultsBrowserWnd();
ResultsBrowserWnd = new ResultsBrowserWnd(args);
log.Info("Opening the main window");
Application.Run(ResultsBrowserWnd);
#endif

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.10.352.0")]
[assembly: AssemblyFileVersion("2.10.352.0")]
[assembly: AssemblyVersion("2.12.384.0")]
[assembly: AssemblyFileVersion("2.12.384.0")]

View File

@ -17,23 +17,23 @@ namespace ResultsBrowser
{
const string OpenFileDlg_SaveFileDlg_Filter = "{0} (*.qry)|*.qry|{1} (*.*)|*.*";
string[] args;
IList<Filters.IFilter> filters; /// Filters and the UI of filters
FiltersConfig filtersConfig; /// Serializable configuration of filters and displayed results
IList<WaterMeter> waterMeters;
public ResultsBrowserWnd()
public ResultsBrowserWnd(string[] args)
{
InitializeComponent();
filters = new List<Filters.IFilter>();
filtersConfig = new FiltersConfig();
this.args = args;
}
private void ResultsBrowserWnd_Load(object sender, EventArgs e)
{
Text = string.Format("{0} ver.{1}", Strings.Results_Browser, Program.Version);
ResultsBrowser.LocalSettings ls = Program.LocalSettings;
Width = (ls.MainWndWidth > 0) ? ls.MainWndWidth : 1000;
Height = (ls.MainWndHeight > 0) ? ls.MainWndHeight : 750;
@ -48,6 +48,19 @@ namespace ResultsBrowser
checkBox1.Checked = Program.LocalSettings.Bench1Selected;
checkBox2.Checked = Program.LocalSettings.Bench2Selected;
checkBox3.Checked = Program.LocalSettings.Bench3Selected;
if (args.Length == 1 && args[0].IndexOf(".qry") == args[0].Length - 4)
{
LoadConfigFromFile(args[0]);
}
else if (!string.IsNullOrEmpty(Program.LocalSettings.LastConfigFileName))
{
LoadConfigFromFile(Program.LocalSettings.LastConfigFileName);
}
else
{
Text = string.Format("{0} ver.{1}", Strings.Results_Browser, Program.Version);
}
}
void RedrawTestBenches()
@ -121,22 +134,32 @@ namespace ResultsBrowser
dlg.Filter = string.Format("{0} (*.qry)|*.qry|{1} (*.*)|*.*", Strings.Query_files, Strings.All_files);
if (dlg.ShowDialog() == DialogResult.OK)
{
FiltersConfig localFiltersConfig = FiltersConfig.Load(dlg.FileName);
if (localFiltersConfig != null)
{
filtersConfig = localFiltersConfig;
LoadConfigFromFile(dlg.FileName);
}
}
filters.Clear();
filtersFlowLayoutPanel.Controls.Clear();
///
for (int i = 0; i < filtersConfig.FiltersCount; i++)
{
Filters.IFilter filter = Factory.LoadFilter(filtersConfig.FilterID[i], filtersConfig.FilterData[i]);
filters.Add(filter);
filtersFlowLayoutPanel.Controls.Add(filter.GetFilterUI());
}
void LoadConfigFromFile(string fileName)
{
FiltersConfig localFiltersConfig = FiltersConfig.Load(fileName);
if (localFiltersConfig != null)
{
filtersConfig = localFiltersConfig;
filters.Clear();
filtersFlowLayoutPanel.Controls.Clear();
///
for (int i = 0; i < filtersConfig.FiltersCount; i++)
{
Filters.IFilter filter = Factory.LoadFilter(filtersConfig.FilterID[i], filtersConfig.FilterData[i]);
filters.Add(filter);
filtersFlowLayoutPanel.Controls.Add(filter.GetFilterUI());
}
}
}
Program.LocalSettings.LastConfigFileName = fileName;
Program.LocalSettings.Save();
Text = string.Format("{0} ver.{1} ({2})", Strings.Results_Browser, Program.Version, Program.LocalSettings.LastConfigFileName);
}
private void saveConfigBtn_Click(object sender, EventArgs e)
@ -159,6 +182,11 @@ namespace ResultsBrowser
if (dlg.ShowDialog() == DialogResult.OK)
{
filtersConfig.Save(dlg.FileName);
Program.LocalSettings.LastConfigFileName = dlg.FileName;
Program.LocalSettings.Save();
Text = string.Format("{0} ver.{1} ({2})", Strings.Results_Browser, Program.Version, Program.LocalSettings.LastConfigFileName);
}
}
}
@ -229,13 +257,10 @@ namespace ResultsBrowser
private void formatOfResultsBtn_Click(object sender, EventArgs e)
{
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg()
{
MetersKind = Config.Entities.MetersKind.Single,
SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems),
AvailableItems = new List<Results.WMeterRsltItemSpec>()
};
Results.Forms.ResultsConfigDlg dlg = new Results.Forms.ResultsConfigDlg();
dlg.MetersKind = Config.Entities.MetersKind.Single;
dlg.SelectedItems = Results.WMeterRsltItemSpec.FromStrArray(filtersConfig.ResultItems);
dlg.AvailableItems = new List<Results.WMeterRsltItemSpec>();
foreach (var v in Results.WMeterRsltItemSpec.AllItems) dlg.AvailableItems.Add(v);
if (dlg.ShowDialog() == DialogResult.OK)
@ -255,11 +280,28 @@ namespace ResultsBrowser
{
if (waterMeters == null || waterMeters.Count == 0) return;
#if MUNICH
foreach (var wm in waterMeters)
{
new Results.Output.Printers.Munich.MunichPrintDocument("", wm, Config.Entities.PageOrientation.Portrait).Print();
}
}
#elif CEVAK_PT40_272
IList<Results.Entities.Batch> batches = new List<Results.Entities.Batch>();
foreach (var wm in waterMeters)
{
if (!batches.Contains(wm.Batch)) batches.Add(wm.Batch);
}
foreach (var batch in batches)
{
new Results.Output.Printers.Cevak.PrintDocumentCevak(batch,
Config.Entities.PageOrientation.Portrait,
60, 60, 60,
"PT40 Z/E-35-A",
"0111-OOP-C035-13").Print();
}
#endif
}
private void statisticsBtn_Click(object sender, EventArgs e)
{