Skip to content

Commit

Permalink
Modified the WizardProgressView(Model) to skip invisible items, this …
Browse files Browse the repository at this point in the history
…was only possible by adding a TrulyObservableCollection to create a changing view for the ItemsControl. But I need to see if there are ways to simplify this.

[release]
  • Loading branch information
Lakritzator committed Jul 27, 2016
1 parent 9abed22 commit 19d03bd
Show file tree
Hide file tree
Showing 23 changed files with 230 additions and 27 deletions.
15 changes: 12 additions & 3 deletions Dapplo.CaliburnMicro.Demo/Dapplo.CaliburnMicro.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,19 @@
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MahApps.Metro, Version=1.3.0.179, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.3.0-ALPHA179\lib\net45\MahApps.Metro.dll</HintPath>
<Reference Include="MahApps.Metro, Version=1.3.0.182, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.3.0-ALPHA182\lib\net45\MahApps.Metro.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MahApps.Metro.IconPacks.Material, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.IconPacks.Material.1.0.0\lib\net452\MahApps.Metro.IconPacks.Material.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.3.0-ALPHA179\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\packages\MahApps.Metro.1.3.0-ALPHA182\lib\net45\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml" />
Expand Down Expand Up @@ -127,6 +131,7 @@
<Compile Include="UseCases\ContextMenu\WizardMenuItem.cs" />
<Compile Include="UseCases\Menu\SaveAsMenuItem.cs" />
<Compile Include="UseCases\Menu\ViewModels\WindowWithMenuViewModel.cs" />
<Compile Include="UseCases\Wizard\ViewModels\WizardStep5ViewModel.cs" />
<Compile Include="ViewModels\CredentialsViewModel.cs" />
<Compile Include="UseCases\Configuration\ViewModels\LanguageConfigViewModel.cs" />
<Compile Include="ViewModels\NotificationExampleViewModel.cs" />
Expand Down Expand Up @@ -178,6 +183,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UseCases\Wizard\Views\WizardStep5View.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\CredentialsView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
1 change: 1 addition & 0 deletions Dapplo.CaliburnMicro.Demo/Languages/IWizardTranslations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ public interface IWizardTranslations : ILanguage, INotifyPropertyChanged
string TitleStep2 { get; }
string TitleStep3 { get; }
string TitleStep4 { get; }
string TitleStep5 { get; }
}
}
1 change: 1 addition & 0 deletions Dapplo.CaliburnMicro.Demo/Languages/language-de-DE.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@
<resource name="title_step2">Schritt 2</resource>
<resource name="title_step3">Schritt 3</resource>
<resource name="title_step4">Schritt 4</resource>
<resource name="title_step5">Schritt 5</resource>
</resources>
</language>
1 change: 1 addition & 0 deletions Dapplo.CaliburnMicro.Demo/Languages/language-en-US.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@
<resource name="title_step2">Step 2</resource>
<resource name="title_step3">Step 3</resource>
<resource name="title_step4">Step 4</resource>
<resource name="title_step5">Step 5</resource>
</resources>
</language>
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
using Dapplo.CaliburnMicro.Menu;
using Dapplo.Log.Facade;
using Dapplo.Utils;
using MahApps.Metro.Controls;
using MahApps.Metro.IconPacks;

#endregion

