示例#1
0
文件: RegMain.cs 项目: radtek/InfoPos
        public static Result Get(EnumMessage errno)
        {
            Result res = null;

            switch (errno)
            {
            case EnumMessage.RECORD_NOT_SELECTED:
                res = new Result((int)errno, "Барьцаа сонгогдоогүй байна!");
                break;

            case EnumMessage.CUSTOMER_NOT_SELECTED:
                res = new Result((int)errno, "Харилцагч сонгогдоогүй байна!");
                break;

            case EnumMessage.AMOUNT_NOT_ENTERED:
                res = new Result((int)errno, "Төлбөрийн дүнг оруулна уу!");
                break;

            case EnumMessage.INTERNAL_ERROR:
                res = new Result((int)errno, "Дотоод алдаа гарлаа!");
                break;

            default:
                res = new Result(99999, "Тодорхойгүй алдаа!");
                break;
            }
            return(res);
        }
示例#2
0
    public async Task <ActionResult> SendEnumMessage()
    {
        EnumMessage   message    = new EnumMessage();
        Task <Status> statusTask = MvcApplication.Bus.Send("Samples.Callbacks.Receiver", message)
                                   .Register <Status>();

        return(View("SendEnumMessage", await statusTask));
    }
示例#3
0
        public StringMessageCollector SetMessage(EnumMessage enumMessage)
        {
            this.Message = enumMessage == EnumMessage.HelloWorldMessage
                ? ((DescriptionAttribute)typeof(EnumMessage).GetMember(EnumMessage.HelloWorldMessage.ToString())[0].GetCustomAttributes(typeof(DescriptionAttribute), false)[0]).Description
                : ((DescriptionAttribute)typeof(EnumMessage).GetMember(EnumMessage.GoodbyeWorldMessage.ToString())[0].GetCustomAttributes(typeof(DescriptionAttribute), false)[0]).Description;

            return(this);
        }
 public async Task<ActionResult> SendEnumMessage()
 {
     var message = new EnumMessage();
     var sendOptions = new SendOptions();
     sendOptions.SetDestination("Samples.Callbacks.Receiver");
     Task<Status> statusTask = MvcApplication.EndpointInstance.Request<Status>(message, sendOptions);
     return View("SendEnumMessage", await statusTask.ConfigureAwait(false));
 }
示例#5
0
 private bool SetMsgAndReturn(EnumMessage msgEnum, List <string> msgParam, bool returnValue)
 {
     if (GetMsgObj != null)
     {
         ReturnMsg = GetMsgObj.GetSystemMsg(msgEnum, msgParam);
     }
     return(returnValue);
 }
 public async Task<ActionResult> SendEnumMessage()
 {
     EnumMessage message = new EnumMessage();
     SendOptions sendOptions = new SendOptions();
     sendOptions.SetDestination("Samples.Callbacks.Receiver");
     Task<Status> statusTask = MvcApplication.Endpoint.Request<Status>(message, sendOptions);
     return View("SendEnumMessage", await statusTask);
 }
示例#7
0
 public override void OnReceiveLocal(bool server, EnumMessage <KickReason> message)
 {
     if (!server)
     {
         return;
     }
     QSBCore.UnityEvents.FireInNUpdates(() => KickPlayer(message.AboutId), 10);
 }
示例#8
0
        public override void OnReceiveRemote(bool server, EnumMessage <SignalFrequency> message)
        {
            PlayerData.LearnFrequency(message.EnumValue);
            var displayMsg = $"{UITextLibrary.GetString(UITextType.NotificationNewFreq)} <color=orange>{AudioSignal.FrequencyToString(message.EnumValue, false)}</color>";
            var data       = new NotificationData(NotificationTarget.All, displayMsg, 10f, true);

            NotificationManager.SharedInstance.PostNotification(data, false);
        }
    public async Task<ActionResult> SendEnumMessage()
    {
        EnumMessage message = new EnumMessage();
        Task<Status> statusTask = MvcApplication.Bus.Send("Samples.Callbacks.Receiver", message)
            .Register<Status>();

        return View("SendEnumMessage", await statusTask);
    }
    public async Task<ActionResult> SendEnumMessage()
    {
        var message = new EnumMessage();
        var statusTask = MvcApplication.Bus.Send("Samples.Callbacks.Receiver", message)
            .Register<Status>()
            .ConfigureAwait(false);

        return View("SendEnumMessage", await statusTask);
    }
