示例#1
0
 public TCP_Server(string readerID, SingleMainForm contextForm)
     : this()
 {
     this.ConnID      = readerID;
     this.contextForm = contextForm;
     Init();
 }
示例#2
0
 public CheckListTest(string readerID, String ReadParam, SingleMainForm contextForm)
     : this()
 {
     this.ConnID      = readerID;
     this.contextForm = contextForm;
     this.ReadParam   = ReadParam;
 }
 public AddConnect(SingleMainForm contextForm)
     : this()
 {
     this.contextForm             = contextForm;
     cb_ConnectType.SelectedIndex = 0;
     this.Width  = 450;
     this.Height = 200;
 }
 public Performance_RW(string readerID, String[] epcData, Int32 antNum, SingleMainForm contextForm)
     : this()
 {
     this.ConnID      = readerID;
     this.EPCdata     = epcData;
     this.contextForm = contextForm;
     this.AntNum      = antNum;
 }
 public Performance_R(SingleMainForm parentForm, Int32 tagType, String readParam) : this()
 {
     this.parentForm = parentForm;
     this.Tagtype    = tagType;
     this.ReadParam  = readParam;
     this.ConnID     = parentForm.ConnID;
     ClouReaderAPI.CLReader.DIC_CONNECT[parentForm.ConnID].log = this;
 }
示例#6
0
 public BlacklistBeep(string readerID, String ReadParam, SingleMainForm contextForm)
     : this()
 {
     this.ConnID      = readerID;
     this.contextForm = contextForm;
     this.ReadParam   = ReadParam;
     StartBlackBeep();
     StartWiteBeep();
 }
 public AddConnect(SingleMainForm contextForm, Int32 connType) : this(contextForm)
 {
     InitCom();
     if (connType == 0)
     {
         cb_ConnectType.SelectedIndex = 1;
         cb_ConnectType.SelectedIndex = 0;
     }
     else if (connType == 1)
     {
         cb_ConnectType.SelectedIndex = 1;
     }
     else if (connType == 2)
     {
         cb_ConnectType.SelectedIndex = 2;
     }
 }
示例#8
0
 public ToolsSetGPO(string readerID, SingleMainForm contextForm)
     : this()
 {
     this.ConnID      = readerID;
     this.contextForm = contextForm;
 }
