Пример #1
0
        private void Notification_2_Click(object sender, RoutedEventArgs e)
        {
            Notification not2 = new Notification();

            not2.IssuedAt    = DateTime.Now;
            not2.Id          = "wpf_notification_456";
            not2.Source      = "WPF NotifyComponent";
            not2.Title       = "test notification 2";
            not2.HeaderText  = "WPF Notification Same Id";
            not2.Details     = "Should only be in UI once (WPF)";
            not2.Type        = "chat";
            not2.HeaderLogo  = "http://localhost:3375/components/finsemble-notifications/components/shared/assets/chat.svg";
            not2.ContentLogo = "http://localhost:3375/components/finsemble-notifications/components/shared/assets/sheild.png";

            NAction query = new NAction();

            query.ButtonText = "Send Query";
            query.Type       = ActionTypes.QUERY;
            query.Channel    = "query-channel";
            query.Payload    = new JObject();
            query.Payload.Add("hello", new JValue("world"));


            NAction transmit = new NAction();

            transmit.ButtonText = "Send Transmit";
            transmit.Type       = ActionTypes.TRANSMIT;
            transmit.Channel    = "transmit-channel";
            transmit.Payload    = new JObject {
            };
            transmit.Payload.Add("foo", new JValue("bar"));

            NAction publish = new NAction();

            publish.ButtonText = "Send Publish";
            publish.Type       = ActionTypes.PUBLISH;
            publish.Channel    = "publish-channel";
            publish.Payload    = new JObject {
            };
            publish.Payload.Add("xyzzy", new JValue("moo"));

            not2.Actions.Add(query);
            not2.Actions.Add(transmit);
            not2.Actions.Add(publish);

            FSBL.NotificationClient.Notify((new[] { not2 }), (s, r) => {
                FSBL.Logger.Log(new JToken[] {
                    "Notification sent,\nnotification: " + not2.ToString()
                    + "\nresponse: " + (r.response != null ? r.response.ToString() : "null")
                    + "\nerror: " + (r.error != null ? r.error.ToString() : "null")
                });

                //check response for notification id
            });
        }
Пример #2
0
        private void Notification_1_Click(object sender, RoutedEventArgs e)
        {
            Notification not1 = new Notification();

            not1.IssuedAt    = DateTime.Now;
            not1.Source      = "WPF NotifyComponent";
            not1.HeaderText  = "WPF Internal Actions (No Id)";
            not1.Title       = "test notification 1";
            not1.Details     = "Should create a new notification in UI every time it's sent (from WPF)";
            not1.Type        = "email";
            not1.HeaderLogo  = "http://localhost:3375/components/finsemble-notifications/components/shared/assets/email.svg";
            not1.ContentLogo = "http://localhost:3375/components/finsemble-notifications/components/shared/assets/graph.png";

            NAction dismiss = new NAction();

            dismiss.ButtonText = "Dismiss";
            dismiss.Type       = ActionTypes.DISMISS;

            NAction snooze = new NAction();

            snooze.ButtonText   = "Snooze";
            snooze.Type         = ActionTypes.SNOOZE;
            snooze.Milliseconds = 10000;

            NAction welcome = new NAction();

            welcome.ButtonText = "Welcome";
            welcome.Type       = ActionTypes.SPAWN;
            welcome.Component  = "Welcome Component";

            not1.Actions.Add(snooze);
            not1.Actions.Add(welcome);
            not1.Actions.Add(dismiss);

            FSBL.NotificationClient.Notify((new[] { not1 }), (s, r) => {
                FSBL.Logger.Log(new JToken[] {
                    "Notification sent,\nnotification: " + not1.ToString()
                    + "\nresponse: " + (r.response != null ? r.response.ToString() : "null")
                    + "\nerror: " + (r.error != null ? r.error.ToString() : "null")
                });

                //check response for notification id
            });
        }