Ejemplo n.º 1
0
        private void Listener()
        {
            byte[] read = new byte[1];

            List <byte> buffer = new List <byte>();

            while (true)
            {
                try
                {
                    if (socket.InputStream.Read(read, 0, read.Length) > 0)
                    {
                        if (read.Count() == 1 && read[0] != 0xFF)
                        {
                            buffer.AddRange(read);
                        }
                    }

                    if (read[0] == 0xFF)
                    {
                        socket.InputStream.Close();
                        ResultEvent?.Invoke(buffer);
                    }
                }
                catch (Exception exception) { Log.Debug(TAG, exception.ToString()); }
            }
        }
Ejemplo n.º 2
0
        public async Task <ResultEvent> InsertResultEvent(ResultEvent resultEvent)
        {
            await _context.ResultEvents.AddAsync(resultEvent);

            await _context.SaveChangesAsync();

            return(resultEvent);
        }
Ejemplo n.º 3
0
        internal RecognitionResult(ResultEvent evt, IntPtr cmdList, IntPtr result)
        {
            _resultEvent = evt;
            SafeCommandListHandle handle = new SafeCommandListHandle(cmdList);

            handle._ownership = false;
            _list             = new VoiceCommandList(handle);
            _result           = Marshal.PtrToStringAnsi(result);
        }
Ejemplo n.º 4
0
 protected virtual void End(DialogResult result, object [] param)
 {
     DialogResult = result;
     if (ResultEvent != null)
     {
         ResultEvent.DynamicInvoke(new object[] { this, new DialogResultEvent(result, param) });
     }
     Close();
 }
