示例#1
0
        public string AnswerForTrackInProgressNCCO()
        {
            var talkAction = new TalkAction()
            {
                Text = "This is a text to speech call from Nexmo"
            };

            var payload = new Foo()
            {
                Bar = "Bar"
            };

            var nofityAction = new NotifyAction()
            {
                EventUrl = new[] { $"{SITE_BASE}/voice/Notify" },
                Payload  = payload
            };

            var talkAction2 = new TalkAction()
            {
                Text = "You'll never hear this talk action because the notification handler will return an NCCO"
            };

            var ncco = new Ncco(talkAction, nofityAction, talkAction2);

            return(ncco.ToString());
        }
示例#2
0
        public IActionResult Answer()
        {
            var host = Request.Host.ToString();
            //Uncomment the next line if using ngrok with --host-header option
            //host = Request.Headers["X-Original-Host"];

            var eventUrl = $"{Request.Scheme}://{host}/webhooks/notification";

            var talkAction = new TalkAction()
            {
                Text = "Thanks for calling the notification line"
            };
            var notifyAction = new NotifyAction()
            {
                EventUrl = new[] { eventUrl },
                Payload  = new FooBar()
                {
                    Foo = "bar"
                }
            };
            var talkAction2 = new TalkAction()
            {
                Text = "You will never hear me as the notification URL will return an NCCO"
            };
            var ncco = new Ncco(talkAction, notifyAction, talkAction2);

            return(Ok(ncco.ToString()));
        }
示例#3
0
        public new static void PrintNotifyAction(NotifyAction msg, object tag)
        {
            MessagePrinter.PrintNotifyAction(msg, tag);
            FrontendConnect fc = (FrontendConnect)tag;

            MongoDBConnect.connection.InsertNotifyAction(msg, fc.gameState.mmoChannel.ChannelID, fc.gameState.townID);
        }
示例#4
0
        private void ParseActions(XElement root, Dictionary <Event, List <Action> > events, Event ev, EventType evType)
        {
            foreach (var notify in root.Element("actions").Elements("notify"))
            {
                Balloon ballonData = null;
                var     balloon    = notify.Element("balloon");
                if (balloon != null)
                {
                    var titleText       = balloon.Attribute("title_text").Value;
                    var bodyText        = balloon.Attribute("body_text").Value;
                    var displayDuration = int.Parse(balloon.Attribute("display_time").Value);
                    ballonData = new Balloon(titleText, bodyText, displayDuration, evType);
                }

                SoundInterface soundInterface = null;
                var            music          = notify.Descendants("music");
                var            beeps          = notify.Descendants("beeps");
                var            textToSpeech   = notify.Descendants("text_to_speech");
                if (music.Any() && beeps.Any() || music.Any() && textToSpeech.Any() || textToSpeech.Any() && beeps.Any())
                {
                    throw new Exception("Only 1 type of sound allowed by notifyAction");
                }
                if (music.Any())
                {
                    var musicFile = music.First().Attribute("file").Value;
                    var volume    = float.Parse(music.First().Attribute("volume").Value, CultureInfo.InvariantCulture) / 100;
                    var duration  = int.Parse(music.First().Attribute("duration").Value);
                    soundInterface = new Music(musicFile, volume, duration);
                }
                if (beeps.Any())
                {
                    var beepsList = new List <Beep>();
                    foreach (var beep in beeps.First().Elements())
                    {
                        var frequency = int.Parse(beep.Attribute("frequency").Value);
                        var duration  = int.Parse(beep.Attribute("duration").Value);
                        beepsList.Add(new Beep(frequency, duration));
                    }
                    soundInterface = new Beeps(beepsList);
                }

                if (textToSpeech.Any())
                {
                    var tts         = textToSpeech.First();
                    var text        = tts.Attribute("text").Value;
                    var voiceGender = (VoiceGender)Enum.Parse(typeof(VoiceGender), tts.Attribute("voice_gender")?.Value ?? "Female", true);
                    var voiceAge    = (VoiceAge)Enum.Parse(typeof(VoiceAge), tts.Attribute("voice_age")?.Value ?? "Adult", true);

                    var culture       = tts.Attribute("culture")?.Value ?? LP.Culture.ToString();
                    var voicePosition = int.Parse(tts.Attribute("voice_position")?.Value ?? "0");
                    var volume        = int.Parse(tts.Attribute("volume")?.Value ?? "30");
                    var rate          = int.Parse(tts.Attribute("rate")?.Value ?? "0");
                    soundInterface = new TextToSpeech(text, voiceGender, voiceAge, voicePosition, culture, volume, rate);
                }

                var notifyAction = new NotifyAction(soundInterface, ballonData);
                events[ev].Add(notifyAction);
            }
        }