示例#11
0
        public ReturnMsgVm GetSystemMsg(EnumMessage eCode, string value)
        {
            _msg.ReturnMsgEnum = eCode;
            var eCodeValue = (int)eCode;

            switch (eCodeValue.ToString().Substring(0, 1))
            {
            case "9":
            {
                _msg.ReturnMsg = GetErrMsg(eCode, value);
                break;
            }

            case "8":
            {
                _msg.ReturnMsg = GetErrMsg(eCode, value);
                break;
            }

            case "5":
            {
                _msg.ReturnMsg = GetMsg(eCode, value);
                break;
            }

            case "2":
            {
                _msg.ReturnMsg = GetMsg(eCode, value);
                break;
            }

            case "1":
            {
                _msg.ReturnMsg = GetMsg(eCode, value);
                break;
            }

            case "0":
            {
                _msgSystem.ReturnMsgEnum       = eCode;
                _msgSystem.ReturnMsg           = GetErrMsg(eCode, value);
                _systemCommunicationErrorFound = true;
                break;
            }

            default:
            {
                break;
            }
            }
            if (_systemCommunicationErrorFound)
            {
            }
            _msgList.Add(_msg);
            Console.WriteLine(_msg.ReturnMsg);
            return(_msg);
        }
        public override void OnReceiveRemote(bool server, EnumMessage <SignalName> message)
        {
            PlayerData.LearnSignal(message.EnumValue);
            QSBEventManager.FireEvent("IdentifySignal");
            var displayMsg = $"{UITextLibrary.GetString(UITextType.NotificationSignalIdentified)} <color=orange>{AudioSignal.SignalNameToString(message.EnumValue)}</color>";
            var data       = new NotificationData(NotificationTarget.All, displayMsg, 10f, true);

            NotificationManager.SharedInstance.PostNotification(data, false);
        }
示例#13
0
 public override void OnReceiveRemote(bool server, EnumMessage <AnimationType> message)
 {
     if (!QSBCore.HasWokenUp || !QSBPlayerManager.GetPlayer(message.AboutId).IsReady)
     {
         return;
     }
     QSBPlayerManager.GetPlayer(message.AboutId).AnimationSync.SetAnimationType(message.EnumValue);
     QSBPlayerManager.GetSyncObject <InstrumentsManager>(message.AboutId).CheckInstrumentProps(message.EnumValue);
 }
示例#14
0
        public void ExecutorFunction(EnumMessage type, ISender sender)
        {
            // launch the function corresponding to the type of message
            var result = ExecutorArray[type]();

            // send response to sender
            sender.IsDemandAccepted = result;
            sender.WaitingResponse.Release();
        }
示例#15
0
    public async Task <ActionResult> SendEnumMessage()
    {
        var message    = new EnumMessage();
        var statusTask = MvcApplication.Bus.Send("Samples.Callbacks.Receiver", message)
                         .Register <Status>()
                         .ConfigureAwait(false);

        return(View("SendEnumMessage", await statusTask));
    }
    public async Task <ActionResult> SendEnumMessage()
    {
        EnumMessage message     = new EnumMessage();
        SendOptions sendOptions = new SendOptions();

        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        Task <Status> statusTask = MvcApplication.Endpoint.Request <Status>(message, sendOptions);

        return(View("SendEnumMessage", await statusTask));
    }
示例#17
0
    static async Task SendEnum()
    {
        EnumMessage message = new EnumMessage
        {
            Property = "The Property Value"
        };
        Status response = await Send <EnumMessage, Status>(message);

        Console.WriteLine("Response: " + response);
    }
    public async Task <ActionResult> SendEnumMessage()
    {
        var message     = new EnumMessage();
        var sendOptions = new SendOptions();

        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        Task <Status> statusTask = MvcApplication.EndpointInstance.Request <Status>(message, sendOptions);

        return(View("SendEnumMessage", await statusTask.ConfigureAwait(false)));
    }
示例#19
0
    static async Task SendEnum()
    {
        var message = new EnumMessage
        {
            Property = "The Property Value"
        };
        var response = await Send <EnumMessage, Status>(message)
                       .ConfigureAwait(false);

        Console.WriteLine($"Response: {response}");
    }
 public void SendEnumMessageAsync()
 {
     EnumMessage message = new EnumMessage();
     AsyncManager.OutstandingOperations.Increment();
     
     MvcApplication.Bus.Send("Samples.Callbacks.Receiver", message)
         .Register<Status>(status =>
         {
             AsyncManager.Parameters["status"] = status;
             AsyncManager.OutstandingOperations.Decrement();
         }, this);
 }