Ejemplo n.º 5
0
        private void AccessingWithCheck(Uri address)
        {
            new Task(() =>
            {
                using (WebClient webClient = new WebClient())
                {
                    webClient.Encoding = System.Text.Encoding.UTF8;
                    var result         = string.Empty;
                    webClient.DownloadStringCompleted +=
                        (sender, e) =>
                    {
                        if (e.Error == null)
                        {
                            result = e.Result;
                            if ((NewUrls.Count == 0) || ((NewUrls.Contains(address.ToString())) && (!OldUrls.Contains(address.ToString()))))
                            {
                                OldUrls.Add(address.ToString());
                            }
                            List <string> urls = LinkExtractor.ExtractUrl(result);

                            var urlsSameSite = urls.Where(x => Host.IsBaseOf(new Uri(x)));

                            foreach (var url in urlsSameSite.ToList())
                            {
                                string strUrl = url;
                                if (!strUrl.EndsWith("/"))
                                {
                                    if (!Path.HasExtension(new Uri(strUrl).AbsolutePath))
                                    {
                                        strUrl = url + "/";
                                    }
                                }
                                if ((!NewUrls.Contains(strUrl)) && (!OldUrls.Contains(strUrl)))
                                {
                                    NewUrls.Add(strUrl);
                                    //Console.WriteLine(url);
                                }
                            }
                            NewUrls.Remove(NewUrls[0]);
                            if (ResultEvent != null)
                            {
                                ResultEvent.Invoke(new ResultEventArgs(address.ToString(), result, urls, NewUrls, OldUrls));
                            }
                            if (NewUrls.Count > 0)
                            {
                                AccessingWithCheck(new Uri(NewUrls[0]));
                            }
                        }
                        else
                        {
                            ResultEvent.Invoke(new ResultEventArgs(e.Error));
                        }
                    };
                    webClient.DownloadStringAsync(address);
                }
            }).Start();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Sends the synthesized result to the engine service user.
        /// </summary>
        /// <feature>
        /// http://tizen.org/feature/speech.synthesis
        /// </feature>
        /// <remarks>
        /// This API is used in StartSynthesis(), when the TTS engine sends the synthesized result to the engine service user.
        /// The synthesized result must be transferred to the engine service user through this function.
        /// </remarks>
        /// <param name="resultEvent">The result event.</param>
        /// <param name="data">The result data.</param>
        /// <param name="dataSize">The result data size.</param>
        /// <param name="audioType">The audio type.</param>
        /// <param name="rate">The sample rate.</param>
        /// <exception cref="ArgumentException">Thrown in case of an invalid parameter.</exception>
        /// <exception cref="NotSupportedException">Thrown in case of not supported.</exception>
        /// <exception cref="InvalidOperationException">Thrown in case of operation failure.</exception>
        /// <precondition>
        /// EngineMain function should be invoked before this function is called. StartSynthesis() will invoke this function.
        /// </precondition>
        /// <since_tizen> 4 </since_tizen>
        public void SendResult(ResultEvent resultEvent, IntPtr data, int dataSize, AudioType audioType, int rate)
        {
            Error error = TTSESendResult(resultEvent, data, dataSize, audioType, rate, IntPtr.Zero);

            if (error != Error.None)
            {
                Log.Error(LogTag, "TTSESendResult Failed with error " + error);
                throw ExceptionFactory.CreateException((ErrorCode)error);
            }
        }
Ejemplo n.º 7
0
 public Game(ResultEvent e)
 {
     League    = e.LeagueCode;
     Round     = e.Round;
     GameDate  = e.GameDate;
     HomeTeam  = e.HomeTeam;
     AwayTeam  = e.AwayTeam;
     HomeScore = e.HomeScore;
     AwayScore = e.AwayScore;
 }
Ejemplo n.º 8
0
 internal static void InvokeEvents <T>(List <Result <T> > values, ResultEvent <T> eventList)
     where T : struct
 {
     if (eventList != null)
     {
         foreach (var item in values)
         {
             eventList(item.Data, item.Flag);
         }
     }
     values.Clear();
 }
Ejemplo n.º 9
0
    public async void MultiplicationTable(int number) //ST
    {
        for (int i = 0; true; i++)                    //ST
        {
            int result = number * i;                  //ST
                                                      //Should make a callback with all the data that is required by caller.

            ResultEvent?.Invoke(number, i, result);   // notification. ? is to check if resultevent is null if it is not null
            // then we will call back

            await Task.Delay(1000); //5 seconds delay
        } //ST
    } //ST
Ejemplo n.º 10
0
        private void worker()
        {
            string name;

            while (filenames.TryDequeue(out name))
            {
                if (_stopSignal.WaitOne(0))
                {
                    return;
                }
                ResultEvent?.Invoke(Predict_with_db(ImageToTensor(name), name));
            }
        }
Ejemplo n.º 11
0
        public bool FireFileProcessingResultEvent(ResultEvent e, TypeOfResult typeOfResult)
        {
            // Continue processing in parent of this viewmodel if there is any such requested
            if (this.ProcessingResultEvent != null)
            {
                this.ProcessingResultEvent(this, new ProcessResultEvent(e.Message, e.Error, e.Cancel, typeOfResult,
                                                                        e.ResultObjects, e.InnerException));

                return(true);
            }

            return(false);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Sends the recognition result to the engine service user.
        /// </summary>
        /// <feature>
        /// http://tizen.org/feature/speech.recognition
        /// http://tizen.org/feature/microphone
        /// </feature>
        /// <remarks>
        /// This API is used in SetRecordingData() and Stop(), when the STT engine sends the recognition result to the engine service user.
        /// This function is called in the following situations: 1) After Stop() is called, 2) The end point of speech is detected from recording, or 3) Partial result is occurred.
        /// The recognition result must be transferred to the engine service user through this function. Also, the timeInfo must be transferred to ForEachResultTime().
        /// The type of timeInfo is up to the STT engine developer.
        /// </remarks>
        /// <param name="resultEvent">The result event.</param>
        /// <param name="type">The recognition type, "stt.recognition.type.FREE", or "stt.recognition.type.FREE.PARTIAL".</param>
        /// <param name="result">Result texts.</param>
        /// <param name="resultCount">Result text count.</param>
        /// <param name="msg">Engine message.</param>
        /// <param name="timeInfo">The time information.</param>
        /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception>
        /// <exception cref="NotSupportedException">Thrown in case of not supported.</exception>
        /// <exception cref="InvalidOperationException">Thrown in case of an operation failure.</exception>
        /// <precondition>
        /// The EngineMain function should be invoked before this function is called. Stop will invoke this function.
        /// </precondition>
        /// <postcondition>
        /// This function invokes ForEachResultTime
        /// </postcondition>
        /// <since_tizen> 4 </since_tizen>
        public void SendResult(ResultEvent resultEvent, string type, string[] result, int resultCount, ResultMessage msg, IntPtr timeInfo)
        {
            if ((result != null) && (result.Length != 0))
            {

                string message = "stt.result.message.none";
                switch (msg)
                {
                    case ResultMessage.None:
                    message = "stt.result.message.none";
                    break;

                    case ResultMessage.TooFast:
                    message = "stt.result.message.error.too.fast";
                    break;

                    case ResultMessage.TooLong:
                    message = "stt.result.message.error.too.long";
                    break;

                    case ResultMessage.TooLoud:
                    message = "stt.result.message.error.too.loud";
                    break;

                    case ResultMessage.TooQuiet:
                    message = "stt.result.message.error.too.quiet";
                    break;

                    case ResultMessage.TooShort:
                    message = "stt.result.message.error.too.short";
                    break;

                    case ResultMessage.TooSoon:
                    message = "stt.result.message.error.too.soon";
                    break;
                }

                Error error = STTESendResult(resultEvent, type, result, resultCount, message, timeInfo, IntPtr.Zero);
                if (error != Error.None)
                {
                    Log.Error(LogTag, "STTESendResult Failed with error " + error);
                    throw ExceptionFactory.CreateException((ErrorCode)error);
                }

            }
            else
            {
                throw new ArgumentNullException("result", "is null or empty");
            }
        }
Ejemplo n.º 13
0
        private void worker()
        {
            string name;

            while (filenames.TryDequeue(out name))
            {
                if (_stopSignal.WaitOne(0))
                {
                    ErrMessage?.Invoke("Stopping Thread by signal");
                    return;
                }
                ResultEvent?.Invoke(Predict(ImageToTensor(name), name));
            }
            InfoMessage?.Invoke("Stopping thread normally");
        }
Ejemplo n.º 14
0
        public void NibbleTipster_TipsGame()
        {
            var testResult = new ResultEvent
            {
                LeagueCode = "NRL",
                HomeTeam   = "MELB",
                AwayTeam   = "BRIS",
            };
            var testGame = new Game(testResult);
            var cut      = new NibbleTipster(
                new TippingContext());

            _output.WriteLine(cut.RateResults("NRL"));
            _output.WriteLine(cut.Tip(testGame).ToString());
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Method is executed when the background process finishes and returns here
        /// because it was cancelled or is done processing.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FileLoaderLoadResultEvent(object sender, ResultEvent e)
        {
            _AsyncProcessor.ProcessingResultEvent -= FileLoaderLoadResultEvent;
            _AsyncProcessor = null;

            CommandManager.InvalidateRequerySuggested();

            // close documents automatically without message when re-loading on startup
            if (State == DocumentState.IsInvalid && CloseOnErrorWithoutMessage)
            {
                OnClose();
                return;
            }

            // Continue processing in parent of this viewmodel if there is any such requested
            FireFileProcessingResultEvent(e, TypeOfResult.FileLoad);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Method is executed when the background process finishes and returns here
        /// because it was cancelled or is done processing.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ProcessorResultEvent(object sender, ResultEvent e)
        {
            try
            {
                lock (lockObject)
                {
                    if (mProcessor != null)
                    {
                        mProcessor.ProcessResultEvent -= ProcessorResultEvent;
                        mProcessor.Dispose();
                        mProcessor = null;
                    }

                    IsProcessing = false;

                    if (e.InnerException != null)
                    {
                        var exp = new ApplicationException(e.Message, e.InnerException)
                        {
                            Source = "ProcessViewModel"
                        };
                        exp.Data.Add("Process cancelled?", e.Cancel.ToString());

                        ////mMsgBox.Show(exp, mErrorMessageCaption, MsgBoxButtons.OK, MsgBoxImage.Alert);

                        if (mProcessFinsishedMethod != null)
                        {
                            mProcessFinsishedMethod(false, exp, ProcessorLocal.ProcessorStrings.STR_UNSUCCESFUL_PROCESSING);
                        }
                    }
                    else
                    {
                        if (mProcessFinsishedMethod != null)
                        {
                            mProcessFinsishedMethod(true, null, null);
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 17
0
        //public void Stop() => _ct.Cancel();
        private void worker()
        {
            string name;

            while (filenames.TryDequeue(out name))
            {
                //Console.WriteLine("here working");
                if (_ct.IsCancellationRequested || _stopSignal.WaitOne(0))
                {
                    Console.WriteLine("sssss");
                    ErrMessage?.Invoke("Stopping Thread by signal");
                    return;
                }
                //Console.WriteLine("here after");
                var current_res = Predict_with_db(ImageToTensor(name), name);
                ResultEvent?.Invoke(current_res);
            }
            InfoMessage?.Invoke("Stopping thread normally");
        }
        /// <summary>
        /// Sets up the notifications;
        /// Will call Status
        /// </summary>
        /// <param name="notifyType"></param>
        /// <returns>true if the notify was set up. </returns>

        public async Task <bool> NotifyResultAsync(GattClientCharacteristicConfigurationDescriptorValue notifyType = GattClientCharacteristicConfigurationDescriptorValue.Notify)
        {
            if (!await EnsureCharacteristicAsync())
            {
                return(false);
            }
            var ch = Characteristics[0];

            if (ch == null)
            {
                return(false);
            }
            GattCommunicationStatus result = GattCommunicationStatus.ProtocolError;

            try
            {
                result = await ch.WriteClientCharacteristicConfigurationDescriptorAsync(notifyType);

                if (!NotifyResult_ValueChanged_Set)
                {
                    // Only set the event callback once
                    NotifyResult_ValueChanged_Set = true;
                    ch.ValueChanged += (sender, args) =>
                    {
                        var datameaning = "STRING|ASCII|Result";
                        var parseResult = BluetoothDeviceController.BleEditor.ValueParser.Parse(args.CharacteristicValue, datameaning);

                        Result = parseResult.ValueList.GetValue("Result").AsString;

                        ResultEvent?.Invoke(parseResult);
                    };
                }
            }
            catch (Exception e)
            {
                Status.ReportStatus($"NotifyResult: {e.Message}", result);
                return(false);
            }
            Status.ReportStatus($"NotifyResult: set notification", result);

            return(true);
        }
Ejemplo n.º 19
0
        public void NibbleTipster_RatesGame()
        {
            var testResult = new ResultEvent
            {
                LeagueCode = "NRL",
                HomeTeam   = "MELB",
                AwayTeam   = "BRIS",
                HomeScore  = 22,
                AwayScore  = 12
            };
            var testGame = new Game(testResult);
            var cut      = new NibbleTipster(
                new TippingContext());
            var result = cut.RateGame(testGame, 20);

            _output.WriteLine(result.ToString());
            Assert.True(
                result.AwayRating.Offence.Equals(-2),
                $"Away Off adj was {result.AwayRating.Offence}");
            Assert.True(
                result.HomeRating.Defence.Equals(-2),
                $"Home Def adj was {result.AwayRating.Defence}");
        }
Ejemplo n.º 20
0
        /*
         * This method will display selected sale info
         * @author A.K.M. Nazmul Islam on 26th january 2016
         */
        public void OnSelectSaleOrderEvent(SaleInfoNJ saleInfoNJ)
        {
            SaleManager saleManager = new SaleManager();
            ResultEvent resultEvent = saleManager.getSaleOrderInfo(saleInfoNJ.OrderNo);

            if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS)
            {
                SaleInfo   saleInfo       = (SaleInfo)resultEvent.getResult();
                SaleInfoNJ tempSaleInfoNJ = new SaleInfoNJ();
                tempSaleInfoNJ.OrderNo  = saleInfo.getOrderNo();
                tempSaleInfoNJ.StatusId = saleInfo.getStatusId();
                tempSaleInfoNJ.Remarks  = saleInfo.getRemarks();
                for (Iterator j = saleInfo.getProductList().iterator(); j.hasNext();)
                {
                    ProductInfo   productInfo   = (ProductInfo)j.next();
                    ProductInfoNJ productInfoNJ = new ProductInfoNJ();
                    productInfoNJ.Id        = productInfo.getId();
                    productInfoNJ.Name      = productInfo.getName();
                    productInfoNJ.Code      = productInfo.getCode();
                    productInfoNJ.UnitPrice = productInfo.getUnitPrice();
                    productInfoNJ.Quantity  = productInfo.getQuantity();
                    tempSaleInfoNJ.ProductList.Add(productInfoNJ);
                }
                CustomerInfo   customerInfo   = new CustomerInfo();
                CustomerInfoNJ customerInfoNJ = new CustomerInfoNJ();
                customerInfoNJ.ProfileInfoNJ.Id        = saleInfo.getCustomerInfo().getProfileInfo().getId();
                customerInfoNJ.ProfileInfoNJ.FirstName = saleInfo.getCustomerInfo().getProfileInfo().getFirstName();
                customerInfoNJ.ProfileInfoNJ.LastName  = saleInfo.getCustomerInfo().getProfileInfo().getLastName();
                tempSaleInfoNJ.CustomerInfoNJ          = customerInfoNJ;
                SaleInfoNJ = tempSaleInfoNJ;
            }
            else
            {
                MessageBox.Show(resultEvent.getMessage());
            }
        }
Ejemplo n.º 21
0
        /*
         * This method will display selected purchase info
         * @author nazmul hasan on 26th january 2016
         */
        public void OnSelectPurchaseOrderEvent(PurchaseInfoNJ purchaseInfoNJ)
        {
            PurchaseManager purchaseManager = new PurchaseManager();
            ResultEvent     resultEvent     = purchaseManager.getPurchaseOrderInfo(purchaseInfoNJ.OrderNo);

            if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS)
            {
                PurchaseInfo   purchaseInfo       = (PurchaseInfo)resultEvent.getResult();
                PurchaseInfoNJ tempPurchaseInfoNJ = new PurchaseInfoNJ();
                tempPurchaseInfoNJ.OrderNo  = purchaseInfo.getOrderNo();
                tempPurchaseInfoNJ.StatusId = purchaseInfo.getStatusId();
                tempPurchaseInfoNJ.Remarks  = purchaseInfo.getRemarks();
                for (Iterator j = purchaseInfo.getProductList().iterator(); j.hasNext();)
                {
                    ProductInfo   productInfo   = (ProductInfo)j.next();
                    ProductInfoNJ productInfoNJ = new ProductInfoNJ();
                    productInfoNJ.Id        = productInfo.getId();
                    productInfoNJ.Name      = productInfo.getName();
                    productInfoNJ.Code      = productInfo.getCode();
                    productInfoNJ.UnitPrice = productInfo.getUnitPrice();
                    productInfoNJ.Quantity  = productInfo.getQuantity();
                    tempPurchaseInfoNJ.ProductList.Add(productInfoNJ);
                }
                SupplierInfo   supplierInfo   = new SupplierInfo();
                SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ();
                supplierInfoNJ.ProfileInfoNJ.Id        = purchaseInfo.getSupplierInfo().getProfileInfo().getId();
                supplierInfoNJ.ProfileInfoNJ.FirstName = purchaseInfo.getSupplierInfo().getProfileInfo().getFirstName();
                supplierInfoNJ.ProfileInfoNJ.LastName  = purchaseInfo.getSupplierInfo().getProfileInfo().getLastName();
                tempPurchaseInfoNJ.SupplierInfoNJ      = supplierInfoNJ;
                PurchaseInfoNJ = tempPurchaseInfoNJ;
            }
            else
            {
                MessageBox.Show(resultEvent.getMessage());
            }
        }
Ejemplo n.º 22
0
        internal RecognitionResultEventArgs(ResultEvent e, IntPtr data, int count, string msg)
        {
            _result = e;
            switch (msg)
            {
            case "stt.result.message.none":
            {
                _msg = ResultMessage.None;
                break;
            }

            case "stt.result.message.error.too.soon":
            {
                _msg = ResultMessage.TooSoon;
                break;
            }

            case "stt.result.message.error.too.short":
            {
                _msg = ResultMessage.TooShort;
                break;
            }

            case "stt.result.message.error.too.long":
            {
                _msg = ResultMessage.TooLong;
                break;
            }

            case "stt.result.message.error.too.quiet":
            {
                _msg = ResultMessage.TooQuiet;
                break;
            }

            case "stt.result.message.error.too.loud":
            {
                _msg = ResultMessage.TooLoud;
                break;
            }

            case "stt.result.message.error.too.fast":
            {
                _msg = ResultMessage.TooFast;
                break;
            }
            }

            this._dataCount = count;

            _data.Clear();
            if (count > 0)
            {
                IntPtr[] dataArray = new IntPtr[count];
                Marshal.Copy(data, dataArray, 0, count);
                foreach (IntPtr handle in dataArray)
                {
                    string info = Marshal.PtrToStringAnsi(handle);
                    _data.Add(info);
                }
            }
        }
Ejemplo n.º 23
0
 public virtual void OnResultEvent()
 {
     ResultEvent?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 24
0
 internal static extern Error STTESendResult(ResultEvent resultEvent, string type, string[] result, int resultCount, string msg, IntPtr timeInfo, IntPtr userData);
Ejemplo n.º 25
0
        /*
         * This method will add/update a supplier
         * @author nazmul hasan on 5th january 2016
         */
        private void OnAdd()
        {
            if (!ValidateSupplier())
            {
                MessageBox.Show(ErrorMessage);
                return;
            }
            ProfileInfo profileInfo = new ProfileInfo();

            profileInfo.setId(SupplierInfoNJ.ProfileInfoNJ.Id);
            profileInfo.setFirstName(SupplierInfoNJ.ProfileInfoNJ.FirstName);
            profileInfo.setLastName(SupplierInfoNJ.ProfileInfoNJ.LastName);
            profileInfo.setEmail(SupplierInfoNJ.ProfileInfoNJ.Email);
            profileInfo.setPhone(SupplierInfoNJ.ProfileInfoNJ.Phone);
            profileInfo.setFax(SupplierInfoNJ.ProfileInfoNJ.Fax);
            profileInfo.setWebsite(SupplierInfoNJ.ProfileInfoNJ.Website);

            SupplierInfo supplierInfo = new SupplierInfo();

            supplierInfo.setProfileInfo(profileInfo);
            SupplierManager supplierManager = new SupplierManager();

            SupplierInfoNJ supplierInfoNJ = new SupplierInfoNJ();

            supplierInfoNJ.ProfileInfoNJ.Id        = SupplierInfoNJ.ProfileInfoNJ.Id;
            supplierInfoNJ.ProfileInfoNJ.FirstName = SupplierInfoNJ.ProfileInfoNJ.FirstName;
            supplierInfoNJ.ProfileInfoNJ.LastName  = SupplierInfoNJ.ProfileInfoNJ.LastName;
            supplierInfoNJ.ProfileInfoNJ.Email     = SupplierInfoNJ.ProfileInfoNJ.Email;
            supplierInfoNJ.ProfileInfoNJ.Phone     = SupplierInfoNJ.ProfileInfoNJ.Phone;
            supplierInfoNJ.ProfileInfoNJ.Fax       = SupplierInfoNJ.ProfileInfoNJ.Fax;
            supplierInfoNJ.ProfileInfoNJ.Website   = SupplierInfoNJ.ProfileInfoNJ.Website;
            supplierInfoNJ.Remarks = supplierInfo.getRemarks();

            ResultEvent resultEvent = new ResultEvent();

            if (SupplierInfoNJ.ProfileInfoNJ.Id > 0)
            {
                resultEvent = supplierManager.updateSupplier(supplierInfo);
            }
            else
            {
                resultEvent = supplierManager.createSupplier(supplierInfo);
            }
            if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS)
            {
                if (SupplierInfoNJ.ProfileInfoNJ.Id > 0)
                {
                    for (int counter = 0; counter < SupplierList.Count; counter++)
                    {
                        SupplierInfoNJ tempSupplierInfoNJ = SupplierList.ElementAt(counter);

                        if (tempSupplierInfoNJ.ProfileInfoNJ.Id == SupplierInfoNJ.ProfileInfoNJ.Id)
                        {
                            SupplierList.RemoveAt(counter);
                            SupplierList.Insert(counter, supplierInfoNJ);
                        }
                    }
                }
                else
                {
                    SupplierInfo responseSupplierInfo = (SupplierInfo)resultEvent.getResult();
                    SupplierInfoNJ.ProfileInfoNJ.Id = responseSupplierInfo.getProfileInfo().getId();
                    supplierInfoNJ.ProfileInfoNJ.Id = SupplierInfoNJ.ProfileInfoNJ.Id;
                    if (SupplierList.Count == 0)
                    {
                        SupplierList.Add(supplierInfoNJ);
                    }
                    else
                    {
                        SupplierList.Insert(0, supplierInfoNJ);
                    }
                }
            }
            MessageBox.Show(resultEvent.getMessage());
            //resetting supplier info fields
            OnReset();
        }
Ejemplo n.º 26
0
 internal AsrResultEventArgs(ResultEvent evt, string resultString)
 {
     ResultEvent = evt;
     Result      = resultString;
 }
Ejemplo n.º 27
0
 public static string PackEvent(ResultEvent cmd)
 {
     return(Enum.GetName(typeof(ResultEvent), cmd));
 }
Ejemplo n.º 28
0
 internal static extern Error TTSESendResult(ResultEvent resultEvent, IntPtr data, int dataSize, AudioType audioType, int rate, IntPtr userData);
Ejemplo n.º 29
0
 public void RegisterListener <Know>(ResultEvent onAction) where Know : ICallback
 {
     CheckNulls();
     // TODO: IMPLEMENT THIS
 }
Ejemplo n.º 30
0
        /*
         * This method will add/update a customer
         * @author nazmul hasan on 5th january 2016
         */
        private void OnAdd()
        {
            if (!ValidateCustomer())
            {
                MessageBox.Show(ErrorMessage);
                return;
            }
            ProfileInfo profileInfo = new ProfileInfo();

            profileInfo.setId(CustomerInfoNJ.ProfileInfoNJ.Id);
            profileInfo.setFirstName(CustomerInfoNJ.ProfileInfoNJ.FirstName);
            profileInfo.setLastName(CustomerInfoNJ.ProfileInfoNJ.LastName);
            profileInfo.setEmail(CustomerInfoNJ.ProfileInfoNJ.Email);
            profileInfo.setPhone(CustomerInfoNJ.ProfileInfoNJ.Phone);
            profileInfo.setFax(CustomerInfoNJ.ProfileInfoNJ.Fax);
            profileInfo.setWebsite(CustomerInfoNJ.ProfileInfoNJ.Website);
            CustomerInfo customerInfo = new CustomerInfo();

            customerInfo.setProfileInfo(profileInfo);
            CustomerManager customerManager = new CustomerManager();

            CustomerInfoNJ customerInfoNJ = new CustomerInfoNJ();

            customerInfoNJ.ProfileInfoNJ.Id        = CustomerInfoNJ.ProfileInfoNJ.Id;
            customerInfoNJ.ProfileInfoNJ.FirstName = CustomerInfoNJ.ProfileInfoNJ.FirstName;
            customerInfoNJ.ProfileInfoNJ.LastName  = CustomerInfoNJ.ProfileInfoNJ.LastName;
            customerInfoNJ.ProfileInfoNJ.Email     = CustomerInfoNJ.ProfileInfoNJ.Email;
            customerInfoNJ.ProfileInfoNJ.Phone     = CustomerInfoNJ.ProfileInfoNJ.Phone;
            customerInfoNJ.ProfileInfoNJ.Fax       = CustomerInfoNJ.ProfileInfoNJ.Fax;
            customerInfoNJ.ProfileInfoNJ.Website   = CustomerInfoNJ.ProfileInfoNJ.Website;

            ResultEvent resultEvent = new ResultEvent();

            if (CustomerInfoNJ.ProfileInfoNJ.Id > 0)
            {
                resultEvent = customerManager.updateCustomer(customerInfo);
            }
            else
            {
                resultEvent = customerManager.createCustomer(customerInfo);
            }
            if (resultEvent.getResponseCode() == Responses.RESPONSE_CODE_SUCCESS)
            {
                if (CustomerInfoNJ.ProfileInfoNJ.Id > 0)
                {
                    for (int counter = 0; counter < CustomerList.Count; counter++)
                    {
                        CustomerInfoNJ tempCustomerInfoNJ = CustomerList.ElementAt(counter);

                        if (tempCustomerInfoNJ.ProfileInfoNJ.Id == CustomerInfoNJ.ProfileInfoNJ.Id)
                        {
                            CustomerList.RemoveAt(counter);
                            CustomerList.Insert(counter, customerInfoNJ);
                        }
                    }
                }
                else
                {
                    CustomerInfo responseCustomerInfo = (CustomerInfo)resultEvent.getResult();
                    CustomerInfoNJ.ProfileInfoNJ.Id = responseCustomerInfo.getProfileInfo().getId();
                    customerInfoNJ.ProfileInfoNJ.Id = CustomerInfoNJ.ProfileInfoNJ.Id;
                    if (CustomerList.Count == 0)
                    {
                        CustomerList.Add(customerInfoNJ);
                    }
                    else
                    {
                        CustomerList.Insert(0, customerInfoNJ);
                    }
                }
            }
            MessageBox.Show(resultEvent.getMessage());
            //reset create Customer fields
            OnReset();
        }