Ejemplo n.º 1
0
    public void GetCommonItems(WebRequestData args, Action <CommandResult> Callback)
    {
        if (args is GetCommonItemsRequestData localArgs)
        {
            CommandArgs commandArgs = new GetCommonItemsCommandArgs
            {
                Callback       = Callback,
                CatalogVersion = localArgs.CatalogVersion,
                DataStore      = localArgs.DataStore
            };

            GetCommonItemsCommand command = CommandFactory
                                            .Instance
                                            .CreateCommand <GetCommonItemsCommand>(commandArgs);
            command.Execute();
        }
        else
        {
            // Make more verbose exceptions
            throw new ArgumentException("Incorrect args data type;");
        }
    }
Ejemplo n.º 2
0
    private void OnGotCatalog(GetCatalogItemsResult result)
    {
        GetCommonItemsCommandArgs localArgs = _args as GetCommonItemsCommandArgs;

        foreach (CatalogItem catalogItem in result.Catalog)
        {
            localArgs
            .DataStore
            .SetItem(catalogItem.ItemId, new CommonItem
            {
                ID          = catalogItem.ItemId,
                Title       = catalogItem.DisplayName,
                Description = catalogItem.Description,
                ImageUrl    = catalogItem.ItemImageUrl
            });
        }
        GetCommonItemsCommandResult getCatalogItemsResult = new GetCommonItemsCommandResult
        {
            // empty
        };

        Callback?.Invoke(getCatalogItemsResult);
    }