public async Task HandleValidSubmitAsync()
        {
            await FileUploadService.UploadAsync(file, Model.FileGuid);

            var plugin = PluginTester.LoadPlugin(Model.FileGuid);

            if (plugin == null)
            {
                Toaster.Error("Vložený soubor není platná knihovna.");
                return;
            }

            try
            {
                PluginTester.TestImplementation(plugin);
            }
            catch (Exception e)
            {
                Toaster.Error(e.Message, "Chyba implementace");
                return;
            }

            await PlayerService.InsertNewPlayerAsync(new PlayerVM
            {
                Name     = Model.Name,
                Password = Model.Password,
                FileGuid = Model.FileGuid,
                League   = (League)Convert.ToInt32(Model.League)
            });

            Toaster.Info("Nový hráč vložen.");
            NavigationManager.NavigateTo("/players");
        }
Beispiel #2
0
        protected async Task DeletePlayerAsync()
        {
            if (string.IsNullOrEmpty(DeletePassword))
            {
                Toaster.Error("Zadejte prosím heslo pro smazání.");
                return;
            }

            modalRef.Hide();

            if (DeletePlayerId == null)
            {
                return;
            }

            try
            {
                await PlayerService.DeleteAsync(DeletePlayerId.Value, DeletePassword);
            }
            catch (Exception e)
            {
                Toaster.Error(e.Message);
                return;
            }


            DeletePlayerId = null;

            Toaster.Info("Hráč byl smazán.");

            await OnParametersSetAsync();
        }
        protected async Task Send()
        {
            if (AppSettings.DemoMode)
            {
                Toaster.Info(Localizer["demo-disabled"]);
            }
            else
            {
                bool result = await EmailService.SendEmail(Model.SendTo, Model.Subject, Model.Content);

                if (result)
                {
                    Toaster.Success(Localizer["email-sent-success"]);
                }
                else
                {
                    Toaster.Error(Localizer["email-sent-error"]);
                }
            }
        }
        protected async Task Send()
        {
            if (FeatureManager.IsEnabledAsync(nameof(AppFeatureFlags.Demo)).Result)
            {
                Toaster.Info(Localizer["demo-disabled"]);
            }
            else
            {
                bool result = await EmailService.SendEmail(Model.SendTo, Model.Subject, Model.Content);

                if (result)
                {
                    Toaster.Success(Localizer["email-sent-success"]);
                }
                else
                {
                    Toaster.Error(Localizer["email-sent-error"]);
                }
            }
        }
Beispiel #5
0
        public void ShowInfo(string title, string body, InfoType type)
        {
            switch (type)
            {
            case InfoType.Success:
                Toaster.Success(body);
                break;

            case InfoType.Info:
                Toaster.Info(body);
                break;

            case InfoType.Warn:
                Toaster.Warning(body);
                break;

            case InfoType.Error:
                Toaster.Error(body);
                break;
            }
        }
        public async Task HandleValidSubmitAsync()
        {
            await FileUploadService.UploadAsync(file, Model.FileGuid);

            bool isValid = IsAssemblyValid();

            if (!isValid)
            {
                return;
            }

            await PlayerService.InsertNewPlayerAsync(new PlayerVM
            {
                Name     = Model.Name,
                Password = Model.Password,
                FileGuid = Model.FileGuid,
                League   = (League)Convert.ToInt32(Model.League)
            });

            Toaster.Info("Nový hráč vložen.");
            NavigationManager.NavigateTo("/players");
        }
        public async Task HandleValidSubmitAsync()
        {
            IsDisabledButton = true;
            StateHasChanged();

            var league = (League)Convert.ToInt32(Model.League);

            TournamentService.NewGamePlayed += NewGamePlayedEvent;
            try
            {
                var games = await TournamentService.NewTournamentAsync(league);

                await TournamentService.InsertNewTournamentAsync(league, games);
            }
            catch (Exception e)
            {
                Toaster.Error(e.Message);
                NavigationManager.NavigateTo("/tournaments");
                return;
            }

            Toaster.Info("Turnaj byl odehrán.");
            NavigationManager.NavigateTo("/tournaments");
        }
Beispiel #8
0
 public static void ShowMessage(Logger log, string msg)
 {
     log.Info(msg);
     Toaster.Info("Message", msg);
     CurrentException = null;
 }
Beispiel #9
0
        public async void BillFormCore_OnSave()
        {
            await BillService.SaveAsync(Bill);

            Toaster.Info("Bill updated sucessfully!");
        }