Диспоз работает
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Example.Shared;
|
using Example.Shared;
|
||||||
@@ -22,7 +24,7 @@ namespace Example.Backend
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Dispose printer with name {0}", Name);
|
Console.WriteLine("Dispose printer with name {0}, Dispose works, Dispose works, Dispose works, Dispose works,", Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,6 +75,8 @@ class Program
|
|||||||
Console.WriteLine("Page printed");
|
Console.WriteLine("Page printed");
|
||||||
var data = page.Value.GetData();
|
var data = page.Value.GetData();
|
||||||
Console.WriteLine("Data : {0}", Encoding.UTF8.GetString(data));
|
Console.WriteLine("Data : {0}", Encoding.UTF8.GetString(data));
|
||||||
|
|
||||||
|
Console.WriteLine("Dispose printer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,14 +63,24 @@ namespace mROA.Implementation.Backend
|
|||||||
return ExecuteAsync(currentCommand, context, parameter, command, _cancellationRepo,
|
return ExecuteAsync(currentCommand, context, parameter, command, _cancellationRepo,
|
||||||
representationModule);
|
representationModule);
|
||||||
|
|
||||||
var result = Execute(currentCommand, context, parameter, command);
|
try
|
||||||
|
|
||||||
if (command.CommandId == -1)
|
|
||||||
{
|
{
|
||||||
contextRepository.ClearObject(command.ObjectId);
|
var result = Execute(currentCommand, context, parameter, command);
|
||||||
}
|
if (command.CommandId == -1)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Disposing object");
|
||||||
|
contextRepository.ClearObject(command.ObjectId);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICommandExecution Execute(MethodInfo currentCommand, object context, object? parameter,
|
private static ICommandExecution Execute(MethodInfo currentCommand, object context, object? parameter,
|
||||||
|
|||||||
@@ -24,6 +24,10 @@ namespace mROA.Implementation
|
|||||||
public Type? ParameterType { get; set; }
|
public Type? ParameterType { get; set; }
|
||||||
|
|
||||||
public object? Parameter { get; set; }
|
public object? Parameter { get; set; }
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Call request {{ Id : {Id}, CommandId : {CommandId}, ObjectId : {ObjectId} }}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CancelRequest : ICallRequest
|
public class CancelRequest : ICallRequest
|
||||||
@@ -32,5 +36,9 @@ namespace mROA.Implementation
|
|||||||
public int CommandId { get; set; } = -2;
|
public int CommandId { get; set; } = -2;
|
||||||
public int ObjectId { get; set; } = -2;
|
public int ObjectId { get; set; } = -2;
|
||||||
public object? Parameter { get; set; } = null;
|
public object? Parameter { get; set; } = null;
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Cancel request {{ Id : {Id}, CommandId : {CommandId}, ObjectId : {ObjectId} }}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user