-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved the demo with a tree view for the configuration, for this I …
…added the interfaces IConfig & IConfigScreen and implementations for these interfaces, this still is work in progress. [release]
- Loading branch information
1 parent
799d529
commit fa9c2ff
Showing
32 changed files
with
939 additions
and
89 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
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
55 changes: 55 additions & 0 deletions
55
Dapplo.CaliburnMicro.Demo.Addon/ViewModels/NotSelectableConfigViewModel.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,55 @@ | ||
// Dapplo - building blocks for desktop applications | ||
// Copyright (C) 2016 Dapplo | ||
// | ||
// For more information see: http://dapplo.net/ | ||
// Dapplo repositories are hosted on GitHub: https://github.com/dapplo | ||
// | ||
// This file is part of Dapplo.CaliburnMicro | ||
// | ||
// Dapplo.CaliburnMicro is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Dapplo.CaliburnMicro is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have a copy of the GNU Lesser General Public License | ||
// along with Dapplo.CaliburnMicro. If not, see <http://www.gnu.org/licenses/lgpl.txt>. | ||
|
||
#region using | ||
|
||
using System.ComponentModel.Composition; | ||
using Caliburn.Micro; | ||
using Dapplo.CaliburnMicro.Configuration; | ||
using Dapplo.CaliburnMicro.Demo.Addon.Languages; | ||
using Dapplo.CaliburnMicro.Demo.Languages; | ||
using Dapplo.CaliburnMicro.Demo.UseCases.Configuration; | ||
using Dapplo.Utils.Extensions; | ||
|
||
#endregion | ||
|
||
namespace Dapplo.CaliburnMicro.Demo.Addon.ViewModels | ||
{ | ||
[Export(typeof(IConfigScreen))] | ||
public sealed class NotSelectableConfigViewModel : ConfigScreen, IPartImportsSatisfiedNotification | ||
{ | ||
[Import] | ||
public IAddonTranslations AddonTranslations { get; set; } | ||
|
||
public void OnImportsSatisfied() | ||
{ | ||
IsEnabled = false; | ||
// automatically update the DisplayName | ||
AddonTranslations.OnPropertyChanged(e => | ||
{ | ||
DisplayName = AddonTranslations.NotSelectableAddon; | ||
}, nameof(IAddonTranslations.NotSelectableAddon)); | ||
} | ||
|
||
public override int ParentId { get; } = (int)ConfigIds.Addons; | ||
public override int Id { get; } = (int)(ConfigIds.Addons + 2); | ||
} | ||
} |
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
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
48 changes: 48 additions & 0 deletions
48
Dapplo.CaliburnMicro.Demo/UseCases/Configuration/ConfigIds.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,48 @@ | ||
#region Dapplo 2016 - GNU Lesser General Public License | ||
|
||
// Dapplo - building blocks for .NET applications | ||
// Copyright (C) 2016 Dapplo | ||
// | ||
// For more information see: http://dapplo.net/ | ||
// Dapplo repositories are hosted on GitHub: https://github.com/dapplo | ||
// | ||
// This file is part of Dapplo.CaliburnMicro | ||
// | ||
// Dapplo.CaliburnMicro is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Dapplo.CaliburnMicro is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have a copy of the GNU Lesser General Public License | ||
// along with Dapplo.CaliburnMicro. If not, see <http://www.gnu.org/licenses/lgpl.txt>. | ||
|
||
#endregion | ||
|
||
namespace Dapplo.CaliburnMicro.Demo.UseCases.Configuration | ||
{ | ||
/// <summary> | ||
/// Used to make it possible to add a ConfigScreen to a well defined parent node | ||
/// </summary> | ||
public enum ConfigIds | ||
{ | ||
/// <summary> | ||
/// The root ID | ||
/// </summary> | ||
Root = 0, | ||
|
||
/// <summary> | ||
/// UI related config screens should have this as parent | ||
/// </summary> | ||
Ui = 100, | ||
|
||
/// <summary> | ||
/// Config screens from addons should have this as parent | ||
/// </summary> | ||
Addons = 200 | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
Dapplo.CaliburnMicro.Demo/UseCases/Configuration/ViewModels/AddonConfigNodeViewModel.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,56 @@ | ||
// Dapplo - building blocks for desktop applications | ||
// Copyright (C) 2016 Dapplo | ||
// | ||
// For more information see: http://dapplo.net/ | ||
// Dapplo repositories are hosted on GitHub: https://github.com/dapplo | ||
// | ||
// This file is part of Dapplo.CaliburnMicro | ||
// | ||
// Dapplo.CaliburnMicro is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Dapplo.CaliburnMicro is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have a copy of the GNU Lesser General Public License | ||
// along with Dapplo.CaliburnMicro. If not, see <http://www.gnu.org/licenses/lgpl.txt>. | ||
|
||
#region using | ||
|
||
using System.Collections.Generic; | ||
using System.ComponentModel.Composition; | ||
using System.Threading.Tasks; | ||
using Caliburn.Micro; | ||
using Dapplo.CaliburnMicro.Configuration; | ||
using Dapplo.CaliburnMicro.Demo.Languages; | ||
using Dapplo.CaliburnMicro.Demo.Models; | ||
using Dapplo.Config.Language; | ||
using Dapplo.Utils.Extensions; | ||
|
||
#endregion | ||
|
||
namespace Dapplo.CaliburnMicro.Demo.UseCases.Configuration.ViewModels | ||
{ | ||
[Export(typeof(IConfigScreen))] | ||
public sealed class AddonConfigNodeViewModel : ConfigScreen, IPartImportsSatisfiedNotification | ||
{ | ||
[Import] | ||
public IConfigTranslations ConfigTranslations { get; set; } | ||
|
||
public void OnImportsSatisfied() | ||
{ | ||
// automatically update the DisplayName | ||
ConfigTranslations.OnPropertyChanged(pcEvent => | ||
{ | ||
DisplayName = ConfigTranslations.Addons; | ||
}, nameof(IConfigTranslations.Addons)); | ||
CanActivate = false; | ||
} | ||
|
||
public override int Id { get; } = (int) ConfigIds.Addons; | ||
} | ||
} |
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.