forked from yuyuvn/KanColleViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
909 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Grabacr07.KanColleViewer.Composition | ||
{ | ||
/// <summary> | ||
/// KanColleViewer プラグインのメタデータを公開します。 | ||
/// </summary> | ||
public interface IPluginMetadata | ||
{ | ||
/// <summary> | ||
/// プラグインのタイトルを取得します。 | ||
/// </summary> | ||
string Title { get; } | ||
|
||
/// <summary> | ||
/// プラグインが提供する機能を簡潔に説明するテキストを取得します。 | ||
/// </summary> | ||
string Description { get; } | ||
|
||
/// <summary> | ||
/// プラグインのバージョンを取得します。 | ||
/// </summary> | ||
string Version { get; } | ||
|
||
/// <summary> | ||
/// プラグインの開発者を取得します。 | ||
/// </summary> | ||
string Author { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
Grabacr07.KanColleViewer/ViewModels/Composition/NotifierViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Grabacr07.KanColleViewer.Composition; | ||
|
||
namespace Grabacr07.KanColleViewer.ViewModels.Composition | ||
{ | ||
public class NotifierViewModel : PluginViewModelBase<INotifier> | ||
{ | ||
#region ErrorMessage 変更通知プロパティ | ||
|
||
private string _ErrorMessage; | ||
|
||
public string ErrorMessage | ||
{ | ||
get { return this._ErrorMessage; } | ||
set | ||
{ | ||
if (this._ErrorMessage != value) | ||
{ | ||
this._ErrorMessage = value; | ||
this.RaisePropertyChanged(); | ||
} | ||
} | ||
} | ||
|
||
#endregion | ||
|
||
public NotifierViewModel(Lazy<INotifier, IPluginMetadata> plugin) : base(plugin) | ||
{ | ||
this.ErrorMessage = null; | ||
} | ||
|
||
public void Test() | ||
{ | ||
this.Plugin.Show(NotifyType.Other, "テスト", "これはテスト通知です。", App.ViewModelRoot.Activate, ex => this.ErrorMessage = ex.Message); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Grabacr07.KanColleViewer/ViewModels/Composition/PluginViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Grabacr07.KanColleViewer.Composition; | ||
|
||
namespace Grabacr07.KanColleViewer.ViewModels.Composition | ||
{ | ||
public class PluginViewModel : PluginViewModelBase<IPlugin> | ||
{ | ||
public PluginViewModel(Lazy<IPlugin, IPluginMetadata> plugin) : base(plugin) { } | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
Grabacr07.KanColleViewer/ViewModels/Composition/PluginViewModelBase.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Grabacr07.KanColleViewer.Composition; | ||
using Livet; | ||
|
||
namespace Grabacr07.KanColleViewer.ViewModels.Composition | ||
{ | ||
public abstract class PluginViewModelBase<TPlugin> : ViewModel where TPlugin : IPlugin | ||
{ | ||
protected TPlugin Plugin { get; private set; } | ||
|
||
private IPluginMetadata Metadata { get; set; } | ||
|
||
|
||
public string Title | ||
{ | ||
get { return this.Metadata.Title; } | ||
} | ||
|
||
public string Description | ||
{ | ||
get { return this.Metadata.Description; } | ||
} | ||
|
||
public string Author | ||
{ | ||
get { return this.Metadata.Author; } | ||
} | ||
|
||
public string Version | ||
{ | ||
get { return this.Metadata.Version; } | ||
} | ||
|
||
|
||
protected PluginViewModelBase(Lazy<TPlugin, IPluginMetadata> plugin) | ||
{ | ||
this.Plugin = plugin.Value; | ||
this.Metadata = plugin.Metadata; | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Grabacr07.KanColleViewer/ViewModels/Composition/ToolViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Grabacr07.KanColleViewer.Composition; | ||
|
||
namespace Grabacr07.KanColleViewer.ViewModels.Composition | ||
{ | ||
public class ToolViewModel : PluginViewModelBase<IToolPlugin> | ||
{ | ||
public ToolViewModel(Lazy<IToolPlugin, IPluginMetadata> plugin) : base(plugin) { } | ||
|
||
public string ToolName | ||
{ | ||
get { return this.Plugin.ToolName; } | ||
} | ||
|
||
public object View | ||
{ | ||
get { return this.Plugin.GetToolView(); } | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return this.Title; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.