Beispiel #1
0
        /// <summary>
        /// The script for creating new QR Barcode demands the next arguments:
        /// directoryPath of the output image,
        /// imageName (without the png extension),
        /// pixelSize,
        /// stringToEncode
        /// </summary>
        private IItemInfo CreateNewBarcode()
        {
            Directory.CreateDirectory(BARCODE_DIRECTORY_NAME);
            string imageDirectoryName = $"{Path.DirectorySeparatorChar}{BARCODE_DIRECTORY_NAME}";
            int    pixelSize          = 10;

            Console.WriteLine("Type the name of the product to register");
            string productName = Console.ReadLine();

            Console.WriteLine("Type number of maximal saftey hitting time in seconds ");
            int maxHittingTimeInSeconds = int.Parse(Console.ReadLine());

            Console.WriteLine("Type name of new barcode image");
            string outputImageName = Console.ReadLine();

            Guid guid = Guid.NewGuid();

            Console.WriteLine($"Generating string to encode: {guid}");
            string stringToEncode = guid.ToString();

            string[] argument = new string[]
            {
                imageDirectoryName,
                outputImageName,
                pixelSize.ToString(),
                stringToEncode
            };

            ProcessExecutor.ExecuteProcess(CREATE_NEW_QR_BARCODE_EXE_NAME, argument);

            IItemInfo microwaveItemInfo = new MicrowaveItemInfo(
                stringToEncode, maxHittingTimeInSeconds, productName);

            mMicrowaveItemsDictionary.Add(stringToEncode, microwaveItemInfo);
            Console.WriteLine($"{microwaveItemInfo.ItemName} added to database");

            mItemToCategoryMap.ClassifyItemToCategory(microwaveItemInfo);
            ItemToRecognizerTypeMap.ClassifyItemToRecognitionType(microwaveItemInfo);

            SaveDatabase();

            return(microwaveItemInfo);
        }
Beispiel #2
0
        private void ScanItem()
        {
            mMicrowaveItemInfo = mScanner.Scan() as MicrowaveItemInfo;
            if (mMicrowaveItemInfo != null)
            {
                mRecognizer = MachineRecognizerFactory.CreateRecognizer(
                    (mScanner as ItemScanner).ItemToRecognizerTypeMap.
                    GetRecognizerTypeByItem(mMicrowaveItemInfo),
                    10,
                    10);

                if (mRecognizer != null)
                {
                    mRecognizer.RecognizerFinished += SetShouldStopStatus;
                    string itemCategory = (mScanner as ItemScanner).
                                          ItemToRecognizerTypeMap.GetRecognizerTypeByItem(mMicrowaveItemInfo);
                    mRecognizer.LoadProcessedData(itemCategory);
                }
            }
        }
Beispiel #3
0
 private void StopMachine()
 {
     mMicrowaveItemInfo = null;
     Status             = MachineStatus.OnAndNotWorking;
     Console.WriteLine("Recognizer machine stopped");
 }