示例#9
0
        public static void Main(string[] args)
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                MessageBox.Show(Properties.Resources.MessageApplicationCannotRun, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Settings settings = new Settings();

            if (!settings.DisableThemes)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                settings.RenderWithVisualStyles = Application.RenderWithVisualStyles;
            }
            ArgumentParser argumentParser = new ArgumentParser();

            try {
                argumentParser.Arguments = args;
            } catch (Exception exception) {
                Debug.WriteLine(exception);
                ErrorLog.WriteLine(exception);
                MessageBox.Show(exception.Message, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (argumentParser.HasArguments)
            {
                if (argumentParser.IsHelp)
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine1.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine2.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine3.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine4.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine5.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine6.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine7.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine8.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine9.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine10.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine11.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine12.Replace("\\t", "\t"));
                    MessageBox.Show(stringBuilder.ToString(), GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionHelp, MessageBoxButtons.OK, MessageBoxIcon.Question);
                }
                else if (argumentParser.IsThisTest)
                {
                    try {
                        Application.Run(new ArgumentParserForm());
                    } catch (Exception exception) {
                        Debug.WriteLine(exception);
                        ErrorLog.WriteLine(exception);
                        MessageBox.Show(exception.Message, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        MessageBox.Show(Properties.Resources.MessageApplicationError, GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageForm    messageForm    = null;
                    BackgroundForm backgroundForm = null;
                    try {
                        if (Directory.Exists(Path.GetDirectoryName(argumentParser.OutputFilePath)) && !string.IsNullOrWhiteSpace(Path.GetFileNameWithoutExtension(argumentParser.OutputFilePath)))
                        {
                            messageForm = new MessageForm(argumentParser.Text, argumentParser.Caption, argumentParser.Buttons, argumentParser.BoxIcon, argumentParser.DefaultButton, true, argumentParser.DisplayHelpButton, argumentParser.MaximumWidth, argumentParser.NoWrap);
                            if (argumentParser.BasicTheme)
                            {
                                messageForm.Show();
                                using (Bitmap bitmap = new Bitmap(messageForm.Width, messageForm.Height, PixelFormat.Format32bppArgb)) {
                                    messageForm.DrawToBitmap(bitmap, new Rectangle(Point.Empty, bitmap.Size));
                                    switch (Path.GetExtension(argumentParser.OutputFilePath).ToLowerInvariant())
                                    {
                                    case Constants.ExtensionBmp:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Bmp);
                                        break;

                                    case Constants.ExtensionGif:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Gif);
                                        break;

                                    case Constants.ExtensionJpg:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Jpeg);
                                        break;

                                    case Constants.ExtensionTif:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Tiff);
                                        break;

                                    case Constants.ExtensionWebP:
                                        using (WebP webP = new WebP()) {
                                            File.WriteAllBytes(argumentParser.OutputFilePath, webP.EncodeLossless(bitmap));
                                        }
                                        break;

                                    default:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Png);
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                backgroundForm = new BackgroundForm();
                                backgroundForm.Show();
                                backgroundForm.Location = new Point(SystemInformation.WorkingArea.Location.X - Constants.BackgroundFormOverShoot, SystemInformation.WorkingArea.Location.Y - Constants.BackgroundFormOverShoot);
                                backgroundForm.Size     = new Size(messageForm.Width + Constants.BackgroundFormOverShoot * 2, messageForm.Height + Constants.BackgroundFormOverShoot * 2);
                                messageForm.Show();
                                messageForm.Location = SystemInformation.WorkingArea.Location;
                                Application.DoEvents();
                                System.Threading.Thread.Sleep(Constants.ScreenFormCaptureDelay);
                                using (Bitmap bitmap = new Bitmap(Math.Min(SystemInformation.WorkingArea.Width, messageForm.Width), Math.Min(SystemInformation.WorkingArea.Height, messageForm.Height), PixelFormat.Format32bppArgb)) {
                                    Graphics graphics = Graphics.FromImage(bitmap);
                                    graphics.CopyFromScreen(SystemInformation.WorkingArea.Location.X, SystemInformation.WorkingArea.Location.Y, 0, 0, new Size(Math.Min(SystemInformation.WorkingArea.Width, messageForm.Width), Math.Min(SystemInformation.WorkingArea.Height, messageForm.Height)), CopyPixelOperation.SourceCopy);
                                    switch (Path.GetExtension(argumentParser.OutputFilePath).ToLowerInvariant())
                                    {
                                    case Constants.ExtensionBmp:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Bmp);
                                        break;

                                    case Constants.ExtensionGif:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Gif);
                                        break;

                                    case Constants.ExtensionJpg:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Jpeg);
                                        break;

                                    case Constants.ExtensionTif:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Tiff);
                                        break;

                                    case Constants.ExtensionWebP:
                                        using (WebP webP = new WebP()) {
                                            File.WriteAllBytes(argumentParser.OutputFilePath, webP.EncodeLossless(bitmap));
                                        }
                                        break;

                                    default:
                                        bitmap.Save(argumentParser.OutputFilePath, ImageFormat.Png);
                                        break;
                                    }
                                }
                            }
                        }
                    } catch (Exception exception) {
                        Debug.WriteLine(exception);
                        ErrorLog.WriteLine(exception);
                    } finally {
                        if (messageForm != null)
                        {
                            messageForm.Close();
                        }
                        if (backgroundForm != null)
                        {
                            backgroundForm.Close();
                        }
                    }
                }
            }
            else
            {
                try {
                    SingleMainForm.Run(new MainForm(settings));
                } catch (Exception exception) {
                    Debug.WriteLine(exception);
                    ErrorLog.WriteLine(exception);
                    MessageBox.Show(exception.Message, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show(Properties.Resources.MessageApplicationError, GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
示例#10
0
        public static void Main(string[] args)
        {
            if (Environment.OSVersion.Platform != PlatformID.Win32NT)
            {
                MessageBox.Show(Properties.Resources.MessageApplicationCannotRun, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Settings settings = new Settings();

            if (!settings.DisableThemes)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                settings.RenderWithVisualStyles = Application.RenderWithVisualStyles;
            }
            ArgumentParser argumentParser = new ArgumentParser();

            try {
                argumentParser.Arguments = args;
            } catch (Exception exception) {
                Debug.WriteLine(exception);
                ErrorLog.WriteLine(exception);
                MessageBox.Show(exception.Message, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (argumentParser.HasArguments)
            {
                if (argumentParser.IsHelp)
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine1.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine2.Replace("\\t", "\t"));
                    stringBuilder.AppendLine(Properties.Resources.HelpLine3.Replace("\\t", "\t"));
                    stringBuilder.AppendLine(Properties.Resources.HelpLine4.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine5.Replace("\\t", "\t"));
                    stringBuilder.AppendLine(Properties.Resources.HelpLine6.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine7.Replace("\\t", "\t"));
                    stringBuilder.AppendLine(Properties.Resources.HelpLine8.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine9.Replace("\\t", "\t"));
                    stringBuilder.AppendLine(Properties.Resources.HelpLine10.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine11.Replace("\\t", "\t"));
                    stringBuilder.AppendLine(Properties.Resources.HelpLine12.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine13.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine14.Replace("\\t", "\t"));
                    stringBuilder.AppendLine(Properties.Resources.HelpLine15.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine16.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine17.Replace("\\t", "\t")).AppendLine();
                    stringBuilder.AppendLine(Properties.Resources.HelpLine18.Replace("\\t", "\t"));
                    MessageBox.Show(stringBuilder.ToString(), GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionHelp, MessageBoxButtons.OK, MessageBoxIcon.Question);
                }
                else if (argumentParser.IsTest)
                {
                    try {
                        Application.Run(new TestForm(args));
                    } catch (Exception exception) {
                        Debug.WriteLine(exception);
                        ErrorLog.WriteLine(exception);
                        MessageBox.Show(exception.Message, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        MessageBox.Show(Properties.Resources.MessageApplicationError, GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else if (argumentParser.IsThisTest)
                {
                    try {
                        Application.Run(new ArgumentParserForm());
                    } catch (Exception exception) {
                        Debug.WriteLine(exception);
                        ErrorLog.WriteLine(exception);
                        MessageBox.Show(exception.Message, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        MessageBox.Show(Properties.Resources.MessageApplicationError, GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    try {
                        LauncherAsDate launcherAsDate = new LauncherAsDate()
                        {
                            ApplicationFilePath   = argumentParser.ApplicationFilePath,
                            DateTime              = argumentParser.DateTime.Value,
                            Arguments             = argumentParser.ApplicationArguments,
                            WorkingFolderPath     = argumentParser.WorkingFolderPath,
                            OneInstance           = argumentParser.OneInstance,
                            Interval              = argumentParser.Interval,
                            DisableTimeCorrection = settings.DisableTimeCorrection,
                            ForceTimeCorrection   = settings.ForceTimeCorrection
                        };
                        launcherAsDate.Launch();
                    } catch (Exception exception) {
                        Debug.WriteLine(exception);
                        ErrorLog.WriteLine(exception);
                        MessageBox.Show(exception.Message, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            else
            {
                try {
                    SingleMainForm.Run(new MainForm(settings));
                } catch (Exception exception) {
                    Debug.WriteLine(exception);
                    ErrorLog.WriteLine(exception);
                    MessageBox.Show(exception.Message, GetTitle() + Constants.Space + Constants.EnDash + Constants.Space + Properties.Resources.CaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    MessageBox.Show(Properties.Resources.MessageApplicationError, GetTitle(), MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
 public SearchDevice(SingleMainForm contextMainForm)
     : this()
 {
     this.contextForm = contextMainForm;
 }
示例#12
0
 public SettingGPI(string readerID, SingleMainForm contextForm)
     : this()
 {
     this.ConnID      = readerID;
     this.contextForm = contextForm;
 }
示例#13
0
 public SendCommand(SingleMainForm contextForm) : this()
 {
     this.contextForm = contextForm;
     this.Width       = 500;
     this.Height      = 250;
 }
 public ReadTag_Param(SingleMainForm smf, Int32 pageIndex)
     : this()
 {
     this.singleMainForm        = smf;
     this.tc_Main.SelectedIndex = pageIndex;
 }