示例#1
0
        public void DoByMode(DoMode doMode, double waitTime = 0.1)
        {
            try
            {
                switch (doMode)
                {
                case DoMode.Invoke:
                    DoClick(waitTime);
                    break;

                case DoMode.Select:
                    DoSelect(waitTime);
                    break;

                case DoMode.Point:
                    DoClickPoint(0, 0, waitTime);
                    break;

                default:
                    throw new Exception("DoMode " + doMode + " does not exist.");
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
 private void radConfirmMode_Checked(object sender, RoutedEventArgs e)
 {
     doMode             = DoMode.Confirm;
     grMain.DataContext = new
     {
         InputTitle         = "INPUT INDEX.NO ( NHẬP MÃ THÙNG )",
         GroupPOTitle       = "ProductNo ( Đơn hàng )",
         ButtonConfirmTitle = "Confirm (Xác Nhận)",
         LabelHintTitle     = "Press key Add to confirm (Bấm phím + để xác nhận)"
     };
     //grbReadyToRelease.Visibility = Visibility.Visible;
     if (dgReleaseDetail != null)
     {
         dgReleaseDetail.Visibility = Visibility.Collapsed;
     }
     txtIndexNo.SelectAll();
     txtIndexNo.Focus();
     clearValue();
 }
        private void radReleaseMode_Checked(object sender, RoutedEventArgs e)
        {
            doMode             = DoMode.Release;
            grMain.DataContext = new
            {
                InputTitle         = "INPUT PRODUCT.NO ( NHẬP ĐƠN HÀNG )",
                GroupPOTitle       = "Working Cart ( Thùng hàng )",
                ButtonConfirmTitle = "Release to outsole",
                LabelHintTitle     = "Press key Add to release (Bấm phím + để phát hàng)"
            };

            grbReadyToRelease.Visibility = Visibility.Collapsed;
            if (dgReleaseDetail != null)
            {
                dgReleaseDetail.Visibility = Visibility.Visible;
            }
            txtIndexNo.SelectAll();
            txtIndexNo.Focus();
            clearValue();
        }
示例#4
0
        public static void Main(string[] args)
        {
            Arguments CommandLine = new Arguments(args);

            if (args.Length == 0)
            {
                PrintInfo("Run PSTMaster.exe /help to see usage.");
            }

            else if (args.Length == 1 && HelpRequired(args[0]))
            {
                DisplayHelp();
            }

            else if (CommandLine["mode"] == null || CommandLine["jobname"] == null || CommandLine["location"] == null || CommandLine["collectpath"] == null)
            {
                PrintError("Looks like one or more paramters missed.");
            }

            else
            {
                string mode           = CommandLine["mode"].ToLower();
                string jobname        = CommandLine["jobname"].ToLower();
                string location       = CommandLine["location"].ToLower();
                string collectpath    = CommandLine["collectpath"].ToLower();
                string configpath     = string.Format("{0}PSTCollect\\", Path.GetPathRoot(Environment.SystemDirectory));
                string computername   = System.Environment.MachineName;
                string outputfilename = string.Format("{0}.{1}.{2}.csv", computername, jobname, mode);
                string logfile        = string.Format("{0}.{1}.log", computername, jobname);
                string fullogpath     = string.Format("{0}\\{1}", configpath, logfile);
                string excemessage;

                /*dropfile(fullogpath, out excemessage);
                 * if (excemessage != null)
                 * {
                 *  PrintError(excemessage);
                 *  WriteLog(configpath, logfile, excemessage);
                 * }*/


                try
                {
                    if (Directory.Exists(configpath))
                    {
                        Console.WriteLine("The config directory:{0} exists already.", configpath);
                        WriteLog(configpath, logfile, string.Format("The config directory:{0} exists already.", configpath));
                    }

                    else
                    {
                        DirectoryInfo di = Directory.CreateDirectory(configpath);
                        Console.WriteLine("The config directory was created successfully at {0}.", Directory.GetCreationTime(configpath));
                        WriteLog(configpath, logfile, string.Format("The config directory:{0} successfully created", configpath));
                    }


                    if (!collectpath.EndsWith("\\"))
                    {
                        collectpath += "\\";
                    }
                    if (Directory.Exists(collectpath))
                    {
                        Console.WriteLine("Checked the collect path {0} is acessable.", collectpath);
                        WriteLog(configpath, logfile, string.Format("The collect path:{0} is aceessable", collectpath));
                    }
                    else
                    {
                        PrintError(string.Format("The collect path:{0} is unreachable,please make sure put in a accessible share,quitting the application.....", collectpath));
                        //PrintError("The collect path is unreachable, please make sure put in a accessible share,quitting the application.....");
                        WriteLog(configpath, logfile, string.Format("The collect path:{0} is unreachable,please make sure put in a accessible share,quitting the application.....", collectpath));
                        return;
                    }
                }

                catch (Exception e)
                {
                    Console.WriteLine("The process failed: {0}", e.ToString());
                    WriteLog(configpath, logfile, e.Message);
                }



                if (mode != null && jobname != null && location != null && collectpath != null)
                {
                    //dropfile(fullogpath, out excemessage);
                    //WriteLog(configpath,logfile,excemessage);
                    switch (mode)
                    {
                    case "find": DoMode.Find(location, collectpath, jobname, computername, configpath, outputfilename); break;

                    case "collect": DoMode.Collect(location, collectpath, jobname, computername, configpath, outputfilename); break;

                    case "remove": DoMode.Remove(location, collectpath, jobname, computername, configpath, outputfilename); break;

                    default:
                        PrintError(string.Format("{0} is not a support mode, plesae use Find, Collect, Remove, try /help to see the application useage smaples", mode));
                        WriteLog(configpath, logfile, string.Format("{0} is not a support mode, plesae use Find, Collect, Remove, try /help to see the application useage samples", mode));
                        break;
                    }
                }

                else
                {
                    PrintError("Looks like there is a paramter missing");
                    Environment.Exit(1);
                }

                CopyFile(logfile, configpath, collectpath, out excemessage);
                if (excemessage != null)
                {
                    WriteLog(configpath, logfile, excemessage);
                }
            }
        }
示例#5
0
 public string SelectItemFromCollection(string strIndex = null, string name = null, DoMode doMode = DoMode.Point)
 {
     try
     {
         AT ele;
         if (!string.IsNullOrEmpty(name))
         {
             try
             {
                 ele = GetMatchedElements(name: name, treeScope: TreeScope.Element).GetATCollection()[0];
             }
             catch (Exception ex)
             {
                 throw new Exception(string.Format("The item {0} does not exist.", name, ex.Message));
             }
         }
         else
         {
             try
             {
                 ele = GetATCollection()[Convert.ToInt16(strIndex)];
             }
             catch (Exception ex)
             {
                 throw new Exception(string.Format("The item index {0} does not exist", strIndex, ex.Message));
             }
         }
         ele.DoByMode(doMode);
         var tName = "Can not get name";
         try
         {
             tName = ele.GetElementInfo().Name();
         }
         catch (Exception)
         {
             //ignored
         }
         return(tName);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#6
0
        public static void Main(string[] args)
        {
            Arguments CommandLine = new Arguments(args);

            if (args.Length == 0)
            {
                PrintInfo("Run PSTMaster.exe /help to see usage.");
            }

            else if (args.Length == 1 && HelpRequired(args[0]))
            {
                DisplayHelp();
            }

            else if (CommandLine["mode"] == null || CommandLine["jobname"] == null || CommandLine["location"] == null || CommandLine["collectpath"] == null)
            {
                PrintError("Looks like one or more paramters missed.");
            }

            else
            {
                string mode           = CommandLine["mode"].ToLower();
                string jobname        = CommandLine["jobname"].ToLower();
                string location       = CommandLine["location"].ToLower();
                string collectpath    = CommandLine["collectpath"].ToLower();
                string configpath     = string.Format("{0}PSTCollect\\", Path.GetPathRoot(Environment.SystemDirectory));
                string computername   = System.Environment.MachineName;
                string outputfilename = string.Format("{0}.{1}.{2}.csv", computername, jobname, mode);
                string logfile        = string.Format("{0}.{1}.txt", computername, jobname);
                string fullogpath     = string.Format("{0}\\{1}", configpath, logfile);

                try
                {
                    if (Directory.Exists(configpath))
                    {
                        Console.WriteLine("The config directory:{0} exists already.", configpath);
                    }

                    else
                    {
                        DirectoryInfo di = Directory.CreateDirectory(configpath);
                        Console.WriteLine("The config directory was created successfully at {0}.", Directory.GetCreationTime(configpath));
                    }
                }

                catch (Exception e)
                {
                    Console.WriteLine("The process failed: {0}", e.ToString());
                }

                if (!collectpath.EndsWith("\\"))
                {
                    collectpath += "\\";
                }

                if (mode != null && jobname != null && location != null && collectpath != null)
                {
                    dropfile(fullogpath);

                    switch (mode)
                    {
                    case "find": DoMode.Find(location, collectpath, jobname, computername, configpath, outputfilename); break;

                    case "collect": DoMode.Collect(location, collectpath, jobname, computername, configpath, outputfilename); break;

                    case "remove": DoMode.Remove(location, collectpath, jobname, computername, configpath, outputfilename); break;
                    }
                }

                else
                {
                    PrintError("Looks like there is a paramter missing");
                    Environment.Exit(1);
                }

                CopyFile(logfile, configpath, collectpath);
            }
        }