示例#5
0
文件: Board.cs 项目: mvysin/quizshow
 public void NotifyViews(NotifyAction a, int x, int y)
 {
     foreach (WeakReference v in views)
     {
         if (v.IsAlive)
             ((IBoardView)v.Target).Notify(a, x, y);
     }
 }
 public Location(NotifyAction a, long channel, int townID)
 {
     this.CID     = a.ID;
     this.X       = a.Action.Position.X;
     this.Y       = a.Action.Position.Y;
     this.Vx      = a.Action.Velocity.X;
     this.Vy      = a.Action.Velocity.Y;
     this.Yaw     = a.Action.Yaw;
     this.Time    = DateTime.Now;
     this.Channel = channel;
     this.TownID  = townID;
 }
示例#7
0
        public static string GetActionString(NotifyAction action)
        {
            switch (action)
            {
            case NotifyAction.Add:
            case NotifyAction.UpdateAdd:
            case NotifyAction.CommitAdded:
                return("added");

            case NotifyAction.Copy:
                return("copied");

            case NotifyAction.Delete:
            case NotifyAction.UpdateDelete:
            case NotifyAction.CommitDeleted:
                return("deleted");

            case NotifyAction.Restore:
                return("restored");

            case NotifyAction.Revert:
                return("reverted");

            case NotifyAction.FailedRevert:
                return("revert failed");

            case NotifyAction.Resolved:
                return("resolved");

            case NotifyAction.Skip:
                return("skipped");

            case NotifyAction.UpdateUpdate:
                return("updated");

            case NotifyAction.CommitPostfixTxDelta:
            case NotifyAction.UpdateCompleted:
                return("");

            case NotifyAction.UpdateExternal:
                return("updated external");

            case NotifyAction.CommitModified:
                return("modified");

            case NotifyAction.CommitReplaced:
                return("replaced");

            default:
                return("unknown");
            }
        }
示例#8
0
 public void Notify(NotifyAction a, int x, int y)
 {
     if (a == NotifyAction.DisplayClue)
     {
         lblAnswer.Text = QuizShow.Board.Category[x].Clue[y].Answer;
         lblAnswer.Visible = true;
     }
     else if (a == NotifyAction.DisplayBoard)
     {
         lblAnswer.Text = String.Empty;
         lblAnswer.Visible = false;
     }
 }
        public void TestNotify()
        {
            var expectedJson = @"[{""payload"":{""Bar"":""foo""},""eventUrl"":[""https://example.com/webhooks/events""],""eventMethod"":""POST"",""action"":""notify""}]";
            var notifyAction = new NotifyAction
            {
                EventMethod = "POST",
                Payload     = new Foo
                {
                    Bar = "foo"
                },
                EventUrl = new[] { "https://example.com/webhooks/events" }
            };
            var ncco = new Ncco(notifyAction);

            Assert.Equal(expectedJson, ncco.ToString());
        }