示例#21
0
        public string CreateMessage(EnumMessage messageType)
        {
            switch (messageType)
            {
            case EnumMessage.TooManyClientConnected:
                var value = new { Action = "Message", Message = "Too many client connected" };
                return(Newtonsoft.Json.JsonConvert.SerializeObject(value, Newtonsoft.Json.Formatting.None));

            default:
                return(string.Empty);
            }
        }
    static async Task SendEnumMessage(IBusSession busSession)
    {
        Console.WriteLine("Message sent");
        #region SendEnumMessage

        EnumMessage message = new EnumMessage();
        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        Status status = await busSession.Request<Status>(message, sendOptions);
        Console.WriteLine("Callback received with status:" + status);
        #endregion
    }
        private static async Task SendEnumMessage(IEndpointInstance endpointInstance)
        {
            Console.Write("Enum message sent");

            var message     = new EnumMessage();
            var sendOptions = new SendOptions();

            sendOptions.SetDestination(Endpoints.Receiver);
            var responseMessage = await endpointInstance.Request <EnumMessageResponse>(message, sendOptions).ConfigureAwait(false);

            Console.WriteLine($"Enum callback received with status: {responseMessage.Status}");
        }
示例#24
0
    public void SendEnumMessageAsync()
    {
        EnumMessage message = new EnumMessage();

        AsyncManager.OutstandingOperations.Increment();

        MvcApplication.Bus.Send("Samples.Callbacks.Receiver", message)
        .Register <Status>(status =>
        {
            AsyncManager.Parameters["status"] = status;
            AsyncManager.OutstandingOperations.Decrement();
        }, this);
    }
示例#25
0
    static async Task SendEnumMessage(IEndpointInstance endpointInstance)
    {
        Console.WriteLine("Message sent");
        #region SendEnumMessage

        EnumMessage message     = new EnumMessage();
        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        Status status = await endpointInstance.Request <Status>(message, sendOptions);

        Console.WriteLine("Callback received with status:" + status);
        #endregion
    }
示例#26
0
    static async void SendEnumMessage(IBus bus)
    {
        #region SendEnumMessage

        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Sample.Callbacks.Receiver");
        EnumMessage message = new EnumMessage();
        Status status = await bus.Request<Status>(message, sendOptions);
        Console.WriteLine("Callback received with status:" + status);

        #endregion

        Console.WriteLine("Message sent");
    }
示例#27
0
 public override void OnReceiveRemote(bool server, EnumMessage <KickReason> message)
 {
     if (message.AboutId != QSBPlayerManager.LocalPlayerId)
     {
         if (QSBPlayerManager.PlayerExists(message.AboutId))
         {
             DebugLog.ToAll($"{QSBPlayerManager.GetPlayer(message.AboutId).Name} was kicked.");
             return;
         }
         DebugLog.ToAll($"Player id:{message.AboutId} was kicked.");
         return;
     }
     DebugLog.ToAll($"Kicked from server. Reason : {message.EnumValue}");
 }
    static void SendEnumMessage(IBus bus)
    {
        #region SendEnumMessage

        var message = new EnumMessage();
        bus.Send("Samples.Callbacks.Receiver", message)
        .Register <Status>(status =>
        {
            Console.WriteLine("Callback received with status:" + status);
        });

        #endregion

        Console.WriteLine("Message sent");
    }
示例#29
0
    static void SendEnumMessage(IBus bus)
    {
        #region SendEnumMessage

        EnumMessage message = new EnumMessage();
        bus.Send("Sample.Callbacks.Receiver", message)
            .Register<Status>(status =>
            {
                Console.WriteLine("Callback received with status:" + status);
            });

        #endregion

        Console.WriteLine("Message sent");
    }
示例#30
0
    static async Task SendEnumMessage(IEndpointInstance endpointInstance)
    {
        Console.WriteLine("Message sent");

        #region SendEnumMessage

        var message = new EnumMessage();
        var sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        var status = await endpointInstance.Request<Status>(message, sendOptions)
            .ConfigureAwait(false);
        Console.WriteLine("Callback received with status:" + status);

        #endregion
    }
示例#31
0
    static async void SendEnumMessage(IBus bus)
    {
        #region SendEnumMessage

        SendOptions sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        EnumMessage message = new EnumMessage();
        Status      status  = await bus.Request <Status>(message, sendOptions);

        Console.WriteLine("Callback received with status:" + status);

        #endregion

        Console.WriteLine("Message sent");
    }
