public MessageBoxResult Show(string message) { return((MessageBoxResult)(dispatcher?.Dispatch(new Func <MessageBoxResult>(() => { return new MsgBoxVM().Show(message); })))); }
private async Task HandleRefresh(IDispatcher dispatcher) { await dispatcher.Dispatch <FetchIdentities>(); }
protected override async Task HandleAsync(FetchDataAction action, IDispatcher dispatcher) { var forecasts = await _http.GetFromJsonAsync <WeatherForecast[]>("sample-data/weather.json"); dispatcher.Dispatch(new FetchDataResultAction(forecasts)); }
protected override async Task HandleAsync(GetFriendsAction action, IDispatcher dispatcher) { var friends = await _httpClient.GetFromJsonAsync <List <ClientFriendship> >($"{_navigationManager.BaseUri}api/Friendships/{action.UserId}"); dispatcher.Dispatch(new GetFriendsSuccessAction(friends)); }
public async Task HandleFetchDataAction(GetManagerApprovalsAction action, IDispatcher dispatcher) { var accessRequests = (await _mediator.Send(new GetManagerAccessRequestsQuery())).ToArray(); dispatcher.Dispatch(new GetManagerApprovalsResultAction(accessRequests)); }
public static TResult Execute <TResult>(this IDispatcher dispatcher, IResultCommand <TResult> command) { return((TResult)dispatcher.Dispatch(command)); }
public void PopulateDatabase(PopulateDatabaseCommand command) { _dispatcher.Dispatch(command); }
private void Dispatch(Dispatchable <TEntry, TState> dispatchable) => _dispatcher.Dispatch(dispatchable);
public override Task HandleAsync(SetCoursesSearchTypeAction action, IDispatcher dispatcher) { dispatcher.Dispatch(new FetchCoursesItemsAction(_state.Value.SearchString, action.SearchType)); return(Task.CompletedTask); }
public async Task LoadGreenBeans(IDispatcher dispatcher) { var greenbeans = await _httpClient.GetFromJsonAsync <CoffeeRoastManagement.Shared.Entities.GreenBeanInfo[]>("api/greenbeaninfo"); dispatcher.Dispatch(new GreenBeansSetAction(greenbeans)); }
public Task GameJoined(GameStatus gameStatus, IEnumerable <Player> existingPlayersInGame, IEnumerable <AnswerCard> cardsInHand, IEnumerable <IReadOnlyList <AnswerCard> > cardsOnTable, int?currentRoundNumber, QuestionCard?currentQuestion, Player?currentCardCzar) { dispatcher.Dispatch(new GameJoinedEvent(gameStatus, existingPlayersInGame, cardsInHand, cardsOnTable, currentRoundNumber, currentQuestion, currentCardCzar)); return(Task.CompletedTask); }
private void IotServer_NewRequestReceived(IotSession session, IotRequest req) { logger.Debug($"IoT-Rece: {session.RemoteEndPoint} {req.Device.Mac}-{req.SessionId} {req.Command}"); IotRequest request = null; //var hasErrorRequest = false; //var hasErrorResponse = false; if (!req.CheckCrc16()) { if (!req.Command.IsResponse) { request = req.ErrorCrc(); } else { //hasErrorRequest = true; } } else { switch (req.Command.Name) { case "00F1": { if (!req.CheckSession()) { request = CreateErrorSession(req); break; } if (!req.CheckValid()) { request = req.ErrorDevice(); break; } request = req.Ok(interval.ToHex(2)); request.SessionId = RandomHelper.GetRandomHex(4); session.SessionId = request.SessionId; session.Device = req.Device; sessions[req.Device.Mac] = session; Task.Run(() => DoLogin(req)); break; } case "0001": { if (!req.CheckSession(sessions, session)) { request = CreateErrorSession(req); break; } Task.Run(() => DoUpload(req)); request = req.Ok(GetWeaHex(req.Device.Mac)); break; } case "0002": { if (!req.CheckSession(sessions, session)) { request = CreateErrorSession(req); break; } Task.Run(() => DoOnline(req)); request = req.Ok(DatetimeHelper.GetNowHex()); break; } default: { if (req.Command.IsResponse) { if (!req.CheckSession(sessions, session)) { //hasErrorResponse = true; } else { api.Dispatch(Name, req.Device.Mac, $"BACK-{req.Command.Name}", $"{req.Command.DataHex}"); } } else if (!req.CheckSession(sessions, session)) { request = CreateErrorSession(req); } else { Task.Run(() => DoUpData(req)); request = req.Ok(); } break; } } } if (request != null) { Send(session, request); } }
public void Enroll(EnrollmentRendering r) { _dispatcher.Dispatch(r.ToCommand()); }
private async Task HandleDelete(IDispatcher dispatcher, IdentityViewModel identity) { await dispatcher.Dispatch <DeleteIdentity, IdentityViewModel>(identity); }
public static Task Execute(this IDispatcher dispatcher, ICommand command) { return((dispatcher.Dispatch(command) as Task) ?? Task.FromResult(true)); }
public override async Task HandleAsync(FetchCoursesItemsAction action, IDispatcher dispatcher) { var courses = await _courseService.GetAllCourses(action.SearchString, action.SearchType); dispatcher.Dispatch(new FetchCoursesItemsResultAction(courses)); }
public static Task Send(this IDispatcher dispatcher, IEvent @event) { return((dispatcher.Dispatch(@event) as Task) ?? Task.FromResult(true)); }
protected override async Task HandleAsync(GetUserAction action, IDispatcher dispatcher) { var user = await _httpClient.GetFromJsonAsync <User>("sample-data/user.json"); dispatcher.Dispatch(new SaveUserAction(user)); }
public async Task HandleGetArticlesAction(GetArticlesAction action, IDispatcher dispatcher) { var articles = await _client.GetFromJsonAsync <ICollection <ArticleDto> >("/articles"); dispatcher.Dispatch(new GetArticlesResultAction(articles)); }
/// <summary> /// セッション開始イベント /// </summary> /// <param name="circuit"></param> /// <param name="cancellationToken"></param> public override Task OnCircuitOpenedAsync(Circuit circuit, CancellationToken cancellationToken) { dispatcher.Dispatch(new ConnectAction(circuit.Id)); return(base.OnCircuitOpenedAsync(circuit, cancellationToken)); }
public async Task HandleFetchDataAction(FetchDataAction action, IDispatcher dispatcher) { var forecasts = await Http.GetJsonAsync <WeatherForecast[]>("WeatherForecast"); dispatcher.Dispatch(new FetchDataResultAction(forecasts)); }
protected override async Task HandleAsync(UpdateGameStateAction action, IDispatcher dispatcher) { var currentPlayerId = await this.localStorage.GetItemAsync <int>(action.Game.Url); dispatcher.Dispatch(new UpdateCurrentPlayersStateAction(action.Game, currentPlayerId)); }
protected override async Task HandleAsync(FetchStencilSetsAction action, IDispatcher dispatcher) { var stencilSets = await http.GetFromJsonAsync <StencilSets>("sample-data/stencilset_bpmn.json"); dispatcher.Dispatch(new FetchStencilSetsResultAction(stencilSets)); }
public async Task HandleDeleteAction(LinksDeleteAction action, IDispatcher dispatcher) { var returnCode = HttpStatusCode.OK; _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", action.Token); var returnObject = new DeletedObjectResponse { Deleted = false, Detail = "Null response" }; try { _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Token", action.Token); var response = await _httpClient.DeleteAsync( $"{Const.Links}{action.LinkId}/"); returnObject = await response.Content.ReadFromJsonAsync <DeletedObjectResponse>(); returnCode = response.StatusCode; if (response.StatusCode == HttpStatusCode.Accepted || response.StatusCode == HttpStatusCode.NoContent || response.StatusCode == HttpStatusCode.OK) { if (returnObject is not null) { returnObject.Deleted = true; } dispatcher.Dispatch(new NotificationAction($"Link: {action.LinkId} - deleted", SnackbarColor.Info)); } else { if (returnObject is not null) { returnObject.Deleted = false; dispatcher.Dispatch(new NotificationAction($"Error: {response.StatusCode}", SnackbarColor.Danger)); } } } catch (Exception e) { if (returnObject is not null) { returnObject.Detail = $"Error {e}"; } dispatcher.Dispatch(new NotificationAction($"Error: {e.Message}", SnackbarColor.Danger)); returnCode = HttpStatusCode.BadRequest; } var userResult = new RootObject <OriinLink>(); _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(scheme: "Token", action.Token); try { userResult = await _httpClient.GetFromJsonAsync <RootObject <OriinLink> >( requestUri : Const.Links, Const.HttpClientOptions); } catch (Exception e) { dispatcher.Dispatch(new NotificationAction($"Error: {e.Message}", SnackbarColor.Danger)); returnCode = HttpStatusCode.BadRequest; } dispatcher.Dispatch( new LinksDeleteResultAction( delteResponse: returnObject ?? new DeletedObjectResponse(), rootObject: userResult ?? new RootObject <OriinLink>(), httpStatusCode: returnCode)); if (returnCode != HttpStatusCode.BadRequest) { dispatcher.Dispatch( new NotificationAction(action.DeleteLinkMessage, SnackbarColor.Success)); } }
public async Task Execute(IDispatcher dispatcher) { var data = await _client.AllCountries(); dispatcher.Dispatch(new UpdateCountriesData(data)); }
public async Task HandleFetchCuratorListAction(FetchCuratorListAction action, IDispatcher dispatcher) { var curators = await _admin.GetAllCurators(); dispatcher.Dispatch(new FetchCuratorListResultAction(curators)); }
void Update() { dispatch?.Dispatch(Singleton <NextFrame> .Instance); }
private void FireReload(string url = null) { _Dispatcher.Dispatch(() => OnClientReload?.Invoke(this, new ClientReloadArgs(url))); }
protected override void OnRectTransformDimensionsChange() { dispatcher?.Dispatch(Unit.Default); }
public void Create(Thootle thootle) => _dispatcher.Dispatch(new CreateDataAction(thootle));