1. ToFirstMonitor and ToSecondMonitor console app.added, 2. GenCode128 project added.
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using TBF;
|
||||
|
||||
namespace ToFirstMonitor
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static LocalSettings ls;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
if (!Directory.Exists(TBF.Program.ConfigDir)) return;
|
||||
|
||||
Environment.CurrentDirectory = TBF.Program.ConfigDir;
|
||||
ls = LocalSettings.Load(TBF.Program.LocalSettingsFileName);
|
||||
if (ls == null || ls.TestBenches == null)
|
||||
{
|
||||
/// Loading local seetings from regular config file failed. Use the backup
|
||||
ls = LocalSettings.Load(TBF.Program.LocalSettingsBackupName);
|
||||
if (ls == null || ls.TestBenches == null)
|
||||
{
|
||||
/// Neither config.xml, nor config.backup.xml could be loaded
|
||||
Console.WriteLine(string.Format("Could not load file {0}, nor {1}.", TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName));
|
||||
Console.ReadLine();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Loading local seetings from the regular config file was successful. Update the backup
|
||||
File.Copy(TBF.Program.LocalSettingsFileName, TBF.Program.LocalSettingsBackupName, true);
|
||||
}
|
||||
|
||||
///
|
||||
/// Process local settings so that windows are shifted to the 1st monitor
|
||||
///
|
||||
LeftToFirstMonitor(ref ls.MainWndLeft);
|
||||
LeftToFirstMonitor(ref ls.ComponentsDlgLeft);
|
||||
LeftToFirstMonitor(ref ls.PopupResultsLeft);
|
||||
LeftToFirstMonitor(ref ls.PathsDlgLeft);
|
||||
LeftToFirstMonitor(ref ls.TransitionsDlgLeft);
|
||||
LeftToFirstMonitor(ref ls.MetrologyDlgLeft);
|
||||
LeftToFirstMonitor(ref ls.ConditionsDlgLeft);
|
||||
LeftToFirstMonitor(ref ls.UncertaintyDlgLeft);
|
||||
LeftToFirstMonitor(ref ls.ProceduresDlgLeft);
|
||||
LeftToFirstMonitor(ref ls.OneProcedureDlgLeft);
|
||||
LeftToFirstMonitor(ref ls.EnduranceDlgLeft);
|
||||
ls.Save();
|
||||
|
||||
Console.WriteLine("All windows were shifted to the first monitor");
|
||||
Console.ReadLine();
|
||||
return;
|
||||
}
|
||||
|
||||
static void LeftToFirstMonitor(ref int left)
|
||||
{
|
||||
while (left >= 1920)
|
||||
{
|
||||
left -= 1920;
|
||||
}
|
||||
|
||||
if (left < 0)
|
||||
{
|
||||
left = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void LeftToSecondMonitor(ref int left)
|
||||
{
|
||||
while (left < 1920)
|
||||
{
|
||||
left += 1920;
|
||||
}
|
||||
|
||||
if (left >= 3840)
|
||||
{
|
||||
left = 1920;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user