示例#10
0
        static void Main()
        {
            string[] vals = new string[] {
                "", //To person
                "", //To Address
                "", //From Address
                "", //SMTP Server
                "", //Username
                ""  //password
            };

            var notify = new NotifyAction(vals);

            //display the new 6 digit pin number as an encrypted string
            Console.WriteLine("New Pin number Has been Sent to email!");
        }
示例#11
0
        public void CreateProviders()
        {
            tenant   = new Tenants.Tenant(0, "teamlab");
            sourceId = "6045b68c-2c2e-42db-9e53-c272e814c4ad";
            actionId = "NewCommentForTask";
            objectId = "Task_5946_457";
            nAction  = new NotifyAction(actionId, actionId);
            testRec  = new DirectRecipient("ff0c4e13-1831-43c2-91ce-7b7beb56179b", null); //Oliver Khan
            testRec2 = new DirectRecipient("0017794f-aeb7-49a5-8817-9e870e02bd3f", null); //Якутова Юлия


            recProvider = new RecipientProviderImpl();
            var directSubProvider = new DirectSubscriptionProvider(sourceId, CoreContext.SubscriptionManager, recProvider);

            subProvider = new TopSubscriptionProvider(recProvider, directSubProvider);
            CoreContext.TenantManager.SetCurrentTenant(tenant);
        }
示例#12
0
        public void CreateProviders()
        {
            using var scope = serviceProvider.CreateScope();
            var scopeClass = scope.ServiceProvider.GetService <TopSubscriptionProviderTestScope>();

            var(tenantManager, subscriptionManager, recipientProviderImpl) = scopeClass;
            tenant   = new Tenants.Tenant(0, "teamlab");
            sourceId = "6045b68c-2c2e-42db-9e53-c272e814c4ad";
            actionId = "NewCommentForTask";
            objectId = "Task_5946_457";
            nAction  = new NotifyAction(actionId, actionId);
            testRec  = new DirectRecipient("ff0c4e13-1831-43c2-91ce-7b7beb56179b", null); //Oliver Khan
            testRec2 = new DirectRecipient("0017794f-aeb7-49a5-8817-9e870e02bd3f", null); //Якутова Юлия

            var directSubProvider = new DirectSubscriptionProvider(sourceId, subscriptionManager, recProvider);

            subProvider = new TopSubscriptionProvider(recProvider, directSubProvider);
        }
示例#13
0
 public NotificationMessage(NotifyAction action, T value)
 {
     Action = action;
     Value  = value;
 }
示例#14
0
 public static void NotifyAction(NotifyAction action, string endPoint, string notificationOption)
 {
     Assert.AreEqual(endPoint ?? "", action.Endpoint ?? "");
     Assert.AreEqual(notificationOption ?? "", action.NotificationOption ?? "");
 }
示例#15
0
 /// <summary>
 /// Notifies of status change with no data.
 /// </summary>
 /// <param name="action">The action for the notification.</param>
 protected void StatusNotify(NotifyAction action)
 {
     StatusNotify(action, null);
 }
示例#16
0
 /// <summary>
 /// Notifies of status change with data.
 /// </summary>
 /// <param name="action">The action for the notification.</param>
 /// <param name="data">The data for the action <see cref="ManagedUPnP.AutoDiscoveryServices{T}.NotifyAction" />.</param>
 protected virtual void StatusNotify(NotifyAction action, object data)
 {
 }
 public void InsertNotifyAction(NotifyAction a, long channel, int townID)
 {
     locCollection.InsertOneAsync(new Location(a, channel, townID));
 }
