Exemple #1
0
 void ToggleUI()
 {
     if (inEditing && (int.Parse(AllStoreData[currentStoreIndex].data[currIndex].price) > coinsValue))
     {
         BuyItemB.SetActive(false);
     }
     else
     {
         BuyItemB.SetActive(inEditing);
     }
     SitDownB.SetActive(false);
     ReturnB.SetActive(inEditing);
     NextItemB.SetActive(inEditing);
     PrevItemB.SetActive(inEditing);
     objectTitle.SetActive(inEditing);
     price.SetActive(inEditing);
     GoHomeB.SetActive(!inEditing);
     if (inEditing)
     {
         chatBubbleIsActive = currentChatBubble.activeSelf;
         RequestSent.SetActive(false);
         RequestRejected.SetActive(false);
         AcceptRequest.SetActive(false);
         SendRequest.SetActive(false);
         currentChatBubble.SetActive(false);
     }
     else
     {
         currentChatBubble.SetActive(chatBubbleIsActive);
     }
     ScreenshotB.SetActive(!inEditing);
     joystick.SetActive(!inEditing);
     StoreB.SetActive(!inEditing);
 }
Exemple #2
0
        private void SendModbusMessage(byte[] modbusMessage)
        {
            // ЕСЛИ ПОРТ ЗАКРЫТ
            if (!SerialPort.IsOpen)
            {
                try
                {
                    SerialPort.Open();
                }
                catch (InvalidOperationException ex)
                {
                    SerialPortOpeningError?.Invoke($"Возникла ошибка при попытке открыть порт {SerialPort.PortName}. Подробнее о возникшей исключительной ситуации: \n\n {ex.Message}");
                }
            }

            // Очищаем буффер исходящих данных (порт может быть уже открытым и там могут быть данные с прошлой отправки)
            SerialPort.DiscardOutBuffer();
            Thread.Sleep(50);

            try
            {
                // Отправляем данные
                SerialPort.Write(modbusMessage, 0, modbusMessage.Length);
            }
            catch (TimeoutException ex) // По истечении WriteTimeout [мс]
            {
                SerialPortWritingError?.Invoke($"Произошла ошибка при записи данных порт. \n\nПодробнее о возникшей исключительной ситуации: \n\n {ex.Message}");
            }
            RequestSent?.Invoke(modbusMessage); // Вызов события "отправлена команда"

            Thread.Sleep(ResponseTimeout);      // Задержка выжидания поступления данных на COM порт
        }
        /// <summary>
        /// Raises the <see cref="RequestSent"/> event. Note, sender is null.
        /// </summary>
        public static void onRequestSent(Uri inUri, HttpWebResponse inResponse)
        {
            // Written, 02.09.2017

            onSendingStopWatch.Stop();
            requestsSentThisSession++;
            Console.WriteLine("Request Completed: Total RS: {0} ({1}ms)", requestsSentThisSession, onSendingStopWatch.Elapsed.TotalMilliseconds.ToString("F2"));
            RequestSent?.Invoke(null, new RequestSentEventArgs(inUri, inResponse));
        }
Exemple #4
0
        protected override Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            RequestSent?.Invoke(request);

            if (ResponseMap.ContainsKey(request.RequestUri))
            {
                return(Task.FromResult(ResponseMap[request.RequestUri]));
            }

            return(Task.FromResult(new HttpResponseMessage(HttpStatusCode.NotFound)
            {
                RequestMessage = request
            }));
        }
