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