Exemple #1
0
        protected async System.Threading.Tasks.Task Grid0RowCreate(dynamic args)
        {
            var localhostCreateCardResult = await Localhost.CreateCard(args);

            await grid0.Reload();

            await InvokeAsync(() => { StateHasChanged(); });
        }
        public async Task CreateSentencesFromLastUpload()
        {
            DocProcessing newDoc = new DocProcessing();

            try {
                newDoc.Process(UploadController.cGlobals.lastUploadDir);
            }
            catch (System.Exception ArgumentException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Please upload a file."
                });
            }
            IList <string> strings = (IList <string>)Segmenter.Segment(newDoc.getAllText());

            int listCount = (strings).Count;

            int count = 0;

            try
            {
                {
                    foreach (string iter in strings)
                    {
                        Globals.progressBarVal = (int)(count);

                        Card c = new Card();
                        c.Answer = iter;

                        {
                            c.briefId = (int)Globals.selectedBriefId;
                        }
                        ;

                        await Localhost.CreateCard(c);

                        count++;
                    }
                }
            }
            catch (System.Exception ArgumentException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Processing failed."
                });
            }
        }
Exemple #3
0
        protected async System.Threading.Tasks.Task Form0Submit(Flashcardgenerator.Models.Localhost.Card args)
        {
            try
            {
                var localhostCreateCardResult = await Localhost.CreateCard(card);

                DialogService.Close(card);
            }
            catch (System.Exception localhostCreateCardException)
            {
                NotificationService.Notify(new NotificationMessage()
                {
                    Severity = NotificationSeverity.Error, Summary = $"Error", Detail = $"Unable to create new Card!"
                });
            }
        }