Exemple #5
0
        private void btnSendRequest_Click(object sender, EventArgs e)
        {
            IncomeExpense ie = new IncomeExpense();

            ie = gridUtility.GetSelectedItem <IncomeExpense>();
            ie.IncomeExpenseId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["IncomeExpenseId"]));
            if (ie.ApproveStatusId == 1)
            {
                FlatMsgBox.Show("Đã có một yêu cầu khác gửi đi ở dòng này đang chờ xác nhận, không thể gửi thêm yêu cầu.");
                return;
            }
            if (ie == null)
            {
                return;
            }
            RequestSent rs = new RequestSent();

            rs.TableName = "IncomeExpense";
            rs.IdValue   = ie.IncomeExpenseId;
            rs.RequestTo = "quangphat";
            rs.RequestBy = UserManagement.UserSession.UserName;
            frmEditIncomExpense obj = new frmEditIncomExpense();

            obj.value = GetDetail;
            obj.ShowDialog();
            if (detail == null)
            {
                return;
            }
            rs.Detail = detail;

            try
            {
                ie.ApproveStatusId = 1;
                using (IUnitOfWork uow = new UnitOfWork())
                {
                    uow.RequestSentRepository.Add(rs);
                    uow.IncomeExpenseRepository.Update(ie);
                    uow.Commit();
                }
                FlatMsgBox.Show("Yêu cầu đã được gửi");
                detail = null;
            }
            catch
            {
                FlatMsgBox.Show("Không thể gửi yêu cầu");
            }
        }
        /// <summary>
        /// Tworzy i wysyła zapytanie do serwera. Na odpowiedź na zapytanie należy nasłuchiwać na event'cie RequestResponseReceived
        /// </summary>
        /// <param name="requestData">Dane zapytania do wysłania, metoda obudowuje je dodatkowo odpowiednimi meta-danymi zapytania</param>
        public Request SendRequest(JObject requestData)
        {
            var requestId = CurrentRequestId;

            _CurrentRequestId++;

            var wrapper = new StandardRequestWrapperSerializer()
            {
                RequestCode = requestId,
                Data        = requestData
            };
            var request = new Request(this, wrapper.GetApiObject(), requestId);

            OnGoingRequests.Add(requestId, request);
            request.Send();

            RequestSent?.Invoke(this, request);
            return(request);
        }
Exemple #7
0
        private void SendRequests(CancellationToken token)
        {
            while (!token.IsCancellationRequested)
            {
                lock (_locker)
                {
                    // awaiting acknowledgement from server
                    if (!_awaitingRequests.IsEmpty)
                    {
                        continue;
                    }

                    // do nothing if buffer is empty
                    if (_operationsBuffer.IsEmpty)
                    {
                        continue;
                    }

                    // if no subscriber (server) attached do not send operations
                    if (RequestSent == null)
                    {
                        continue;
                    }

                    // send a new request with the queued operations from the buffer
                    IRequest request = RequestFactory.CreateRequest(ClientId, _revision, _operationsBuffer.ToList());
                    RequestSent.Invoke(request);

                    _awaitingRequests.Enqueue(request);
                    _operationsBuffer.Clear();

                    if (_logginEnabled)
                    {
                        _logger.LogWriteLine($"Client with ID: '{ClientId}' sent new request to the server");
                    }
                }
            }
        }
Exemple #8
0
 internal static void Sent(HttpWebRequest request, string json)
 => RequestSent?.Invoke(request, json);
Exemple #9
0
 protected RemoteDebuggerMessage OnRequestSent(RemoteDebuggerMessage message)
 {
     return(RequestSent?.Invoke(message));
 }
Exemple #10
0
 public virtual void OnRequestSent(WebEventArgs e)
 {
     RequestSent?.Invoke(e.Context, e);
 }
Exemple #11
0
        public void Execute(string card, string area, int count)
        {
            var products = SearchProducts("a");

            for (var i = 0; i < count; i++)
            {
                var id = products[rnd.Next(0, products.Count - 1)].Id;

                var response = SubmitOrder(new OrderRequest()
                {
                    Id       = Guid.NewGuid(),
                    Product  = id,
                    Address  = "Unit 1, 100 John Street, Sydney",
                    Quantity = rnd.Next(1, 9),
                    Payment  = GenerateCreditCardNumber(card),
                    Zip      = GenerateAreaCode(area),
                    Country  = "Australia"
                });

                if (response.Data.Status)
                {
                    RequestPassed?.Invoke(this, new EventArgs());
                }
                else
                {
                    RequestFailed?.Invoke(this, new EventArgs());
                }

                foreach (var o in response.Downstream)
                {
                    if (o.Endpoint.Contains("payment"))
                    {
                        if (o.Version.Equals(1))
                        {
                            RequestProcessedByPaymentServer1?.Invoke(this, new EventArgs());
                        }

                        if (o.Version.Equals(2))
                        {
                            RequestProcessedByPaymentServer2?.Invoke(this, new EventArgs());
                        }
                    }

                    if (o.Endpoint.Contains("address"))
                    {
                        if (o.Version.Equals(1))
                        {
                            RequestProcessedByAddressServer1?.Invoke(this, new EventArgs());
                        }

                        if (o.Version.Equals(2))
                        {
                            RequestProcessedByAddressServer2?.Invoke(this, new EventArgs());
                        }

                        if (o.Version.Equals(3))
                        {
                            RequestProcessedByAddressServer3?.Invoke(this, new EventArgs());
                        }
                    }
                }

                RequestSent?.Invoke(this, new EventArgs());
            }
        }