Esempio n. 1
0
        public NotificationModule(INotificationApplicationService notificationService) : base("/nuclei/d23/notifications")
        {
            this.Get("/", async(parameters) => new TextResponse(JsonConvert.SerializeObject(
                                                                    await notificationService.GetNotificationLog(string.Empty)
                                                                    ))
                     );

            this.Get("/{logid}", async(parameters) => new TextResponse(JsonConvert.SerializeObject(
                                                                           await notificationService.GetNotificationLog(parameters.logid)
                                                                           ))
                     );
        }
Esempio n. 2
0
        internal async static Task <Neuron> CreateNeuron(Func <Task <string> > tagRetriever, object owner, IDialogService dialogService, INeuronQueryService neuronQueryService, INeuronApplicationService neuronApplicationService, INotificationApplicationService notificationApplicationService, IStatusService statusService, string avatarUrl, string regionId)
        {
            Neuron result = null;
            await Neurons.Helper.SetStatusOnComplete(async() =>
            {
                bool stat          = false;
                bool addingOwner   = false;
                var shouldAddOwner = (await notificationApplicationService.GetNotificationLog(avatarUrl, string.Empty)).NotificationList.Count == 0;
                if (shouldAddOwner && (await dialogService.ShowDialogYesNo("This Avatar needs to be initialized with an Owner Neuron. Do you wish to continue by creating one?", owner, out DialogResult yesno)).GetValueOrDefault())
                {
                    addingOwner = true;
                }

                if (!shouldAddOwner || addingOwner)
                {
                    string tag = await tagRetriever();
                    if (!string.IsNullOrEmpty(tag) &&
                        await Neurons.Helper.PromptSimilarExists(neuronQueryService, dialogService, avatarUrl, owner, tag)
                        )
                    {
                        Neuron n = new Neuron
                        {
                            Tag     = tag,
                            UIId    = Guid.NewGuid().GetHashCode(),
                            Id      = Guid.NewGuid().ToString(),
                            Version = 1,
                        };

                        await neuronApplicationService.CreateNeuron(
                            avatarUrl,
                            n.Id,
                            n.Tag,
                            regionId
                            );
                        result = n;
                        stat   = true;
                    }
                }
                return(stat);
            },
                                                     "Neuron created successfully.",
                                                     statusService,
                                                     "Neuron creation cancelled."
                                                     );

            return(result);
        }
Esempio n. 3
0
        public NotificationModule(INotificationApplicationService notificationService) : base("/eventsourcing/notifications")
        {
            this.Get("/", async(parameters) => this.ProcessLog(
                         await notificationService.GetCurrentNotificationLog(),
                         this.Request.Url.ToString()
                         )
                     );

            this.Get("/{logid}", async(parameters) => this.ProcessLog(
                         await notificationService.GetNotificationLog(parameters.logid),
                         this.Request.Url.ToString().Substring(
                             0,
                             this.Request.Url.ToString().Length - parameters.logid.ToString().Length - 1
                             )
                         )
                     );
        }