Files
UVtools/UVtools.Core/Managers/OperationSessionManager.cs
T
Tiago Conceição 3cd46728f1 v2.11.1
- **Shortcuts:**
   - (Add) (Ctrl + Shift + R) to turn on and cycle the Rotate modes
   - (Add) (Ctrl + Shift + F) to turn on and cycle the Flip modes
   - (Add) (Ctrl + Shift + B) to select the build volume as ROI
- **GUI:**
   - (Add) Allow to drag and drop '.uvtop' files into UVtools to sequential show and load operations from files
   - (Change) Rotate icon on layer preview
   - (Upgrade) AvaloniaUI from 0.10.3 to 0.10.4
- **Tools:**
   - (Add) 'Reset to defaults' button on every dialog
   - (Improvement) Window size and position handling
   - (Improvement) Constrain profile box width to not stretch the window
   - (Improvement) ROI section design
- **Dynamic lift:**
   - (Add) View buttons to show the largest/smallest layers
   - (Add) Light-off mode: Set the light-off with an extra delay
   - (Add) Light-off mode: Set the light-off without an extra delay
   - (Add) Light-off mode: Set the light-off to zero
   - (Improvement) Disable bottom and/or normal layer fields when the selected range is outside
- (Add) Settings - Automations: Light-off delay set modes
- (Fix) Exposure time finder: Add staircase, bullseye and counter triangles to feature count at thumbnail
2021-05-11 19:10:36 +01:00

131 lines
3.4 KiB
C#

/*
* GNU AFFERO GENERAL PUBLIC LICENSE
* Version 3, 19 November 2007
* Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UVtools.Core.Operations;
namespace UVtools.Core.Managers
{
public class OperationSessionManager : IList<Operation>
{
#region Settings
//public static string FilePath;
#endregion
#region Singleton
private static Lazy<OperationSessionManager> _instanceHolder =
new(() => new OperationSessionManager());
public static OperationSessionManager Instance => _instanceHolder.Value;
#endregion
#region Members
private readonly List<Operation> _operations = new();
#endregion
#region Properties
#endregion
#region Constructor
private OperationSessionManager()
{
}
#endregion
#region Methods
public Operation Find(Type type)
{
return this.FirstOrDefault(operation => operation.GetType() == type);
}
public Operation Find(Operation fromOperation) => Find(fromOperation.GetType());
#endregion
#region List Implementation
public IEnumerator<Operation> GetEnumerator()
{
return _operations.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable) _operations).GetEnumerator();
}
public void Add(Operation item)
{
if (item is null) return;
_operations.RemoveAll(operation => operation.GetType() == item.GetType());
var operation = item.Clone();
operation.ClearROIandMasks();
operation.ImportedFrom = Operation.OperationImportFrom.Session;
_operations.Add(operation);
}
public void Clear()
{
_operations.Clear();
}
public bool Contains(Operation item)
{
return _operations.Contains(item);
}
public void CopyTo(Operation[] array, int arrayIndex)
{
_operations.CopyTo(array, arrayIndex);
}
public bool Remove(Operation item)
{
return _operations.Remove(item);
}
public int Count => _operations.Count;
public bool IsReadOnly => ((ICollection<Operation>) _operations).IsReadOnly;
public int IndexOf(Operation item)
{
return _operations.IndexOf(item);
}
public void Insert(int index, Operation item)
{
if (item is null) return;
_operations.RemoveAll(operation => operation.GetType() == item.GetType());
var operation = item.Clone();
operation.ImportedFrom = Operation.OperationImportFrom.Session;
_operations.Insert(index, operation);
}
public void RemoveAt(int index)
{
_operations.RemoveAt(index);
}
public Operation this[int index]
{
get => _operations[index];
set => _operations[index] = value;
}
#endregion
}
}