Skip to content

Commit

Permalink
Remove V1 API
Browse files Browse the repository at this point in the history
  • Loading branch information
helto4real committed Feb 6, 2021
1 parent 7726060 commit 6f4c19f
Show file tree
Hide file tree
Showing 62 changed files with 425 additions and 5,726 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace NetDaemon.Common.Fluent
namespace NetDaemon.Common
{
/// <summary>
/// Context
Expand Down
146 changes: 73 additions & 73 deletions src/App/NetDaemon.App/Common/DelayResult.cs
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
using System;
using System.Collections.Concurrent;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
// using System;
// using System.Collections.Concurrent;
// using System.Runtime.CompilerServices;
// using System.Threading.Tasks;

[assembly: InternalsVisibleTo("NetDaemon.Daemon.Tests")]
// [assembly: InternalsVisibleTo("NetDaemon.Daemon.Tests")]

namespace NetDaemon.Common
{
/// <summary>
/// A class that implements the management of delays and cancel them
/// </summary>
public class DelayResult : IDelayResult
{
private readonly INetDaemonApp _daemonApp;
private readonly TaskCompletionSource<bool> _delayTaskCompletionSource;
private bool _isCanceled;
// namespace NetDaemon.Common
// {
// /// <summary>
// /// A class that implements the management of delays and cancel them
// /// </summary>
// public class DelayResult : IDelayResult
// {
// private readonly INetDaemonApp _daemonApp;
// private readonly TaskCompletionSource<bool> _delayTaskCompletionSource;
// private bool _isCanceled;

/// <summary>
/// Constructor
/// </summary>
/// <param name="delayTaskCompletionSource"></param>
/// <param name="daemonApp"></param>
public DelayResult(TaskCompletionSource<bool> delayTaskCompletionSource, INetDaemonApp daemonApp)
{
_delayTaskCompletionSource = delayTaskCompletionSource;
_daemonApp = daemonApp;
}
// /// <summary>
// /// Constructor
// /// </summary>
// /// <param name="delayTaskCompletionSource"></param>
// /// <param name="daemonApp"></param>
// public DelayResult(TaskCompletionSource<bool> delayTaskCompletionSource, INetDaemonApp daemonApp)
// {
// _delayTaskCompletionSource = delayTaskCompletionSource;
// _daemonApp = daemonApp;
// }

/// <inheritdoc/>
public Task<bool> Task => _delayTaskCompletionSource.Task;
// /// <inheritdoc/>
// public Task<bool> Task => _delayTaskCompletionSource.Task;

internal ConcurrentBag<string> StateSubscriptions { get; set; } = new();
// internal ConcurrentBag<string> StateSubscriptions { get; set; } = new();

/// <inheritdoc/>
public void Cancel()
{
if (_isCanceled)
return;
// /// <inheritdoc/>
// public void Cancel()
// {
// if (_isCanceled)
// return;

_isCanceled = true;
foreach (var stateSubscription in StateSubscriptions)
{
//Todo: Handle
_daemonApp.CancelListenState(stateSubscription);
}
StateSubscriptions.Clear();
// _isCanceled = true;
// foreach (var stateSubscription in StateSubscriptions)
// {
// //Todo: Handle
// _daemonApp.CancelListenState(stateSubscription);
// }
// StateSubscriptions.Clear();

// Also cancel all await if this is disposed
_delayTaskCompletionSource.TrySetResult(false);
}
// // Also cancel all await if this is disposed
// _delayTaskCompletionSource.TrySetResult(false);
// }

#region IDisposable Support
// #region IDisposable Support

private bool disposedValue; // To detect redundant calls
// private bool disposedValue; // To detect redundant calls

/// <summary>
/// Disposes the object and cancel delay
/// </summary>
public void Dispose()
{
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
Dispose(true);
// Suppress finalization.
GC.SuppressFinalize(this);
}
// /// <summary>
// /// Disposes the object and cancel delay
// /// </summary>
// public void Dispose()
// {
// // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
// Dispose(true);
// // Suppress finalization.
// GC.SuppressFinalize(this);
// }

/// <summary>
/// Disposes the object and cancel delay
/// </summary>
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
// Make sure any subscriptions are canceled
Cancel();
}
disposedValue = true;
}
}
// /// <summary>
// /// Disposes the object and cancel delay
// /// </summary>
// protected virtual void Dispose(bool disposing)
// {
// if (!disposedValue)
// {
// if (disposing)
// {
// // Make sure any subscriptions are canceled
// Cancel();
// }
// disposedValue = true;
// }
// }

#endregion IDisposable Support
}
}
// #endregion IDisposable Support
// }
// }
1 change: 0 additions & 1 deletion src/App/NetDaemon.App/Common/ExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Dynamic;
using System.Globalization;
using System.Text;
using NetDaemon.Common.Fluent;
using System.Diagnostics.CodeAnalysis;
namespace NetDaemon.Common
{
Expand Down
77 changes: 0 additions & 77 deletions src/App/NetDaemon.App/Common/Fluent/EntityBase.cs

This file was deleted.

Loading

0 comments on commit 6f4c19f

Please sign in to comment.