mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
FancyZonesEditor: open a tab with the selected layout on startup (#715)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<Controls:MetroWindow x:Class="FancyZonesEditor.MainWindow"
|
<Controls:MetroWindow x:Class="FancyZonesEditor.MainWindow"
|
||||||
x:Name="MainWindow1"
|
x:Name="MainWindow1"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<local:BooleanToBrushConverter x:Key="BooleanToBrushConverter" />
|
<local:BooleanToBrushConverter x:Key="BooleanToBrushConverter" />
|
||||||
<local:ModelToVisibilityConverter x:Key="ModelToVisibilityConverter" />
|
<local:ModelToVisibilityConverter x:Key="ModelToVisibilityConverter" />
|
||||||
|
<local:BooleanToIntConverter x:Key="BooleanToIntConverter" />
|
||||||
|
|
||||||
<Style x:Key="titleText" TargetType="TextBlock">
|
<Style x:Key="titleText" TargetType="TextBlock">
|
||||||
<Setter Property="FontFamily" Value="Segoe UI" />
|
<Setter Property="FontFamily" Value="Segoe UI" />
|
||||||
@@ -176,8 +177,8 @@
|
|||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
|
||||||
<TextBlock Name="dialog_Title" Text="Choose your layout" Style="{StaticResource titleText}" />
|
<TextBlock Name="dialog_Title" Text="Choose your layout" Style="{StaticResource titleText}" />
|
||||||
|
|
||||||
<TabControl BorderThickness="0" x:Name="TemplateTab">
|
<TabControl BorderThickness="0" x:Name="TemplateTab" SelectedIndex="{Binding IsCustomLayoutActive, Mode=OneWay, Converter={StaticResource BooleanToIntConverter}}">
|
||||||
<TabItem Header="Templates" Template="{StaticResource myTabs}">
|
<TabItem Header="Templates" Template="{StaticResource myTabs}">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel Margin="0,15,0,8" Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Margin="0,15,0,8" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
@@ -38,7 +38,8 @@ namespace FancyZonesEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int _WrapPanelItemSize = 262;
|
private int _WrapPanelItemSize = 262;
|
||||||
public int WrapPanelItemSize {
|
public int WrapPanelItemSize
|
||||||
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _WrapPanelItemSize;
|
return _WrapPanelItemSize;
|
||||||
@@ -238,4 +239,23 @@ namespace FancyZonesEditor
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public class BooleanToIntConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is bool)
|
||||||
|
{
|
||||||
|
return (bool)value == true ? 1 : 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is int)
|
||||||
|
{
|
||||||
|
return (int)value == 1;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,21 @@ namespace FancyZonesEditor
|
|||||||
//
|
//
|
||||||
public class Settings : INotifyPropertyChanged
|
public class Settings : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
public bool IsCustomLayoutActive
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
foreach (LayoutModel model in CustomModels)
|
||||||
|
{
|
||||||
|
if (model.IsSelected)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
{
|
{
|
||||||
ParseCommandLineArgs();
|
ParseCommandLineArgs();
|
||||||
|
|||||||
Reference in New Issue
Block a user