diff --git a/Eve-O-Preview/Eve-O-Preview.csproj b/Eve-O-Preview/Eve-O-Preview.csproj
index 4f540ae..946f729 100644
--- a/Eve-O-Preview/Eve-O-Preview.csproj
+++ b/Eve-O-Preview/Eve-O-Preview.csproj
@@ -146,15 +146,13 @@
-
+
-
-
-
+
+
-
-
+
@@ -167,8 +165,8 @@
-
-
+
+
Form
diff --git a/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs b/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs
index c6371c0..4756e7b 100644
--- a/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs
+++ b/Eve-O-Preview/Presenters/Implementation/MainFormPresenter.cs
@@ -4,6 +4,7 @@ using System.Diagnostics;
using System.Drawing;
using EveOPreview.Configuration;
using EveOPreview.Mediator.Messages;
+using EveOPreview.Services;
using EveOPreview.UI;
using EveOPreview.View;
using MediatR;
@@ -20,25 +21,21 @@ namespace EveOPreview.Presenters
private readonly IMediator _mediator;
private readonly IThumbnailConfiguration _configuration;
private readonly IConfigurationStorage _configurationStorage;
- private readonly IThumbnailDescriptionViewFactory _thumbnailDescriptionViewFactory;
- private readonly IDictionary _thumbnailDescriptionViews;
private readonly IThumbnailManager _thumbnailManager;
private bool _exitApplication;
#endregion
public MainFormPresenter(IApplicationController controller, IMainFormView view, IMediator mediator, IThumbnailConfiguration configuration, IConfigurationStorage configurationStorage,
- IThumbnailManager thumbnailManager, IThumbnailDescriptionViewFactory thumbnailDescriptionViewFactory)
+ IThumbnailManager thumbnailManager)
: base(controller, view)
{
this._mediator = mediator;
this._configuration = configuration;
this._configurationStorage = configurationStorage;
- this._thumbnailDescriptionViewFactory = thumbnailDescriptionViewFactory;
this._thumbnailManager = thumbnailManager;
- this._thumbnailDescriptionViews = new Dictionary();
this._exitApplication = false;
this.View.FormActivated = this.Activate;
@@ -155,64 +152,64 @@ namespace EveOPreview.Presenters
private void ThumbnailsAdded(IList thumbnails)
{
- this.View.AddThumbnails(this.GetThumbnailViews(thumbnails, false));
+ //this.View.AddThumbnails(this.GetThumbnailViews(thumbnails, false));
}
private void ThumbnailsUpdated(IList thumbnails)
{
- this.View.UpdateThumbnails(this.GetThumbnailViews(thumbnails, false));
+ //this.View.UpdateThumbnails(this.GetThumbnailViews(thumbnails, false));
}
private void ThumbnailsRemoved(IList thumbnails)
{
- this.View.RemoveThumbnails(this.GetThumbnailViews(thumbnails, true));
+ //this.View.RemoveThumbnails(this.GetThumbnailViews(thumbnails, true));
}
- private IList GetThumbnailViews(IList thumbnails, bool removeFromCache)
+ //private IList GetThumbnailViews(IList thumbnails, bool removeFromCache)
+ //{
+ // IList thumbnailViews = new List(thumbnails.Count);
+
+ // // Time for some thread safety
+ // lock (this._thumbnailDescriptionViews)
+ // {
+ // foreach (IThumbnailView thumbnail in thumbnails)
+ // {
+ // IThumbnailDescriptionView thumbnailView;
+ // bool foundInCache = this._thumbnailDescriptionViews.TryGetValue(thumbnail.Id, out thumbnailView);
+
+ // if (!foundInCache)
+ // {
+ // if (removeFromCache)
+ // {
+ // // This item was not even cached
+ // continue;
+ // }
+
+ // thumbnailView = this._thumbnailDescriptionViewFactory.Create(thumbnail.Id, thumbnail.Title, !thumbnail.IsEnabled);
+ // this._thumbnailDescriptionViews.Add(thumbnail.Id, thumbnailView);
+ // }
+ // else
+ // {
+ // if (removeFromCache)
+ // {
+ // this._thumbnailDescriptionViews.Remove(thumbnail.Id);
+ // }
+ // else
+ // {
+ // thumbnailView.Title = thumbnail.Title;
+ // }
+ // }
+
+ // thumbnailViews.Add(thumbnailView);
+ // }
+ // }
+
+ // return thumbnailViews;
+ //}
+
+ private void UpdateThumbnailState(String title)
{
- IList thumbnailViews = new List(thumbnails.Count);
-
- // Time for some thread safety
- lock (this._thumbnailDescriptionViews)
- {
- foreach (IThumbnailView thumbnail in thumbnails)
- {
- IThumbnailDescriptionView thumbnailView;
- bool foundInCache = this._thumbnailDescriptionViews.TryGetValue(thumbnail.Id, out thumbnailView);
-
- if (!foundInCache)
- {
- if (removeFromCache)
- {
- // This item was not even cached
- continue;
- }
-
- thumbnailView = this._thumbnailDescriptionViewFactory.Create(thumbnail.Id, thumbnail.Title, !thumbnail.IsEnabled);
- this._thumbnailDescriptionViews.Add(thumbnail.Id, thumbnailView);
- }
- else
- {
- if (removeFromCache)
- {
- this._thumbnailDescriptionViews.Remove(thumbnail.Id);
- }
- else
- {
- thumbnailView.Title = thumbnail.Title;
- }
- }
-
- thumbnailViews.Add(thumbnailView);
- }
- }
-
- return thumbnailViews;
- }
-
- private void UpdateThumbnailState(IntPtr thumbnailId)
- {
- this._thumbnailManager.SetThumbnailState(thumbnailId, this._thumbnailDescriptionViews[thumbnailId].IsDisabled);
+ //this._thumbnailManager.SetThumbnailState(thumbnailId, this._thumbnailDescriptionViews[thumbnailId].IsDisabled);
}
private void OpenDocumentationLink()
@@ -224,7 +221,7 @@ namespace EveOPreview.Presenters
private string GetApplicationVersion()
{
Version version = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;
- return String.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Revision);
+ return $"{version.Major}.{version.Minor}.{version.Revision}";
}
private void ExitApplication()
diff --git a/Eve-O-Preview/Presenters/ViewZoomAnchorConverter.cs b/Eve-O-Preview/Presenters/Implementation/ViewZoomAnchorConverter.cs
similarity index 87%
rename from Eve-O-Preview/Presenters/ViewZoomAnchorConverter.cs
rename to Eve-O-Preview/Presenters/Implementation/ViewZoomAnchorConverter.cs
index 650e30e..2c8f300 100644
--- a/Eve-O-Preview/Presenters/ViewZoomAnchorConverter.cs
+++ b/Eve-O-Preview/Presenters/Implementation/ViewZoomAnchorConverter.cs
@@ -1,7 +1,6 @@
using EveOPreview.Configuration;
-using EveOPreview.View;
-namespace EveOPreview.UI
+namespace EveOPreview.View
{
static class ViewZoomAnchorConverter
{
diff --git a/Eve-O-Preview/Presenters/ViewCloseRequest.cs b/Eve-O-Preview/Presenters/Interface/ViewCloseRequest.cs
similarity index 76%
rename from Eve-O-Preview/Presenters/ViewCloseRequest.cs
rename to Eve-O-Preview/Presenters/Interface/ViewCloseRequest.cs
index 29c6cff..b9b7ab3 100644
--- a/Eve-O-Preview/Presenters/ViewCloseRequest.cs
+++ b/Eve-O-Preview/Presenters/Interface/ViewCloseRequest.cs
@@ -1,4 +1,4 @@
-namespace EveOPreview.UI
+namespace EveOPreview.View
{
public class ViewCloseRequest
{
diff --git a/Eve-O-Preview/Program.cs b/Eve-O-Preview/Program.cs
index 3354fc6..eb723f5 100644
--- a/Eve-O-Preview/Program.cs
+++ b/Eve-O-Preview/Program.cs
@@ -94,14 +94,13 @@ namespace EveOPreview
// Application services
container.Register();
container.Register();
- container.Register();
+ container.Register();
IApplicationController controller = new ApplicationController(container);
// UI classes
controller.RegisterView()
.RegisterView()
- .RegisterView()
.RegisterInstance(new ApplicationContext());
return controller;
diff --git a/Eve-O-Preview/Presenters/ThumbnailManager.cs b/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs
similarity index 96%
rename from Eve-O-Preview/Presenters/ThumbnailManager.cs
rename to Eve-O-Preview/Services/Implementation/ThumbnailManager.cs
index 99f04c0..b1a0ef9 100644
--- a/Eve-O-Preview/Presenters/ThumbnailManager.cs
+++ b/Eve-O-Preview/Services/Implementation/ThumbnailManager.cs
@@ -8,7 +8,7 @@ using EveOPreview.Services;
using EveOPreview.View;
using MediatR;
-namespace EveOPreview.UI
+namespace EveOPreview.Services
{
class ThumbnailManager : IThumbnailManager
{
diff --git a/Eve-O-Preview/Presenters/IThumbnailManager.cs b/Eve-O-Preview/Services/Interface/IThumbnailManager.cs
similarity index 77%
rename from Eve-O-Preview/Presenters/IThumbnailManager.cs
rename to Eve-O-Preview/Services/Interface/IThumbnailManager.cs
index ea8c249..a3a5788 100644
--- a/Eve-O-Preview/Presenters/IThumbnailManager.cs
+++ b/Eve-O-Preview/Services/Interface/IThumbnailManager.cs
@@ -1,8 +1,7 @@
using System;
-using System.Collections.Generic;
using System.Drawing;
-namespace EveOPreview.UI
+namespace EveOPreview.Services
{
public interface IThumbnailManager
{
diff --git a/Eve-O-Preview/View/Factory/ThumbnailDescriptionViewFactory.cs b/Eve-O-Preview/View/Factory/ThumbnailDescriptionViewFactory.cs
deleted file mode 100644
index d4992d3..0000000
--- a/Eve-O-Preview/View/Factory/ThumbnailDescriptionViewFactory.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using EveOPreview.View;
-
-namespace EveOPreview.UI
-{
- public class ThumbnailDescriptionViewFactory : IThumbnailDescriptionViewFactory
- {
- private readonly IApplicationController _controller;
-
- public ThumbnailDescriptionViewFactory(IApplicationController controller)
- {
- this._controller = controller;
- }
-
- public IThumbnailDescriptionView Create(IntPtr id, string title, bool isDisabled)
- {
- IThumbnailDescriptionView view = this._controller.Create();
-
- view.Id = id;
- view.Title = title;
- view.IsDisabled = isDisabled;
-
- return view;
- }
- }
-}
\ No newline at end of file
diff --git a/Eve-O-Preview/View/Implementation/MainForm.cs b/Eve-O-Preview/View/Implementation/MainForm.cs
index f80e2f3..eea205f 100644
--- a/Eve-O-Preview/View/Implementation/MainForm.cs
+++ b/Eve-O-Preview/View/Implementation/MainForm.cs
@@ -206,7 +206,7 @@ namespace EveOPreview.View
this.DocumentationLink.Text = url;
}
- public void AddThumbnails(IList thumbnails)
+ public void AddThumbnails(IList thumbnails)
{
if (thumbnails.Count == 0)
{
@@ -215,7 +215,7 @@ namespace EveOPreview.View
this.ThumbnailsList.BeginUpdate();
- foreach (IThumbnailDescriptionView view in thumbnails)
+ foreach (IThumbnailDescription view in thumbnails)
{
this.ThumbnailsList.Items.Add(view);
}
@@ -223,7 +223,7 @@ namespace EveOPreview.View
this.ThumbnailsList.EndUpdate();
}
- public void UpdateThumbnails(IList thumbnails)
+ public void UpdateThumbnails(IList thumbnails)
{
// Just trigger redraw
if (thumbnails.Count > 0)
@@ -232,7 +232,7 @@ namespace EveOPreview.View
}
}
- public void RemoveThumbnails(IList thumbnails)
+ public void RemoveThumbnails(IList thumbnails)
{
if (thumbnails.Count == 0)
{
@@ -241,7 +241,7 @@ namespace EveOPreview.View
this.ThumbnailsList.BeginUpdate();
- foreach (IThumbnailDescriptionView view in thumbnails)
+ foreach (IThumbnailDescription view in thumbnails)
{
this.ThumbnailsList.Items.Remove(view);
}
@@ -268,7 +268,7 @@ namespace EveOPreview.View
public Action ThumbnailsSizeChanged { get; set; }
- public Action ThumbnailStateChanged { get; set; }
+ public Action ThumbnailStateChanged { get; set; }
public Action DocumentationLinkActivated { get; set; }
@@ -345,14 +345,14 @@ namespace EveOPreview.View
private void ThumbnailsList_ItemCheck_Handler(object sender, ItemCheckEventArgs e)
{
- IThumbnailDescriptionView selectedItem = this.ThumbnailsList.Items[e.Index] as IThumbnailDescriptionView;
- if (selectedItem == null)
+ if (!(this.ThumbnailsList.Items[e.Index] is IThumbnailDescription selectedItem))
{
return;
}
+
selectedItem.IsDisabled = (e.NewValue == CheckState.Checked);
- this.ThumbnailStateChanged?.Invoke(selectedItem.Id);
+ this.ThumbnailStateChanged?.Invoke(selectedItem.Title);
}
private void DocumentationLinkClicked_Handler(object sender, LinkLabelLinkClickedEventArgs e)
diff --git a/Eve-O-Preview/View/Implementation/ThumbnailDescription.cs b/Eve-O-Preview/View/Implementation/ThumbnailDescription.cs
new file mode 100644
index 0000000..21201d2
--- /dev/null
+++ b/Eve-O-Preview/View/Implementation/ThumbnailDescription.cs
@@ -0,0 +1,14 @@
+namespace EveOPreview.View
+{
+ sealed class ThumbnailDescription
+ {
+ public ThumbnailDescription(string title, bool isDisabled)
+ {
+ this.Title = title;
+ this.IsDisabled = isDisabled;
+ }
+
+ public string Title { get; set; }
+ public bool IsDisabled { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Eve-O-Preview/View/Implementation/ThumbnailDescriptionView.cs b/Eve-O-Preview/View/Implementation/ThumbnailDescriptionView.cs
deleted file mode 100644
index a34e443..0000000
--- a/Eve-O-Preview/View/Implementation/ThumbnailDescriptionView.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System;
-using EveOPreview.UI;
-
-namespace EveOPreview.View
-{
- public class ThumbnailDescriptionView : IThumbnailDescriptionView
- {
- public IntPtr Id { get; set; }
-
- public string Title { get; set; }
-
- public bool IsDisabled { get; set; }
-
- public void Show()
- {
- }
-
- public void Hide()
- {
- }
-
- public void Close()
- {
- }
- }
-}
\ No newline at end of file
diff --git a/Eve-O-Preview/View/Factory/ThumbnailViewFactory.cs b/Eve-O-Preview/View/Implementation/ThumbnailViewFactory.cs
similarity index 76%
rename from Eve-O-Preview/View/Factory/ThumbnailViewFactory.cs
rename to Eve-O-Preview/View/Implementation/ThumbnailViewFactory.cs
index 8391509..22c8715 100644
--- a/Eve-O-Preview/View/Factory/ThumbnailViewFactory.cs
+++ b/Eve-O-Preview/View/Implementation/ThumbnailViewFactory.cs
@@ -1,10 +1,9 @@
using System;
using System.Drawing;
-using EveOPreview.View;
-namespace EveOPreview.UI
+namespace EveOPreview.View
{
- public class ThumbnailViewFactory : IThumbnailViewFactory
+ sealed class ThumbnailViewFactory : IThumbnailViewFactory
{
private readonly IApplicationController _controller;
diff --git a/Eve-O-Preview/View/Interface/IMainFormView.cs b/Eve-O-Preview/View/Interface/IMainFormView.cs
index 149d79c..1de6521 100644
--- a/Eve-O-Preview/View/Interface/IMainFormView.cs
+++ b/Eve-O-Preview/View/Interface/IMainFormView.cs
@@ -39,9 +39,9 @@ namespace EveOPreview.View
void Minimize();
- void AddThumbnails(IList thumbnails);
- void UpdateThumbnails(IList thumbnails);
- void RemoveThumbnails(IList thumbnails);
+ void AddThumbnails(IList thumbnails);
+ void UpdateThumbnails(IList thumbnails);
+ void RemoveThumbnails(IList thumbnails);
void RefreshZoomSettings();
Action ApplicationExitRequested { get; set; }
@@ -50,7 +50,7 @@ namespace EveOPreview.View
Action FormCloseRequested { get; set; }
Action ApplicationSettingsChanged { get; set; }
Action ThumbnailsSizeChanged { get; set; }
- Action ThumbnailStateChanged { get; set; }
+ Action ThumbnailStateChanged { get; set; }
Action DocumentationLinkActivated { get; set; }
}
}
\ No newline at end of file
diff --git a/Eve-O-Preview/View/Interface/IThumbnailDescriptionView.cs b/Eve-O-Preview/View/Interface/IThumbnailDescription.cs
similarity index 56%
rename from Eve-O-Preview/View/Interface/IThumbnailDescriptionView.cs
rename to Eve-O-Preview/View/Interface/IThumbnailDescription.cs
index b8829a8..e44a1b9 100644
--- a/Eve-O-Preview/View/Interface/IThumbnailDescriptionView.cs
+++ b/Eve-O-Preview/View/Interface/IThumbnailDescription.cs
@@ -2,9 +2,8 @@
namespace EveOPreview.View
{
- public interface IThumbnailDescriptionView : IView
+ public interface IThumbnailDescription
{
- IntPtr Id { get; set; }
string Title { get; set; }
bool IsDisabled { get; set; }
}
diff --git a/Eve-O-Preview/View/Interface/IThumbnailDescriptionViewFactory.cs b/Eve-O-Preview/View/Interface/IThumbnailDescriptionViewFactory.cs
deleted file mode 100644
index d2747a4..0000000
--- a/Eve-O-Preview/View/Interface/IThumbnailDescriptionViewFactory.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System;
-using EveOPreview.View;
-
-namespace EveOPreview.UI
-{
- public interface IThumbnailDescriptionViewFactory
- {
- IThumbnailDescriptionView Create(IntPtr id, string title, bool isDisabled);
- }
-}
\ No newline at end of file
diff --git a/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs b/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs
index 1f8d39c..67bf001 100644
--- a/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs
+++ b/Eve-O-Preview/View/Interface/IThumbnailViewFactory.cs
@@ -1,8 +1,7 @@
using System;
using System.Drawing;
-using EveOPreview.View;
-namespace EveOPreview.UI
+namespace EveOPreview.View
{
public interface IThumbnailViewFactory
{