Exemplo n.º 1
0
        private void OnCreateFileInWatchedFolder(object sender, FileSystemEventArgs e)
        {
            //e.FullPath = Z:\\Test.xml
            //e.Name = Test.xml
            WatchedFiles.Enqueue(e.Name);
            Log4.PrinterLogger.InfoFormat("+[{0}] Watched Target:{1} => Create:{2}", LaneID.ToString(), Target, e.Name);
            switch (LaneID)
            {
            case eAssignedLane_Printer.Lane1:    // 第一軌

                System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    ViewModelLocator.Atom.FlowHostVM.Lane1WFList.Add(e.Name);
                }));


                break;

            case eAssignedLane_Printer.Lane2:
                System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    ViewModelLocator.Atom.FlowHostVM.Lane2WFList.Add(e.Name);
                }));
                break;
            }
        }
Exemplo n.º 2
0
        private void OnRenameFileInWatchedFolder(object sender, RenamedEventArgs e)
        {
            //e.FullPath = Z:\\Test.xml
            //e.Name = Test.xml
            Log4.PrinterLogger.InfoFormat("+[{0}] Watched Target:{1} => Rename:{2} => {3}"
                                          , LaneID.ToString(), Target
                                          , Path.GetFileName(e.OldFullPath) //取檔名
                                          , Path.GetFileName(e.FullPath));  //取檔名
            for (int i = 0; i < WatchedFiles.Count; i++)
            {
                if (WatchedFiles[i] == Path.GetFileName(e.OldFullPath))
                {
                    WatchedFiles[i] = Path.GetFileName(e.FullPath);
                }
            }
            switch (LaneID)
            {
            case eAssignedLane_Printer.Lane1:    // 第一軌

                System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    var lst = ViewModelLocator.Atom.FlowHostVM.Lane1WFList;
                    for (int i = 0; i < lst.Count; i++)
                    {
                        if (Path.GetFileName(lst[i].Value) == Path.GetFileName(e.OldFullPath))
                        {
                            lst[i].Value = Path.GetFileName(e.FullPath);
                        }
                    }
                }));


                break;

            case eAssignedLane_Printer.Lane2:
                System.Windows.Application.Current.Dispatcher.BeginInvoke(new Action(() =>
                {
                    var lst = ViewModelLocator.Atom.FlowHostVM.Lane2WFList;
                    for (int i = 0; i < lst.Count; i++)
                    {
                        if (Path.GetFileName(lst[i].Value) == Path.GetFileName(e.OldFullPath))
                        {
                            lst[i].Value = Path.GetFileName(e.FullPath);
                        }
                    }
                }));
                break;
            }
        }
Exemplo n.º 3
0
        /// 5. Output </summary>
        public virtual void StartProcess()
        {
            try
            {
                Log4.PrinterLogger.InfoFormat("StartProcess()");
                var currentPanel = InspectedPanels.Dequeue();
                Log4.PrinterLogger.InfoFormat(" -Dequeue [{0}] SPI Data InspectTime = {1}", LaneID.ToString(), currentPanel.InspectStartTime);
                Log4.PrinterLogger.InfoFormat(" 1.Match()");

                var file = Match(currentPanel);
                Log4.PrinterLogger.InfoFormat(" 2.Calculate()");
                Calculate(currentPanel, file);

                double dxLimit = ViewModelLocator.Atom.ChartHostVM.DxSetting.XAxis.Maximun - ViewModelLocator.Atom.ChartHostVM.DxSetting.XAxis.Minimun + 1;
                double dyLimit = ViewModelLocator.Atom.ChartHostVM.DySetting.XAxis.Maximun - ViewModelLocator.Atom.ChartHostVM.DySetting.XAxis.Minimun + 1;
                double thLimit = ViewModelLocator.Atom.ChartHostVM.ThetaSetting.XAxis.Maximun - ViewModelLocator.Atom.ChartHostVM.ThetaSetting.XAxis.Minimun + 1;

                Log4.PrinterLogger.InfoFormat(" 3.BackupRoutine()");
                BackupRoutine((int)dxLimit, (int)dyLimit, (int)thLimit); //計算出Dx、Dy、Theta的累加器

                Log4.PrinterLogger.InfoFormat(" 4.UpdateHistory()");
                //累加
                //Accumulation++;

                UpdateHistory();

                Log4.PrinterLogger.InfoFormat(" 5.Output()");
                Output(currentPanel, file);

                bool bCus = CustomOutput(currentPanel, file);
                if (bCus)
                {
                    Log4.PrinterLogger.InfoFormat(" 6.CustomOutput() DONE");
                }

                ViewModelLocator.Atom.PrinterWindowVM.SN++;
            }
            catch (Exception e)
            {
                if (e is MatchException)
                {
                    Log4.PrinterLogger.ErrorFormat("[!] MatchException:" + e.Message);
                }
                else
                if (e is CaculateException)
                {
                    Log4.PrinterLogger.ErrorFormat("[!] CaculateException:" + e.Message);
                }
                else
                if (e is UpdateHistoryException)
                {
                    Log4.PrinterLogger.ErrorFormat("[!] UpdateHistoryException:" + e.Message);
                }
                else
                if (e is OutputException)
                {
                    Log4.PrinterLogger.ErrorFormat("[!] OutputException:" + e.Message);
                }
                else
                if (e is CustomOutputException)
                {
                    Log4.PrinterLogger.ErrorFormat("[!] CustomOutputException:" + e.Message);
                }
            }
        }