コード例 #1
0
        private void btn_scan_Click(object sender, RoutedEventArgs e)
        {
            bool scanner_flag = false;

            Scanner.Scanner scanner = null;
            try
            {
                scanner = new Scanner.Scanner();
            }
            catch (Exception expcep)
            {
                scanner_flag = true;
                MessageBox.Show(" Scanner has not been detected. Please turn on your scanner and connect to the system and make sure it has been detected by Windows.\n The application will now shut down", "Scanner not detected.",
                                MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            if (scanner_flag == true)
            {
                Application.Current.Shutdown();
            }
            else
            {
                scanner.scan(XMLRead.Scanner_DPI.dpi_value);
                file = Worker.scanned_img_dir + "Scan_" + Worker.scanned_image_index + ".jpg";
                Worker.scanned_image_index++;
                scanner.save(file);
                preview_window.Source = new BitmapImage(new Uri(file));
            }
        }
コード例 #2
0
        /// <summary>
        /// main entry point
        /// calls get tokensList
        /// calls controller
        /// </summary>
        public void init(string ipProgram)
        {
            Scanner.Scanner scanner = new Scanner.Scanner();
            tokensList = scanner.getListOfTokens(ipProgram);

            currentToken = tokensList[currentTokenIndex];

            GrStmtSequence stmtSeq = new GrStmtSequence();

            stmtSeq.execute(parserTree.HeadNode);
            Node node = parserTree.HeadNode;
        }
コード例 #3
0
        /// <summary>
        /// main entry point
        /// calls get tokensList
        /// calls controller
        /// </summary>
        public void init(string ipProgram)
        {
            Scanner.Scanner scanner = new Scanner.Scanner();
            tokensList        = scanner.getListOfTokens(ipProgram);
            currentTokenIndex = 0;
            currentToken      = tokensList[currentTokenIndex];
            parserTree        = new Tree();
            GrStmtSequence stmtSeq = new GrStmtSequence();

            executionFlag = stmtSeq.execute(parserTree.HeadNode);
            Node node = parserTree.HeadNode;

            // if no errors draw the tree
            if (executionFlag)
            {
                Controller.getInstance().Done();
            }
        }
コード例 #4
0
        private void btn_scan_Click(object sender, RoutedEventArgs e)
        {
            bool scanner_flag = false;
            Scanner.Scanner scanner = null;
            try
            {
                scanner = new Scanner.Scanner();
                
            }
            catch (Exception expcep)
            {
                scanner_flag = true;
                MessageBox.Show(" Scanner has not been detected. Please turn on your scanner and connect to the system and make sure it has been detected by Windows.\n The application will now shut down", "Scanner not detected.",
                    MessageBoxButton.OK, MessageBoxImage.Exclamation);

            }
            if (scanner_flag == true)
            {
                Application.Current.Shutdown();
            }
            else
            {
                scanner.scan(XMLRead.Scanner_DPI.dpi_value);
                file = Worker.scanned_img_dir + "Scan_" + Worker.scanned_image_index + ".jpg";
                Worker.scanned_image_index++;
                scanner.save(file);
                preview_window.Source = new BitmapImage(new Uri(file));
            }
        }
コード例 #5
0
ファイル: Parser.cs プロジェクト: AhmedKamalAK/CS-Tasks
 public Parser(string inputText)
 {
     scanner = new Scanner.Scanner(inputText);
 }