Skip to content
This repository was archived by the owner on Nov 25, 2023. It is now read-only.
Merged
4 changes: 0 additions & 4 deletions src/InvvardDev.EZLayoutDisplay.Desktop/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
TrueValue="Visible" FalseValue="Hidden" />
<converter:BoolToVisibilityConverter x:Key="BoolToVisibleConverter"
TrueValue="Hidden" FalseValue="Visible" />

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Skins/KeyboardLayoutSkin.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

</Application.Resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Skins\DisplayLayoutSkin.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\AboutWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class KeyTemplate
public string RotationOrigin { get; set; }

/// <summary>
/// Gets or sets the key .
/// Gets or sets the key Glowing indicator.
/// </summary>
[JsonProperty("glow", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[DefaultValue(false)]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Style TargetType="StackPanel" x:Key="SpLayerNameStyle">
<Setter Property="Height" Value="100" />
<Setter Property="Width" Value="180" />
<Setter Property="Margin" Value="0,25,0,0" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Top" />
</Style>

<Style TargetType="TextBlock" x:Key="TextblockLayerNameStyle">
<Setter Property="TextAlignment" Value="Center" />
<Setter Property="Margin" Value="5,5,5,0" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="TextWrapping" Value="WrapWithOverflow" />
</Style>

<Style TargetType="TextBlock" BasedOn="{StaticResource TextblockLayerNameStyle}" x:Key="TbLayerNameTitleStyle">
<Setter Property="Foreground" Value="#BBB" />
<Setter Property="FontSize" Value="14" />
</Style>

<Style TargetType="TextBlock" BasedOn="{StaticResource TextblockLayerNameStyle}" x:Key="TbLayerNameStyle">
<Setter Property="Foreground" Value="#555" />
<Setter Property="FontSize" Value="16" />
</Style>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
Title="{Binding WindowTitle}" Icon="{StaticResource WindowIcon}"
DataContext="{Binding DisplayLayout, Source={StaticResource Locator}}">

<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Skins/KeyboardLayoutSkin.xaml" />
<ResourceDictionary Source="../Skins/DisplayLayoutSkin.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>

<i:Interaction.Triggers>
<i:EventTrigger EventName="Deactivated">
<command:EventToCommand Command="{Binding LostFocusCommand, Mode=OneWay}" />
Expand All @@ -33,6 +42,11 @@
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
<StackPanel Style="{StaticResource SpLayerNameStyle}"
Visibility="{Binding NoLayoutAvailable, Converter={StaticResource BoolToVisibleConverter}}">
<TextBlock Text="{Binding CurrentLayerNameTitle}" Style="{StaticResource TbLayerNameTitleStyle}" />
<TextBlock Text="{Binding CurrentLayerName}" Style="{StaticResource TbLayerNameStyle}" />
</StackPanel>
<Grid Visibility="{Binding NoLayoutAvailable, Converter={StaticResource BoolToHiddenConverter}}" Width="350">
<Grid.ColumnDefinitions>
<ColumnDefinition Width=".25*"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class DisplayLayoutViewModel : ViewModelBase
private EZLayout _ezLayout;

private string _windowTitle;
private string _currentLayerNameTitle;
private string _currentLayerName;
private bool _noLayoutAvailable;

#endregion
Expand All @@ -54,6 +56,24 @@ public string WindowTitle
set => Set(ref _windowTitle, value);
}

/// <summary>
/// Gets or sets the current layer name title.
/// </summary>
public string CurrentLayerNameTitle
{
get => _currentLayerNameTitle;
set => Set(ref _currentLayerNameTitle, value);
}

/// <summary>
/// Gets or sets the current layer name.
/// </summary>
public string CurrentLayerName
{
get => _currentLayerName;
set => Set(ref _currentLayerName, value);
}

/// <summary>
/// Gets or sets the no layout available indicator.
/// </summary>
Expand Down Expand Up @@ -122,6 +142,8 @@ public DisplayLayoutViewModel(IWindowService windowService, ILayoutService layou
private void SetLabelUi()
{
WindowTitle = "ErgoDox Layout";
CurrentLayerNameTitle = "Current layer :";
CurrentLayerName = "";
}

private async void LoadCompleteLayout()
Expand Down Expand Up @@ -162,6 +184,7 @@ private void LoadDesignTimeModel()
Logger.TraceMethod();

NoLayoutAvailable = false;
CurrentLayerName = "Current Layer Name";

var json = Encoding.Default.GetString(Resources.layoutDefinition);
var layoutDefinition = JsonConvert.DeserializeObject<IEnumerable<KeyTemplate>>(json) as List<KeyTemplate>;
Expand All @@ -174,23 +197,26 @@ private void LoadDesignTimeModel()
Label = new KeyLabel("="),
Modifier = new KeyLabel("Left Shift"),
DisplayType = KeyDisplayType.ModifierOnTop,
KeyCategory = KeyCategory.DualFunction
KeyCategory = KeyCategory.DualFunction,
Color = "#111"
};

CurrentLayoutTemplate[1].EZKey = new EZKey {
Label = new KeyLabel("LT \u2192 1"),
DisplayType = KeyDisplayType.SimpleLabel,
KeyCategory = KeyCategory.DualFunction
};
KeyCategory = KeyCategory.DualFunction,
Color = "#BBB"
};

for (int i = 2 ; i < CurrentLayoutTemplate.Count ; i++)
{
CurrentLayoutTemplate[i].EZKey = new EZKey {
Label = new KeyLabel("E"),
Modifier = new KeyLabel("Left Shift"),
KeyCategory = KeyCategory.French,
InternationalHint = "fr"
};
InternationalHint = "fr",
Color = "#777"
};
}
}

Expand Down Expand Up @@ -227,9 +253,15 @@ private void SwitchLayer()
if (_layoutTemplates.Any())
{
CurrentLayoutTemplate = new ObservableCollection<KeyTemplate>(_layoutTemplates[CurrentLayerIndex]);
ChangeLayerName();
}
}

private void ChangeLayerName()
{
CurrentLayerName = _ezLayout.EZLayers[CurrentLayerIndex].Name;
}

#region Delegates

private void LoadCompleteLayout(UpdatedLayoutMessage obj)
Expand Down