Expand All @@ -60,9 +60,9 @@ public void OnImportsSatisfied()
{
UiContext.RunOn(() =>
{
Icon = new PackIconModern
Icon = new PackIconMaterial
{
Kind = PackIconModernKind.Settings
Kind = PackIconMaterialKind.Settings
};
// automatically update the DisplayName
this.BindDisplayName(ContextMenuTranslations, nameof(IContextMenuTranslations.Configure));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
using Dapplo.CaliburnMicro.Extensions;
using Dapplo.CaliburnMicro.Menu;
using Dapplo.Utils;
using MahApps.Metro.Controls;
using System.Windows;
using MahApps.Metro.IconPacks;

#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
using Dapplo.CaliburnMicro.Menu;
using Dapplo.Log.Facade;
using Dapplo.Utils;
using MahApps.Metro.Controls;
using MahApps.Metro.IconPacks;

#endregion

Expand All @@ -60,9 +60,9 @@ public void OnImportsSatisfied()
{
UiContext.RunOn(() =>
{
Icon = new PackIconModern
Icon = new PackIconMaterial
{
Kind = PackIconModernKind.List
Kind = PackIconMaterialKind.ViewList
};
// automatically update the DisplayName
this.BindDisplayName(ContextMenuTranslations, nameof(IContextMenuTranslations.SomeWindow));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
using Dapplo.CaliburnMicro.Menu;
using Dapplo.Log.Facade;
using Dapplo.Utils;
using MahApps.Metro.Controls;
using MahApps.Metro.IconPacks;

#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
using Dapplo.CaliburnMicro.Menu;
using Dapplo.Utils;
using MahApps.Metro.Controls;
using MahApps.Metro.IconPacks;

#endregion

Expand All @@ -59,9 +60,9 @@ public void OnImportsSatisfied()
{
// automatically update the DisplayName
this.BindDisplayName(ContextMenuTranslations, nameof(IContextMenuTranslations.Wizard));
Icon = new PackIconFontAwesome
Icon = new PackIconMaterial
{
Kind = PackIconFontAwesomeKind.Magic
Kind = PackIconMaterialKind.Alarm
};
});
}
Expand Down
5 changes: 3 additions & 2 deletions Dapplo.CaliburnMicro.Demo/UseCases/Menu/SaveAsMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
using Dapplo.CaliburnMicro.Menu;
using Dapplo.Utils;
using MahApps.Metro.Controls;
using MahApps.Metro.IconPacks;

#endregion

Expand All @@ -53,9 +54,9 @@ public void OnImportsSatisfied()
{
// automatically update the DisplayName
this.BindDisplayName(MenuTranslations, nameof(IMenuTranslations.SaveAs));
Icon = new PackIconEntypo
Icon = new PackIconMaterial
{
Kind = PackIconEntypoKind.Save
Kind = PackIconMaterialKind.ContentSave
};
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@
#region Usings

using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Linq;
using Dapplo.CaliburnMicro.Demo.Languages;
using Dapplo.CaliburnMicro.Extensions;
using Dapplo.CaliburnMicro.Wizard;
using Dapplo.CaliburnMicro.Wizard.ViewModels;
using Dapplo.CaliburnMicro.Collections;

#endregion

Expand Down Expand Up @@ -66,11 +68,11 @@ public bool IsStep2Enabled

public void OnImportsSatisfied()
{
WizardProgress = new WizardProgressViewModel(this);
// automatically update the DisplayName
this.BindDisplayName(WizardTranslations, nameof(IWizardTranslations.Title));
// Set the WizardScreens by ordering them
WizardScreens = WizardItems.OrderBy(x => x.Order);
// Set the WizardScreens as TrulyObservableCollection (needed for the WizardProgressViewModel) and by ordering them
WizardScreens = new TrulyObservableCollection<IWizardScreen>(WizardItems.OrderBy(x => x.Order));
WizardProgress = new WizardProgressViewModel(this);
}

protected override void OnActivate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public override void Initialize()
{
// automatically update the DisplayName
_displayNameUpdater = this.BindDisplayName(WizardTranslations, nameof(IWizardTranslations.TitleStep3));
IsVisible = false;
}

public override void Terminate()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#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

#region Usings

using System;
using System.ComponentModel.Composition;
using Dapplo.CaliburnMicro.Demo.Languages;
using Dapplo.CaliburnMicro.Extensions;
using Dapplo.CaliburnMicro.Wizard;

#endregion

namespace Dapplo.CaliburnMicro.Demo.UseCases.Wizard.ViewModels
{
[Export(typeof(IWizardScreen))]
public sealed class WizardStep5ViewModel : WizardScreen<WizardExampleViewModel>
{
private IDisposable _displayNameUpdater;

public WizardStep5ViewModel()
{
Order = 5;
}

[Import]
private IWizardTranslations WizardTranslations { get; set; }

public override void Initialize()
{
// automatically update the DisplayName
_displayNameUpdater = this.BindDisplayName(WizardTranslations, nameof(IWizardTranslations.TitleStep5));
}

public override void Terminate()
{
_displayNameUpdater?.Dispose();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
Icon="/Resources/icon.ico"
Width="400" Height="400">
<mah:MetroWindow.Resources>
Expand All @@ -22,11 +23,11 @@
<ContentControl x:Name="ActiveItem" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button x:Name="Previous" ToolTip="{Binding WizardTranslations.Previous}" Style="{DynamicResource SquareButtonStyle}"
Grid.Row="0" Grid.RowSpan="2" Grid.Column="0" VerticalAlignment="Center">
<mah:PackIconModern Kind="NavigatePrevious"/>
<iconPacks:PackIconMaterial Kind="SkipPrevious"/>
</Button>
<Button x:Name="Next" ToolTip="{Binding WizardTranslations.Next}" Style="{DynamicResource SquareButtonStyle}"
Grid.Row="0" Grid.RowSpan="2" Grid.Column="2" VerticalAlignment="Center">
<mah:PackIconModern Kind="NavigateNext"/>
<iconPacks:PackIconMaterial Kind="SkipNext"/>
</Button>
<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Right" Margin="5,5,5,5">
<Button x:Name="Cancel" ToolTip="{Binding WizardTranslations.Cancel}" Content="{Binding WizardTranslations.Cancel}" Margin="0,0,5,0" Width="100" Style="{DynamicResource SquareButtonStyle}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
<StackPanel>
<Label Content="This is step 3" />
<Label Content="This is step 3, and should not be visible" />
</StackPanel>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<UserControl x:Class="Dapplo.CaliburnMicro.Demo.UseCases.Wizard.Views.WizardStep5View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
<StackPanel>
<Label Content="This is step 5" />
</StackPanel>
</UserControl>
3 changes: 2 additions & 1 deletion Dapplo.CaliburnMicro.Demo/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<package id="Dapplo.Log.Loggers" version="0.5.4" targetFramework="net452" />
<package id="Dapplo.Utils" version="0.1.73" targetFramework="net452" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.8" targetFramework="net452" />
<package id="MahApps.Metro" version="1.3.0-ALPHA179" targetFramework="net452" />
<package id="MahApps.Metro" version="1.3.0-ALPHA182" targetFramework="net452" />
<package id="MahApps.Metro.IconPacks.Material" version="1.0.0" targetFramework="net452" />
</packages>
6 changes: 3 additions & 3 deletions Dapplo.CaliburnMicro.Metro/Dapplo.CaliburnMicro.Metro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
<HintPath>..\packages\Dapplo.Addons.0.3.55\lib\net45\Dapplo.Addons.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MahApps.Metro, Version=1.3.0.179, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.3.0-ALPHA179\lib\net45\MahApps.Metro.dll</HintPath>
<Reference Include="MahApps.Metro, Version=1.3.0.182, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.3.0-ALPHA182\lib\net45\MahApps.Metro.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="PresentationCore" />
Expand All @@ -61,7 +61,7 @@
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\MahApps.Metro.1.3.0-ALPHA179\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\packages\MahApps.Metro.1.3.0-ALPHA182\lib\net45\System.Windows.Interactivity.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xaml" />
Expand Down
2 changes: 1 addition & 1 deletion Dapplo.CaliburnMicro.Metro/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<package id="Caliburn.Micro" version="3.0.1" targetFramework="net452" />
<package id="Caliburn.Micro.Core" version="3.0.1" targetFramework="net452" />
<package id="Dapplo.Addons" version="0.3.55" targetFramework="net45" />
<package id="MahApps.Metro" version="1.3.0-ALPHA179" targetFramework="net45" />
<package id="MahApps.Metro" version="1.3.0-ALPHA182" targetFramework="net45" />
</packages>
Loading

0 comments on commit 19d03bd

Please sign in to comment.