Исправлен баг с не правильной генерацией параметров для событий
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants></DefineConstants>
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Example.Backend
|
||||
{
|
||||
public string Name;
|
||||
|
||||
public void OnPrintExternal(IPage p0, RequestContext p1)
|
||||
public void OnPrintExternal(IPage p0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ namespace Example.Backend
|
||||
// throw new Exception("The method or operation is not implemented.");
|
||||
var page = new Page { Text = text };
|
||||
Console.WriteLine($"Request id : :{context.RequestId}");
|
||||
OnPrint?.Invoke(page, context);
|
||||
OnPrint?.Invoke(page);
|
||||
Resource /= 1.5;
|
||||
return page;
|
||||
}
|
||||
|
||||
public event Action<IPage, RequestContext>? OnPrint;
|
||||
public event Action<IPage>? OnPrint;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Example.Frontend
|
||||
{
|
||||
public class ClientBasedPrinter : IPrinter
|
||||
{
|
||||
public void OnPrintExternal(IPage p0, RequestContext p1)
|
||||
public void OnPrintExternal(IPage p0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Example.Frontend
|
||||
return new ClientBasedPage();
|
||||
}
|
||||
|
||||
public event Action<IPage, RequestContext>? OnPrint;
|
||||
public event Action<IPage>? OnPrint;
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DefineConstants />
|
||||
<DefineConstants>TRACE;</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
|
||||
@@ -48,6 +48,7 @@ class Program
|
||||
//правильный порядок команд 8-5-10-7
|
||||
using (var disposingPrinter = factory.Create("Test"))
|
||||
{
|
||||
disposingPrinter.OnPrint += page1 => { Console.WriteLine("New page creater. Called from event!!!"); };
|
||||
Console.WriteLine("Printer created");
|
||||
Thread.Sleep(100);
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ namespace Example.Shared
|
||||
double Resource { get; set; }
|
||||
string GetName();
|
||||
Task<IPage> Print(string text, bool someParameter, RequestContext context, CancellationToken cancellationToken);
|
||||
event Action<IPage, RequestContext> OnPrint;
|
||||
event Action<IPage> OnPrint;
|
||||
}
|
||||
}
|
||||
@@ -463,7 +463,8 @@ namespace {classSymbol.ContainingNamespace.ToDisplayString()}
|
||||
JoinWithComa(Enumerable.Range(0, parameters.Count).Select(i => "p" + i++)));
|
||||
|
||||
var transferParameters =
|
||||
JoinWithComa(parameters.Where(i => ParameterFilterForType(i)).Select(i => "p" + parameters.IndexOf(i)));
|
||||
JoinWithComa(parameters.Where(i => !ParameterFilterForType(i))
|
||||
.Select(i => "p" + parameters.IndexOf(i)));
|
||||
|
||||
var callFilter = "";
|
||||
|
||||
@@ -475,7 +476,9 @@ namespace {classSymbol.ContainingNamespace.ToDisplayString()}
|
||||
|
||||
var eventBinderCode =
|
||||
$@" (instance as {baseType.ToDisplayString()}).{eventSymbol.Name} += ({parametersDeclaration}) =>
|
||||
{{ {callFilter}
|
||||
{{
|
||||
Console.WriteLine(""Sending event..."");
|
||||
{callFilter}
|
||||
var request = new DefaultCallRequest
|
||||
{{
|
||||
CommandId = {index}, ObjectId = index, Parameters = new object[] {{ {transferParameters} }}
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace mROA.Implementation
|
||||
{
|
||||
public class RepresentationModule : IRepresentationModule
|
||||
{
|
||||
private ISerializationToolkit? _serialization;
|
||||
private INextGenerationInteractionModule? _interaction;
|
||||
private ISerializationToolkit? _serialization;
|
||||
|
||||
public void Inject<T>(T dependency)
|
||||
{
|
||||
@@ -70,6 +70,11 @@ namespace mROA.Implementation
|
||||
}
|
||||
}
|
||||
|
||||
if (fromBuffer == null)
|
||||
{
|
||||
return Array.Empty<byte>();
|
||||
}
|
||||
|
||||
_interaction.HandleMessage(fromBuffer);
|
||||
return fromBuffer.Data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user