示例#32
0
        public void MessageLabel(EnumMessage msgEnum, Label label)
        {
            var msg = ((int)msgEnum).ToString();

            label.Text      = _objMsg.GetSystemMsg(msgEnum).ReturnMsg;
            label.ForeColor = Color.Black;
            if (msg.Substring(1, 1) == "9")
            {
                label.ForeColor = Color.Red;
            }
            if (msg.Substring(1, 1) == "1")
            {
                label.ForeColor = Color.Green;
            }
        }
示例#33
0
    static async Task SendEnumMessage(IEndpointInstance endpointInstance)
    {
        Console.WriteLine("Message sent");

        #region SendEnumMessage

        var message     = new EnumMessage();
        var sendOptions = new SendOptions();
        sendOptions.SetDestination("Samples.Callbacks.Receiver");
        var status = await endpointInstance.Request <Status>(message, sendOptions)
                     .ConfigureAwait(false);

        Console.WriteLine($"Callback received with status:{status}");

        #endregion
    }
        public override void OnReceiveRemote(bool server, EnumMessage <MarshmallowEventType> message)
        {
            if (!QSBCore.HasWokenUp)
            {
                return;
            }
            var marshmallow = QSBPlayerManager.GetPlayer(message.AboutId).Marshmallow;

            if (marshmallow == null)
            {
                DebugLog.ToConsole($"Warning - Marshmallow is null for player {message.AboutId}.", OWML.Common.MessageType.Warning);
                return;
            }
            switch (message.EnumValue)
            {
            case MarshmallowEventType.Burn:
                marshmallow.Burn();
                break;

            case MarshmallowEventType.Extinguish:
                marshmallow.Extinguish();
                break;

            case MarshmallowEventType.Remove:
                marshmallow.RemoveMallow();
                break;

            case MarshmallowEventType.Replace:
                marshmallow.SpawnMallow();
                break;

            case MarshmallowEventType.Shrivel:
                marshmallow.Shrivel();
                break;

            case MarshmallowEventType.Toss:
                TossMarshmallow(message.AboutId);
                break;
            }
        }
        public static DialogResult Message(EnumMessage MsgType, string Caption, string Text)
        {
            switch (MsgType)
            {
            case EnumMessage.DeleteMessage:
                return(MessageBox.Show(CurrentUILanguage == "ar-EG" ? "هل تريد حذف هذا السجل؟" : "Do You want to Delete this Record?", Caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2));

            case EnumMessage.CannotDeleteMessage:
                return(MessageBox.Show(CurrentUILanguage == "ar-EG" ? "لا يمكنك حذف هذا السجل لانه مرتبط ببعض البيانات الاخرى" : "Cannot Delete This Record AS it it Attached with other Data!", Caption, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1));

            case EnumMessage.SaveMessage:
                return(MessageBox.Show(CurrentUILanguage == "ar-EG" ? "هل تريد حفظ بيانات هذا السجل؟" : "Do You want To Save this Record?", Caption, MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1));

            case EnumMessage.BalanceVoucher:
                return(MessageBox.Show(CurrentUILanguage == "ar-EG" ? "القيد غير متوازن" : "Journal is UnBalanced", Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1));

            case EnumMessage.ValidateMessage:
                return(MessageBox.Show("Does not let " + Text + " Empty ", Caption, MessageBoxButtons.OK, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1));

            default:
                return(DialogResult.Cancel);
            }
        }
示例#36
0
        public static Result Get(EnumMessage errno)
        {
            Result res = null;

            switch (errno)
            {
            case EnumMessage.SALES_NOT_SELECTED:
                res = new Result((int)errno, "Борлуулалт сонгогдоогүй байна!");
                break;

            case EnumMessage.PRODUCT_NOT_SELECTED:
                res = new Result((int)errno, "Түрээсийн хэрэгсэл сонгогдоогүй байна!");
                break;

            case EnumMessage.INTERNAL_ERROR:
                res = new Result((int)errno, "Дотоод алдаа гарлаа!");
                break;

            default:
                res = new Result(99999, "Тодорхойгүй алдаа!");
                break;
            }
            return(res);
        }
示例#37
0
 public Message(ISender sender, EnumMessage type)
 {
     Sender = sender;
     Type   = type;
 }
 public Task Handle(EnumMessage message, IMessageHandlerContext context)
 {
     return(context.Reply(CustomEnum.Value2));
 }
 public void Handle(EnumMessage message)
 {
     Bus.Return(CustomEnum.Value2);
 }