示例#18
0
        public void Notify(NotifyAction a, int x, int y)
        {
            if (a == NotifyAction.ButtonClicked)
            {
                if (!Editable)
                    btns[x, y+1].Active = false;
                if (y >= 0)
                    QuizShow.Board.NotifyViews(NotifyAction.DisplayClue, x, y);
            }
            else if (a == NotifyAction.DisplayClue)
            {
                SelectedClue = QuizShow.Board.Category[x].Clue[y];
                Mode = GameBoardViewMode.Clue;
            }
            else if (a == NotifyAction.DisplayAnswer)
            {
                Mode = GameBoardViewMode.Answer;
            }
            else if (a == NotifyAction.DisplayBoard)
            {
                Mode = GameBoardViewMode.Board;

                // this comes from displaying the answer
                SetSelected(-1, -1);

                if (HasTrackedButton && Focused)
                    TrackedButton.Tracking = true;
            }
        }
 /// <summary>
 /// Creates a nwe status notify action event args.
 /// </summary>
 /// <param name="notifyAction">The action being notified.</param>
 /// <param name="data">The data for the action.</param>
 public StatusNotifyActionEventArgs(NotifyAction notifyAction, object data)
 {
     mnaAction = notifyAction;
     moData    = data;
 }
        void svn_wc_notify_func_t_impl(IntPtr baton, IntPtr path,
			NotifyAction action, NodeKind kind, IntPtr mime_type,
			NotifyState content_state, NotifyState prop_state, long revision)
        {
            string actiondesc = action.ToString();
                switch (action) {
                    case NotifyAction.UpdateAdd: actiondesc = "Added"; break;
                    case NotifyAction.UpdateDelete: actiondesc = "Deleted"; break;
                    case NotifyAction.UpdateUpdate: actiondesc = "Updating"; break;
                    case NotifyAction.UpdateExternal: actiondesc = "External Updated"; break;
                    case NotifyAction.UpdateCompleted: actiondesc = "Finished"; break;

                    case NotifyAction.CommitAdded: actiondesc = "Added"; break;
                    case NotifyAction.CommitDeleted: actiondesc = "Deleted"; break;
                    case NotifyAction.CommitModified: actiondesc = "Modified"; break;
                    case NotifyAction.CommitReplaced: actiondesc = "Replaced"; break;
                    case NotifyAction.CommitPostfixTxDelta: actiondesc = "Sending Content"; break;
            /*Add,
            Copy,
            Delete,
            Restore,
            Revert,
            FailedRevert,
            Resolved,
            Skip,
            StatusCompleted,
            StatusExternal,
            BlameRevision*/
                }

                if (updatecallback != null)
                    updatecallback(Marshal.PtrToStringAnsi(path), actiondesc);
        }
示例#21
0
        public void Notify(NotifyAction a, int x, int y)
        {
            Board board = QuizShow.Board;

            if (a == NotifyAction.ButtonClicked)
            {
                view.SetSelected(x, y);

                // check if it's the category:
                if (y < 0)
                {
                    EditMode = EditMode.Category;
                    SelectedCategory = board.Category[x];
                    lblWhat.Text = "Category " + (x + 1).ToString();
                    tbAnswer.Focus();
                }
                else
                {
                    EditMode = EditMode.Clue;
                    SelectedClue = board.Category[x].Clue[y];
                    lblWhat.Text = "\"" + board.Category[x].Name + "\" -> $"
                        + board.PointValues[y] + " Clue";
                    tbClue.Focus();
                    tbClue.SelectionStart = tbClue.Text.Length;
                    tbClue.SelectionLength = 0;
                }
            }
            else if (a == NotifyAction.DisplayBoard)
            {
                lblWhat.Text = "Nothing Selected - Click a category or clue to edit";
                EditMode = EditMode.None;
            }
            else if (a == NotifyAction.TrackButtonChanged)
            {
                if (SelectedCategory == null && SelectedClue == null)
                {
                    if (x >= 0)
                    {
                        if (y >= 0)
                        {
                            tbClue.Text = board.Category[x].Clue[y].Question;
                            tbAnswer.Text = board.Category[x].Clue[y].Answer;
                        }
                        else
                        {
                            tbClue.Text = String.Empty;
                            tbAnswer.Text = board.Category[x].Name;
                        }
                    }
                    else
                        tbClue.Text = tbAnswer.Text = String.Empty;
                }
            }
        }