- Extended CJMS11 camera handling with new functionalities, including image grabbing, resolution configuration, and improved ROI support. - Added new `ToString` method implementations for enhanced debugging and logging in key classes like `JmsMessage`, `JmsPacket`, and `RoiCfg`. - Introduced additional commands (`start_stream_images`, `stop_stream_images`) in `CommandM` and its enum. - Implemented new resolution handling in `RoiCfg` with support for configurable image frames. - Refactored resolution-related UI elements in `RoiCfgCtrl` to add a dropdown for selecting resolution. - Made minor UX improvements by replacing inconsistent string formats with verbatim strings in console messages. - Updated project dependencies with new resolution-related utilities (`Frame` and `ResolutionFrames`). - Resolved camera-specific symbolic issues by transitioning to `CJMS11.Camera` over prior naming inconsistencies.
84 lines
2.7 KiB
C#
84 lines
2.7 KiB
C#
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.SchDrawingDlgLeft);
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|