mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Merge branch 'dev/feature/projects' of https://github.com/microsoft/PowerToys into dev/feature/projects
This commit is contained in:
@@ -0,0 +1,22 @@
|
|||||||
|
// Copyright (c) Microsoft Corporation
|
||||||
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||||
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
|
||||||
|
namespace ProjectsEditor.Controls
|
||||||
|
{
|
||||||
|
public class ResetIsEnabled : ContentControl
|
||||||
|
{
|
||||||
|
static ResetIsEnabled()
|
||||||
|
{
|
||||||
|
IsEnabledProperty.OverrideMetadata(
|
||||||
|
typeof(ResetIsEnabled),
|
||||||
|
new UIPropertyMetadata(
|
||||||
|
defaultValue: true,
|
||||||
|
propertyChangedCallback: (_, __) => { },
|
||||||
|
coerceValueCallback: (_, x) => x));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,6 +33,8 @@ namespace ProjectsEditor.Data
|
|||||||
|
|
||||||
public string CommandLineArguments { get; set; }
|
public string CommandLineArguments { get; set; }
|
||||||
|
|
||||||
|
public bool LaunchesAsAdmin { get; set; }
|
||||||
|
|
||||||
public bool Minimized { get; set; }
|
public bool Minimized { get; set; }
|
||||||
|
|
||||||
public bool Maximized { get; set; }
|
public bool Maximized { get; set; }
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace ProjectsEditor.Models
|
|||||||
{
|
{
|
||||||
public class Application : INotifyPropertyChanged, IDisposable
|
public class Application : INotifyPropertyChanged, IDisposable
|
||||||
{
|
{
|
||||||
|
private bool _isInitialized;
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
public Project Parent { get; set; }
|
public Project Parent { get; set; }
|
||||||
@@ -47,9 +49,80 @@ namespace ProjectsEditor.Models
|
|||||||
|
|
||||||
public string CommandLineArguments { get; set; }
|
public string CommandLineArguments { get; set; }
|
||||||
|
|
||||||
public bool Minimized { get; set; }
|
private bool _launchesAsAdmin;
|
||||||
|
|
||||||
public bool Maximized { get; set; }
|
public bool LaunchesAsAdmin
|
||||||
|
{
|
||||||
|
get => _launchesAsAdmin;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_launchesAsAdmin = value;
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(AppMainParams)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void SwitchDeletion()
|
||||||
|
{
|
||||||
|
IsIncluded = !IsIncluded;
|
||||||
|
RedrawPreviewImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RedrawPreviewImage()
|
||||||
|
{
|
||||||
|
if (_isInitialized)
|
||||||
|
{
|
||||||
|
Parent.Initialize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _minimized;
|
||||||
|
|
||||||
|
public bool Minimized
|
||||||
|
{
|
||||||
|
get => _minimized;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_minimized = value;
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Minimized)));
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(EditPositionEnabled)));
|
||||||
|
RedrawPreviewImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _maximized;
|
||||||
|
|
||||||
|
public bool Maximized
|
||||||
|
{
|
||||||
|
get => _maximized;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_maximized = value;
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Maximized)));
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(EditPositionEnabled)));
|
||||||
|
RedrawPreviewImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool EditPositionEnabled { get => !Minimized && !Maximized; }
|
||||||
|
|
||||||
|
private string _appMainParams;
|
||||||
|
|
||||||
|
public string AppMainParams
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
_appMainParams = _launchesAsAdmin ? Properties.Resources.Admin : string.Empty;
|
||||||
|
if (!string.IsNullOrWhiteSpace(CommandLineArguments))
|
||||||
|
{
|
||||||
|
_appMainParams += (_appMainParams == string.Empty ? string.Empty : " | ") + Properties.Resources.Args + ": " + CommandLineArguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsAppMainParamVisible)));
|
||||||
|
return _appMainParams;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsAppMainParamVisible { get => !string.IsNullOrWhiteSpace(_appMainParams); }
|
||||||
|
|
||||||
private bool _isNotFound;
|
private bool _isNotFound;
|
||||||
|
|
||||||
@@ -82,7 +155,7 @@ namespace ProjectsEditor.Models
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return RepeatIndex == 0 ? string.Empty : RepeatIndex.ToString(CultureInfo.InvariantCulture);
|
return RepeatIndex <= 1 ? string.Empty : RepeatIndex.ToString(CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +274,17 @@ namespace ProjectsEditor.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowPosition Position { get; set; }
|
private WindowPosition _position;
|
||||||
|
|
||||||
|
public WindowPosition Position
|
||||||
|
{
|
||||||
|
get => _position;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_position = value;
|
||||||
|
_scaledPosition = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private WindowPosition? _scaledPosition;
|
private WindowPosition? _scaledPosition;
|
||||||
|
|
||||||
@@ -247,6 +330,11 @@ namespace ProjectsEditor.Models
|
|||||||
PropertyChanged?.Invoke(this, e);
|
PropertyChanged?.Invoke(this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InitializationFinished()
|
||||||
|
{
|
||||||
|
_isInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
private bool? _isPackagedApp;
|
private bool? _isPackagedApp;
|
||||||
|
|
||||||
public string PackagedId { get; set; }
|
public string PackagedId { get; set; }
|
||||||
@@ -287,9 +375,62 @@ namespace ProjectsEditor.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool _isExpanded;
|
||||||
|
|
||||||
|
public bool IsExpanded
|
||||||
|
{
|
||||||
|
get => _isExpanded;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isExpanded != value)
|
||||||
|
{
|
||||||
|
_isExpanded = value;
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsExpanded)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string DeleteButtonContent { get => _isIncluded ? Properties.Resources.Delete : Properties.Resources.AddBack; }
|
||||||
|
|
||||||
|
private bool _isIncluded = true;
|
||||||
|
|
||||||
|
public bool IsIncluded
|
||||||
|
{
|
||||||
|
get => _isIncluded;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_isIncluded != value)
|
||||||
|
{
|
||||||
|
_isIncluded = value;
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsIncluded)));
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(DeleteButtonContent)));
|
||||||
|
if (!_isIncluded)
|
||||||
|
{
|
||||||
|
IsExpanded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void CommandLineTextChanged(string newCommandLineValue)
|
||||||
|
{
|
||||||
|
CommandLineArguments = newCommandLineValue;
|
||||||
|
OnPropertyChanged(new PropertyChangedEventArgs(nameof(AppMainParams)));
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void MaximizedChecked()
|
||||||
|
{
|
||||||
|
Minimized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void MinimizedChecked()
|
||||||
|
{
|
||||||
|
Maximized = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,20 +209,23 @@ namespace ProjectsEditor.Models
|
|||||||
Applications = new List<Application>();
|
Applications = new List<Application>();
|
||||||
foreach (var item in selectedProject.Applications)
|
foreach (var item in selectedProject.Applications)
|
||||||
{
|
{
|
||||||
Applications.Add(new Application()
|
Application newApp = new Application()
|
||||||
{
|
{
|
||||||
AppName = item.AppName,
|
AppName = item.AppName,
|
||||||
AppPath = item.AppPath,
|
AppPath = item.AppPath,
|
||||||
AppTitle = item.AppTitle,
|
AppTitle = item.AppTitle,
|
||||||
CommandLineArguments = item.CommandLineArguments,
|
CommandLineArguments = item.CommandLineArguments,
|
||||||
PackageFullName = item.PackageFullName,
|
PackageFullName = item.PackageFullName,
|
||||||
|
LaunchesAsAdmin = item.LaunchesAsAdmin,
|
||||||
Minimized = item.Minimized,
|
Minimized = item.Minimized,
|
||||||
Maximized = item.Maximized,
|
Maximized = item.Maximized,
|
||||||
MonitorNumber = item.MonitorNumber,
|
MonitorNumber = item.MonitorNumber,
|
||||||
IsNotFound = item.IsNotFound,
|
IsNotFound = item.IsNotFound,
|
||||||
Position = new Application.WindowPosition() { X = item.Position.X, Y = item.Position.Y, Height = item.Position.Height, Width = item.Position.Width },
|
Position = new Application.WindowPosition() { X = item.Position.X, Y = item.Position.Y, Height = item.Position.Height, Width = item.Position.Width },
|
||||||
Parent = this,
|
Parent = this,
|
||||||
});
|
};
|
||||||
|
newApp.InitializationFinished();
|
||||||
|
Applications.Add(newApp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,5 +307,13 @@ namespace ProjectsEditor.Models
|
|||||||
|
|
||||||
return new Rectangle((int)minX, (int)minY, (int)(maxX - minX), (int)(maxY - minY));
|
return new Rectangle((int)minX, (int)minY, (int)(maxX - minX), (int)(maxY - minY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void CloseExpanders()
|
||||||
|
{
|
||||||
|
foreach (Application app in Applications)
|
||||||
|
{
|
||||||
|
app.IsExpanded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,22 @@
|
|||||||
xmlns:props="clr-namespace:ProjectsEditor.Properties"
|
xmlns:props="clr-namespace:ProjectsEditor.Properties"
|
||||||
xmlns:local="clr-namespace:ProjectsEditor"
|
xmlns:local="clr-namespace:ProjectsEditor"
|
||||||
xmlns:models="clr-namespace:ProjectsEditor.Models"
|
xmlns:models="clr-namespace:ProjectsEditor.Models"
|
||||||
|
xmlns:controls="clr-namespace:ProjectsEditor.Controls"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Project Editor"
|
Title="Project Editor"
|
||||||
Background="{DynamicResource PrimaryBackgroundBrush}">
|
Background="{DynamicResource PrimaryBackgroundBrush}">
|
||||||
<Page.Resources>
|
<Page.Resources>
|
||||||
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
<BooleanToVisibilityConverter x:Key="BoolToVis" />
|
||||||
|
|
||||||
|
<Style x:Key="TextBlockEnabledStyle" TargetType="TextBlock">
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryForegroundBrush}" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsEnabled" Value="False" >
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource SecondaryForegroundBrush}" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<DataTemplate x:Key="headerTemplate">
|
<DataTemplate x:Key="headerTemplate">
|
||||||
<Border
|
<Border
|
||||||
HorizontalAlignment="Stretch">
|
HorizontalAlignment="Stretch">
|
||||||
@@ -29,81 +39,220 @@
|
|||||||
<Border
|
<Border
|
||||||
Background="{DynamicResource SecondaryBackgroundBrush}"
|
Background="{DynamicResource SecondaryBackgroundBrush}"
|
||||||
MouseEnter="AppBorder_MouseEnter"
|
MouseEnter="AppBorder_MouseEnter"
|
||||||
MouseLeave="AppBorder_MouseLeave">
|
MouseLeave="AppBorder_MouseLeave"
|
||||||
<Grid Margin="5">
|
Margin="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Expander
|
||||||
<ColumnDefinition Width="20"/>
|
Margin="0 0 20 0"
|
||||||
<ColumnDefinition Width="Auto"/>
|
FlowDirection="RightToLeft"
|
||||||
<ColumnDefinition Width="Auto"/>
|
IsExpanded="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
<ColumnDefinition Width="*"/>
|
IsEnabled="{Binding IsIncluded, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
|
||||||
<ColumnDefinition Width="3*"/>
|
<Expander.Header>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<Grid
|
||||||
</Grid.ColumnDefinitions>
|
FlowDirection="LeftToRight"
|
||||||
<TextBlock
|
HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource AncestorType=ContentPresenter}, Mode=OneWayToSource}">
|
||||||
Text=""
|
<Grid.ColumnDefinitions>
|
||||||
Foreground="#EED202"
|
<ColumnDefinition Width="20"/>
|
||||||
FontSize="14"
|
<ColumnDefinition Width="60"/>
|
||||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
<ColumnDefinition Width="20"/>
|
||||||
FontWeight="Normal"
|
<ColumnDefinition Width="*"/>
|
||||||
Margin="5 0 0 0"
|
<ColumnDefinition Width="Auto"/>
|
||||||
ToolTip="{x:Static props:Resources.NotFoundTooltip}"
|
</Grid.ColumnDefinitions>
|
||||||
Visibility="{Binding IsNotFound, Converter={StaticResource BoolToVis}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
<TextBlock
|
||||||
VerticalAlignment="Center"/>
|
Text=""
|
||||||
<Image
|
Foreground="#EED202"
|
||||||
Grid.Column="1"
|
FontSize="14"
|
||||||
Width="20"
|
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||||
Height="20"
|
FontWeight="Normal"
|
||||||
HorizontalAlignment="Center"
|
Margin="5 0 0 0"
|
||||||
VerticalAlignment="Center"
|
ToolTip="{x:Static props:Resources.NotFoundTooltip}"
|
||||||
Margin="10"
|
Visibility="{Binding IsNotFound, Converter={StaticResource BoolToVis}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
Source="{Binding IconBitmapImage}"/>
|
VerticalAlignment="Center"/>
|
||||||
<TextBlock
|
<Image
|
||||||
Grid.Column="2"
|
Grid.Column="1"
|
||||||
Text="{Binding RepeatIndexString, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
Width="20"
|
||||||
Foreground="{DynamicResource PrimaryForegroundBrush}"
|
Height="20"
|
||||||
FontSize="14"
|
HorizontalAlignment="Center"
|
||||||
FontWeight="Normal"
|
VerticalAlignment="Center"
|
||||||
Width="20"
|
Margin="10"
|
||||||
VerticalAlignment="Center"/>
|
Source="{Binding IconBitmapImage}"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="3"
|
Grid.Column="2"
|
||||||
Text="{Binding AppName}"
|
Text="{Binding RepeatIndexString, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
Foreground="{DynamicResource PrimaryForegroundBrush}"
|
Foreground="{DynamicResource PrimaryForegroundBrush}"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
FontWeight="Normal"
|
FontWeight="Normal"
|
||||||
VerticalAlignment="Center"/>
|
Width="20"
|
||||||
<TextBox
|
VerticalAlignment="Center"/>
|
||||||
x:Name="CommandLineTextBox"
|
<StackPanel
|
||||||
Grid.Column="4"
|
Grid.Column="3"
|
||||||
Text="{Binding CommandLineArguments, Mode=TwoWay}"
|
VerticalAlignment="Center">
|
||||||
Foreground="{DynamicResource PrimaryForegroundBrush}"
|
<TextBlock
|
||||||
Background="{DynamicResource TertiaryBackgroundBrush}"
|
Text="{Binding AppName}"
|
||||||
BorderThickness="0"
|
Foreground="{DynamicResource PrimaryForegroundBrush}"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
FontWeight="Normal"
|
FontWeight="Normal"
|
||||||
VerticalContentAlignment="Center" />
|
/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="4"
|
Text="{Binding AppMainParams, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
IsHitTestVisible="False"
|
Foreground="{DynamicResource SecondaryForegroundBrush}"
|
||||||
Text="{x:Static props:Resources.WriteArgs}"
|
Visibility="{Binding IsAppMainParamVisible, Converter={StaticResource BoolToVis}, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
Foreground="{DynamicResource SecondaryForegroundBrush}"
|
FontSize="12"
|
||||||
Background="{DynamicResource TertiaryBackgroundBrush}"
|
FontWeight="Normal"
|
||||||
FontSize="14"
|
/>
|
||||||
FontWeight="Normal"
|
</StackPanel>
|
||||||
VerticalAlignment="Center"
|
<controls:ResetIsEnabled
|
||||||
Margin="12,0,12,0">
|
Grid.Column="4">
|
||||||
<TextBlock.Style>
|
<Button
|
||||||
<Style TargetType="{x:Type TextBlock}">
|
Padding="24 6"
|
||||||
<Setter Property="Visibility" Value="Collapsed"/>
|
Margin="10 5"
|
||||||
<Style.Triggers>
|
Width="120"
|
||||||
<DataTrigger Binding="{Binding Text, ElementName=CommandLineTextBox}" Value="">
|
Content="{Binding DeleteButtonContent, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
<Setter Property="Visibility" Value="Visible"/>
|
Background="{DynamicResource TertiaryBackgroundBrush}"
|
||||||
</DataTrigger>
|
AutomationProperties.Name="{x:Static props:Resources.Delete}"
|
||||||
</Style.Triggers>
|
IsEnabled="True"
|
||||||
</Style>
|
Click="DeleteButtonClicked">
|
||||||
</TextBlock.Style>
|
</Button>
|
||||||
</TextBlock>
|
</controls:ResetIsEnabled>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</Expander.Header>
|
||||||
|
<Grid
|
||||||
|
FlowDirection="LeftToRight"
|
||||||
|
Margin="-20 0 0 0"
|
||||||
|
HorizontalAlignment="{Binding HorizontalAlignment, RelativeSource={RelativeSource AncestorType=ContentPresenter}, Mode=OneWayToSource}"
|
||||||
|
Background="{DynamicResource QuaternaryBackgroundBrush}">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<DockPanel
|
||||||
|
Margin="100 5 0 0">
|
||||||
|
<TextBlock
|
||||||
|
Text="{x:Static props:Resources.CliArguments}"
|
||||||
|
Foreground="{DynamicResource PrimaryForegroundBrush}"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
<TextBox
|
||||||
|
Margin="15 0 50 0"
|
||||||
|
x:Name="CommandLineTextBox"
|
||||||
|
Text="{Binding CommandLineArguments, Mode=TwoWay}"
|
||||||
|
Foreground="{DynamicResource PrimaryForegroundBrush}"
|
||||||
|
Background="{DynamicResource TertiaryBackgroundBrush}"
|
||||||
|
BorderThickness="0"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
TextChanged="CommandLineTextBox_TextChanged"/>
|
||||||
|
</DockPanel>
|
||||||
|
<StackPanel
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Grid.Row="1"
|
||||||
|
Margin="100 5 0 0">
|
||||||
|
<CheckBox
|
||||||
|
Content="{x:Static props:Resources.LaunchAsAdmin}"
|
||||||
|
IsChecked="{Binding LaunchesAsAdmin, Mode=TwoWay}"
|
||||||
|
MinWidth="10"/>
|
||||||
|
<CheckBox
|
||||||
|
Margin="15 0 0 0"
|
||||||
|
Content="{x:Static props:Resources.Maximized}"
|
||||||
|
IsChecked="{Binding Maximized, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
MinWidth="10"
|
||||||
|
Checked="MaximizedChecked"/>
|
||||||
|
<CheckBox
|
||||||
|
Margin="15 0 0 0"
|
||||||
|
Content="{x:Static props:Resources.Minimized}"
|
||||||
|
IsChecked="{Binding Minimized, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
MinWidth="10"
|
||||||
|
Checked="MinimizedChecked"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Grid.Row="2"
|
||||||
|
Margin="100 5 0 0">
|
||||||
|
<TextBlock
|
||||||
|
Style="{StaticResource TextBlockEnabledStyle}"
|
||||||
|
Text="{x:Static props:Resources.Left}"
|
||||||
|
IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
<TextBox
|
||||||
|
Margin="15 0 0 0"
|
||||||
|
x:Name="LeftTextBox"
|
||||||
|
Text="{Binding Position.X, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Background="{DynamicResource TertiaryBackgroundBrush}"
|
||||||
|
BorderThickness="0"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
TextChanged="LeftTextBox_TextChanged"/>
|
||||||
|
<TextBlock
|
||||||
|
Text="{x:Static props:Resources.Top}"
|
||||||
|
Margin="15 0 0 0"
|
||||||
|
Style="{StaticResource TextBlockEnabledStyle}"
|
||||||
|
IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
<TextBox
|
||||||
|
Margin="15 0 0 0"
|
||||||
|
x:Name="TopTextBox"
|
||||||
|
Text="{Binding Position.Y, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Background="{DynamicResource TertiaryBackgroundBrush}"
|
||||||
|
BorderThickness="0"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
TextChanged="TopTextBox_TextChanged"/>
|
||||||
|
<TextBlock
|
||||||
|
Text="{x:Static props:Resources.Width}"
|
||||||
|
Margin="15 0 0 0"
|
||||||
|
Style="{StaticResource TextBlockEnabledStyle}"
|
||||||
|
IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
<TextBox
|
||||||
|
Margin="15 0 0 0"
|
||||||
|
x:Name="WidthTextBox"
|
||||||
|
Text="{Binding Position.Width, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Background="{DynamicResource TertiaryBackgroundBrush}"
|
||||||
|
BorderThickness="0"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
TextChanged="WidthTextBox_TextChanged"/>
|
||||||
|
<TextBlock
|
||||||
|
Text="{x:Static props:Resources.Height}"
|
||||||
|
Margin="15 0 0 0"
|
||||||
|
Style="{StaticResource TextBlockEnabledStyle}"
|
||||||
|
IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalAlignment="Center" />
|
||||||
|
<TextBox
|
||||||
|
Margin="15 0 0 0"
|
||||||
|
x:Name="HeightTextBox"
|
||||||
|
Text="{Binding Position.Height, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
IsEnabled="{Binding EditPositionEnabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Background="{DynamicResource TertiaryBackgroundBrush}"
|
||||||
|
BorderThickness="0"
|
||||||
|
FontSize="14"
|
||||||
|
FontWeight="Normal"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
|
TextChanged="HeightTextBox_TextChanged"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Expander>
|
||||||
</Border>
|
</Border>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<models:AppListDataTemplateSelector
|
<models:AppListDataTemplateSelector
|
||||||
|
|||||||
@@ -27,7 +27,9 @@ namespace ProjectsEditor
|
|||||||
|
|
||||||
private void SaveButtonClicked(object sender, RoutedEventArgs e)
|
private void SaveButtonClicked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
_mainViewModel.SwitchToMainView();
|
||||||
Project projectToSave = this.DataContext as Project;
|
Project projectToSave = this.DataContext as Project;
|
||||||
|
projectToSave.CloseExpanders();
|
||||||
if (projectToSave.EditorWindowTitle == Properties.Resources.CreateProject)
|
if (projectToSave.EditorWindowTitle == Properties.Resources.CreateProject)
|
||||||
{
|
{
|
||||||
_mainViewModel.AddNewProject(projectToSave);
|
_mainViewModel.AddNewProject(projectToSave);
|
||||||
@@ -36,8 +38,6 @@ namespace ProjectsEditor
|
|||||||
{
|
{
|
||||||
_mainViewModel.SaveProject(projectToSave);
|
_mainViewModel.SaveProject(projectToSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
_mainViewModel.SwitchToMainView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CancelButtonClicked(object sender, RoutedEventArgs e)
|
private void CancelButtonClicked(object sender, RoutedEventArgs e)
|
||||||
@@ -49,13 +49,21 @@ namespace ProjectsEditor
|
|||||||
_mainViewModel.SwitchToMainView();
|
_mainViewModel.SwitchToMainView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DeleteButtonClicked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Button button = sender as Button;
|
||||||
|
Models.Application app = button.DataContext as Models.Application;
|
||||||
|
app.SwitchDeletion();
|
||||||
|
}
|
||||||
|
|
||||||
private void EditNameTextBoxKeyDown(object sender, KeyEventArgs e)
|
private void EditNameTextBoxKeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Key == Key.Enter)
|
if (e.Key == Key.Enter)
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
Project project = this.DataContext as Project;
|
Project project = this.DataContext as Project;
|
||||||
project.Name = EditNameTextBox.Text;
|
TextBox textBox = sender as TextBox;
|
||||||
|
project.Name = textBox.Text;
|
||||||
}
|
}
|
||||||
else if (e.Key == Key.Escape)
|
else if (e.Key == Key.Escape)
|
||||||
{
|
{
|
||||||
@@ -91,8 +99,90 @@ namespace ProjectsEditor
|
|||||||
private void EditNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
private void EditNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
Project project = this.DataContext as Project;
|
Project project = this.DataContext as Project;
|
||||||
project.Name = EditNameTextBox.Text;
|
TextBox textBox = sender as TextBox;
|
||||||
|
project.Name = textBox.Text;
|
||||||
project.OnPropertyChanged(new PropertyChangedEventArgs(nameof(Project.CanBeSaved)));
|
project.OnPropertyChanged(new PropertyChangedEventArgs(nameof(Project.CanBeSaved)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LeftTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
TextBox textBox = sender as TextBox;
|
||||||
|
Models.Application application = textBox.DataContext as Models.Application;
|
||||||
|
int newPos;
|
||||||
|
if (!int.TryParse(textBox.Text, out newPos))
|
||||||
|
{
|
||||||
|
newPos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
application.Position = new Models.Application.WindowPosition() { X = newPos, Y = application.Position.Y, Width = application.Position.Width, Height = application.Position.Height };
|
||||||
|
Project project = application.Parent;
|
||||||
|
project.Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TopTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
TextBox textBox = sender as TextBox;
|
||||||
|
Models.Application application = textBox.DataContext as Models.Application;
|
||||||
|
int newPos;
|
||||||
|
if (!int.TryParse(textBox.Text, out newPos))
|
||||||
|
{
|
||||||
|
newPos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
application.Position = new Models.Application.WindowPosition() { X = application.Position.X, Y = newPos, Width = application.Position.Width, Height = application.Position.Height };
|
||||||
|
Project project = application.Parent;
|
||||||
|
project.Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WidthTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
TextBox textBox = sender as TextBox;
|
||||||
|
Models.Application application = textBox.DataContext as Models.Application;
|
||||||
|
int newPos;
|
||||||
|
if (!int.TryParse(textBox.Text, out newPos))
|
||||||
|
{
|
||||||
|
newPos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
application.Position = new Models.Application.WindowPosition() { X = application.Position.X, Y = application.Position.Y, Width = newPos, Height = application.Position.Height };
|
||||||
|
Project project = application.Parent;
|
||||||
|
project.Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HeightTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
TextBox textBox = sender as TextBox;
|
||||||
|
Models.Application application = textBox.DataContext as Models.Application;
|
||||||
|
int newPos;
|
||||||
|
if (!int.TryParse(textBox.Text, out newPos))
|
||||||
|
{
|
||||||
|
newPos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
application.Position = new Models.Application.WindowPosition() { X = application.Position.X, Y = application.Position.Y, Width = application.Position.Width, Height = newPos };
|
||||||
|
Project project = application.Parent;
|
||||||
|
project.Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CommandLineTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
TextBox textBox = sender as TextBox;
|
||||||
|
Models.Application application = textBox.DataContext as Models.Application;
|
||||||
|
application.CommandLineTextChanged(textBox.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MaximizedChecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckBox checkBox = sender as CheckBox;
|
||||||
|
Models.Application application = checkBox.DataContext as Models.Application;
|
||||||
|
application.MaximizedChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MinimizedChecked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
CheckBox checkBox = sender as CheckBox;
|
||||||
|
Models.Application application = checkBox.DataContext as Models.Application;
|
||||||
|
application.MinimizedChecked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,24 @@ namespace ProjectsEditor.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Add Back.
|
||||||
|
/// </summary>
|
||||||
|
public static string AddBack {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AddBack", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Admin.
|
||||||
|
/// </summary>
|
||||||
|
public static string Admin {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Admin", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to app.
|
/// Looks up a localized string similar to app.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -105,6 +123,15 @@ namespace ProjectsEditor.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Args.
|
||||||
|
/// </summary>
|
||||||
|
public static string Args {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Args", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Cancel.
|
/// Looks up a localized string similar to Cancel.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -114,6 +141,15 @@ namespace ProjectsEditor.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to CLI arguments.
|
||||||
|
/// </summary>
|
||||||
|
public static string CliArguments {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("CliArguments", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Created.
|
/// Looks up a localized string similar to Created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -222,6 +258,15 @@ namespace ProjectsEditor.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Height.
|
||||||
|
/// </summary>
|
||||||
|
public static string Height {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Height", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to hours ago.
|
/// Looks up a localized string similar to hours ago.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -258,6 +303,24 @@ namespace ProjectsEditor.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Launch as Admin.
|
||||||
|
/// </summary>
|
||||||
|
public static string LaunchAsAdmin {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("LaunchAsAdmin", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Left.
|
||||||
|
/// </summary>
|
||||||
|
public static string Left {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Left", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Projects demo app.
|
/// Looks up a localized string similar to Projects demo app.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -267,6 +330,24 @@ namespace ProjectsEditor.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Maximized.
|
||||||
|
/// </summary>
|
||||||
|
public static string Maximized {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Maximized", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Minimized.
|
||||||
|
/// </summary>
|
||||||
|
public static string Minimized {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Minimized", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Minimized Apps.
|
/// Looks up a localized string similar to Minimized Apps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -528,6 +609,24 @@ namespace ProjectsEditor.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Top.
|
||||||
|
/// </summary>
|
||||||
|
public static string Top {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Top", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Width.
|
||||||
|
/// </summary>
|
||||||
|
public static string Width {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Width", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Write arguments here.
|
/// Looks up a localized string similar to Write arguments here.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -117,6 +117,12 @@
|
|||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<data name="AddBack" xml:space="preserve">
|
||||||
|
<value>Add Back</value>
|
||||||
|
</data>
|
||||||
|
<data name="Admin" xml:space="preserve">
|
||||||
|
<value>Admin</value>
|
||||||
|
</data>
|
||||||
<data name="App" xml:space="preserve">
|
<data name="App" xml:space="preserve">
|
||||||
<value>app</value>
|
<value>app</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -132,9 +138,16 @@
|
|||||||
<data name="Are_You_Sure_Description" xml:space="preserve">
|
<data name="Are_You_Sure_Description" xml:space="preserve">
|
||||||
<value>Are you sure you want to delete this project?</value>
|
<value>Are you sure you want to delete this project?</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Args" xml:space="preserve">
|
||||||
|
<value>Args</value>
|
||||||
|
<comment>Arguments</comment>
|
||||||
|
</data>
|
||||||
<data name="Cancel" xml:space="preserve">
|
<data name="Cancel" xml:space="preserve">
|
||||||
<value>Cancel</value>
|
<value>Cancel</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="CliArguments" xml:space="preserve">
|
||||||
|
<value>CLI arguments</value>
|
||||||
|
</data>
|
||||||
<data name="Created" xml:space="preserve">
|
<data name="Created" xml:space="preserve">
|
||||||
<value>Created</value>
|
<value>Created</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -171,6 +184,9 @@
|
|||||||
<data name="Error_Parsing_Message" xml:space="preserve">
|
<data name="Error_Parsing_Message" xml:space="preserve">
|
||||||
<value>Error parsing projects data.</value>
|
<value>Error parsing projects data.</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Height" xml:space="preserve">
|
||||||
|
<value>Height</value>
|
||||||
|
</data>
|
||||||
<data name="HoursAgo" xml:space="preserve">
|
<data name="HoursAgo" xml:space="preserve">
|
||||||
<value>hours ago</value>
|
<value>hours ago</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -180,12 +196,25 @@
|
|||||||
<data name="Launch" xml:space="preserve">
|
<data name="Launch" xml:space="preserve">
|
||||||
<value>Launch</value>
|
<value>Launch</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LaunchAsAdmin" xml:space="preserve">
|
||||||
|
<value>Launch as Admin</value>
|
||||||
|
</data>
|
||||||
<data name="Launch_args" xml:space="preserve">
|
<data name="Launch_args" xml:space="preserve">
|
||||||
<value>Launch args</value>
|
<value>Launch args</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Left" xml:space="preserve">
|
||||||
|
<value>Left</value>
|
||||||
|
<comment>the left x coordinate</comment>
|
||||||
|
</data>
|
||||||
<data name="MainTitle" xml:space="preserve">
|
<data name="MainTitle" xml:space="preserve">
|
||||||
<value>Projects demo app</value>
|
<value>Projects demo app</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Maximized" xml:space="preserve">
|
||||||
|
<value>Maximized</value>
|
||||||
|
</data>
|
||||||
|
<data name="Minimized" xml:space="preserve">
|
||||||
|
<value>Minimized</value>
|
||||||
|
</data>
|
||||||
<data name="Minimized_Apps" xml:space="preserve">
|
<data name="Minimized_Apps" xml:space="preserve">
|
||||||
<value>Minimized Apps</value>
|
<value>Minimized Apps</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -273,6 +302,13 @@
|
|||||||
<data name="Take_Snapshot" xml:space="preserve">
|
<data name="Take_Snapshot" xml:space="preserve">
|
||||||
<value>Capture</value>
|
<value>Capture</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Top" xml:space="preserve">
|
||||||
|
<value>Top</value>
|
||||||
|
<comment>the top y coordinate</comment>
|
||||||
|
</data>
|
||||||
|
<data name="Width" xml:space="preserve">
|
||||||
|
<value>Width</value>
|
||||||
|
</data>
|
||||||
<data name="WriteArgs" xml:space="preserve">
|
<data name="WriteArgs" xml:space="preserve">
|
||||||
<value>Write arguments here</value>
|
<value>Write arguments here</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FF242424" />
|
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FF242424" />
|
||||||
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FF2b2b2b" />
|
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FF2b2b2b" />
|
||||||
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FF373737" />
|
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FF373737" />
|
||||||
|
<SolidColorBrush x:Key="QuaternaryBackgroundBrush" Color="#FF272727" />
|
||||||
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
||||||
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FFFFFFFF" />
|
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FFFFFFFF" />
|
||||||
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF9a9a9a" />
|
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF9a9a9a" />
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FF242424" />
|
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FF242424" />
|
||||||
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FF1c1c1c" />
|
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FF1c1c1c" />
|
||||||
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FF202020" />
|
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FF202020" />
|
||||||
|
<SolidColorBrush x:Key="QuaternaryBackgroundBrush" Color="#FF272727" />
|
||||||
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
||||||
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FFffff00" />
|
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FFffff00" />
|
||||||
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF00ff00" />
|
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF00ff00" />
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FF242424" />
|
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FF242424" />
|
||||||
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FF1c1c1c" />
|
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FF1c1c1c" />
|
||||||
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FF202020" />
|
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FF202020" />
|
||||||
|
<SolidColorBrush x:Key="QuaternaryBackgroundBrush" Color="#FF272727" />
|
||||||
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
||||||
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FFffff00" />
|
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FFffff00" />
|
||||||
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FFc0c0c0" />
|
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FFc0c0c0" />
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FF242424" />
|
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FF242424" />
|
||||||
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FF1c1c1c" />
|
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FF1c1c1c" />
|
||||||
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FF202020" />
|
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FF202020" />
|
||||||
|
<SolidColorBrush x:Key="QuaternaryBackgroundBrush" Color="#FF272727" />
|
||||||
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
||||||
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FFffffff" />
|
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FFffffff" />
|
||||||
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF1aebff" />
|
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF1aebff" />
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FFf9f9f9" />
|
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FFf9f9f9" />
|
||||||
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FFeeeeee" />
|
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FFeeeeee" />
|
||||||
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FFF3F3F3" />
|
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FFF3F3F3" />
|
||||||
|
<SolidColorBrush x:Key="QuaternaryBackgroundBrush" Color="#FFf6f6f6" />
|
||||||
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FF161616" />
|
||||||
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FF000000" />
|
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FF000000" />
|
||||||
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF37006e" />
|
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF37006e" />
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FFf3f3f3" />
|
<SolidColorBrush x:Key="PrimaryBackgroundBrush" Color="#FFf3f3f3" />
|
||||||
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FFfbfbfb" />
|
<SolidColorBrush x:Key="SecondaryBackgroundBrush" Color="#FFfbfbfb" />
|
||||||
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FFfefefe" />
|
<SolidColorBrush x:Key="TertiaryBackgroundBrush" Color="#FFfefefe" />
|
||||||
|
<SolidColorBrush x:Key="QuaternaryBackgroundBrush" Color="#FFf6f6f6" />
|
||||||
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FFF9F9F9" />
|
<SolidColorBrush x:Key="MonitorViewBackgroundBrush" Color="#FFF9F9F9" />
|
||||||
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FF191919" />
|
<SolidColorBrush x:Key="PrimaryForegroundBrush" Color="#FF191919" />
|
||||||
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF6A6A6A" />
|
<SolidColorBrush x:Key="SecondaryForegroundBrush" Color="#FF6A6A6A" />
|
||||||
|
|||||||
@@ -14,21 +14,24 @@ using System.Linq;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
using ProjectsEditor.Models;
|
using ProjectsEditor.Models;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TextBox;
|
||||||
|
|
||||||
namespace ProjectsEditor.Utils
|
namespace ProjectsEditor.Utils
|
||||||
{
|
{
|
||||||
public class DrawHelper
|
public class DrawHelper
|
||||||
{
|
{
|
||||||
private static Font font = new("Tahoma", 24);
|
private static Font font = new("Tahoma", 24);
|
||||||
|
private static double scale = 0.1;
|
||||||
|
private static double gapWidth;
|
||||||
|
private static double gapHeight;
|
||||||
|
|
||||||
public static BitmapImage DrawPreview(Project project, Rectangle bounds)
|
public static BitmapImage DrawPreview(Project project, Rectangle bounds)
|
||||||
{
|
{
|
||||||
List<double> horizontalGaps = new List<double>();
|
List<double> horizontalGaps = new List<double>();
|
||||||
List<double> verticalGaps = new List<double>();
|
List<double> verticalGaps = new List<double>();
|
||||||
double gapWidth = bounds.Width * 0.01;
|
gapWidth = bounds.Width * 0.01;
|
||||||
double gapHeight = bounds.Height * 0.01;
|
gapHeight = bounds.Height * 0.01;
|
||||||
|
|
||||||
double scale = 0.1;
|
|
||||||
int Scaled(double value)
|
int Scaled(double value)
|
||||||
{
|
{
|
||||||
return (int)(value * scale);
|
return (int)(value * scale);
|
||||||
@@ -46,9 +49,25 @@ namespace ProjectsEditor.Utils
|
|||||||
return Scaled(posY - bounds.Top + gapTransform);
|
return Scaled(posY - bounds.Top + gapTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle GetAppRect(Application app)
|
||||||
|
{
|
||||||
|
if (app.Maximized)
|
||||||
|
{
|
||||||
|
Project project = app.Parent;
|
||||||
|
var monitor = project.Monitors.Where(x => x.MonitorNumber == app.MonitorNumber).FirstOrDefault();
|
||||||
|
return new Rectangle(TransformX(monitor.MonitorDpiAwareBounds.Left), TransformY(monitor.MonitorDpiAwareBounds.Top), Scaled(monitor.MonitorDpiAwareBounds.Width), Scaled(monitor.MonitorDpiAwareBounds.Height));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Rectangle(TransformX(app.ScaledPosition.X), TransformY(app.ScaledPosition.Y), Scaled(app.ScaledPosition.Width), Scaled(app.ScaledPosition.Height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<string, int> repeatCounter = new Dictionary<string, int>();
|
Dictionary<string, int> repeatCounter = new Dictionary<string, int>();
|
||||||
|
|
||||||
foreach (Application app in project.Applications)
|
var appsIncluded = project.Applications.Where(x => x.IsIncluded);
|
||||||
|
|
||||||
|
foreach (Application app in appsIncluded)
|
||||||
{
|
{
|
||||||
if (repeatCounter.TryGetValue(app.AppPath, out int value))
|
if (repeatCounter.TryGetValue(app.AppPath, out int value))
|
||||||
{
|
{
|
||||||
@@ -62,13 +81,7 @@ namespace ProjectsEditor.Utils
|
|||||||
app.RepeatIndex = repeatCounter[app.AppPath];
|
app.RepeatIndex = repeatCounter[app.AppPath];
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove those repeatIndexes, which are single 1-es (no repetitions) by setting them to 0
|
foreach (Application app in project.Applications.Where(x => !x.IsIncluded))
|
||||||
foreach (Application app in project.Applications.Where(x => repeatCounter[x.AppPath] == 1))
|
|
||||||
{
|
|
||||||
app.RepeatIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (Application app in project.Applications)
|
|
||||||
{
|
{
|
||||||
app.RepeatIndex = 0;
|
app.RepeatIndex = 0;
|
||||||
}
|
}
|
||||||
@@ -112,18 +125,18 @@ namespace ProjectsEditor.Utils
|
|||||||
g.FillRectangle(monitorBrush, new Rectangle(TransformX(monitor.MonitorDpiAwareBounds.Left), TransformY(monitor.MonitorDpiAwareBounds.Top), Scaled(monitor.MonitorDpiAwareBounds.Width), Scaled(monitor.MonitorDpiAwareBounds.Height)));
|
g.FillRectangle(monitorBrush, new Rectangle(TransformX(monitor.MonitorDpiAwareBounds.Left), TransformY(monitor.MonitorDpiAwareBounds.Top), Scaled(monitor.MonitorDpiAwareBounds.Width), Scaled(monitor.MonitorDpiAwareBounds.Height)));
|
||||||
}
|
}
|
||||||
|
|
||||||
var appsToDraw = project.Applications.Where(x => !x.Minimized);
|
var appsToDraw = appsIncluded.Where(x => !x.Minimized);
|
||||||
|
|
||||||
// draw the highlighted app at the end to have its icon in the foreground for the case there are overlapping icons
|
// draw the highlighted app at the end to have its icon in the foreground for the case there are overlapping icons
|
||||||
foreach (Application app in appsToDraw.Where(x => !x.IsHighlighted))
|
foreach (Application app in appsToDraw.Where(x => !x.IsHighlighted))
|
||||||
{
|
{
|
||||||
Rectangle rect = new Rectangle(TransformX(app.ScaledPosition.X), TransformY(app.ScaledPosition.Y), Scaled(app.ScaledPosition.Width), Scaled(app.ScaledPosition.Height));
|
Rectangle rect = GetAppRect(app);
|
||||||
DrawWindow(g, brush, rect, app, desiredIconSize);
|
DrawWindow(g, brush, rect, app, desiredIconSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Application app in appsToDraw.Where(x => x.IsHighlighted))
|
foreach (Application app in appsToDraw.Where(x => x.IsHighlighted))
|
||||||
{
|
{
|
||||||
Rectangle rect = new Rectangle(TransformX(app.ScaledPosition.X), TransformY(app.ScaledPosition.Y), Scaled(app.ScaledPosition.Width), Scaled(app.ScaledPosition.Height));
|
Rectangle rect = GetAppRect(app);
|
||||||
DrawWindow(g, brushForHighlight, rect, app, desiredIconSize);
|
DrawWindow(g, brushForHighlight, rect, app, desiredIconSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +193,7 @@ namespace ProjectsEditor.Utils
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
graphics.DrawIcon(app.Icon, iconBounds);
|
graphics.DrawIcon(app.Icon, iconBounds);
|
||||||
if (app.RepeatIndex > 0)
|
if (app.RepeatIndex > 1)
|
||||||
{
|
{
|
||||||
string indexString = app.RepeatIndex.ToString(CultureInfo.InvariantCulture);
|
string indexString = app.RepeatIndex.ToString(CultureInfo.InvariantCulture);
|
||||||
int indexSize = (int)(iconBounds.Width * 0.5);
|
int indexSize = (int)(iconBounds.Width * 0.5);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using ManagedCommon;
|
using ManagedCommon;
|
||||||
using ProjectsEditor.Data;
|
using ProjectsEditor.Data;
|
||||||
@@ -85,7 +86,7 @@ namespace ProjectsEditor.Utils
|
|||||||
|
|
||||||
foreach (var app in project.Applications)
|
foreach (var app in project.Applications)
|
||||||
{
|
{
|
||||||
newProject.Applications.Add(new Models.Application()
|
Models.Application newApp = new Models.Application()
|
||||||
{
|
{
|
||||||
AppName = app.Application,
|
AppName = app.Application,
|
||||||
AppPath = app.ApplicationPath,
|
AppPath = app.ApplicationPath,
|
||||||
@@ -93,6 +94,7 @@ namespace ProjectsEditor.Utils
|
|||||||
PackageFullName = app.PackageFullName,
|
PackageFullName = app.PackageFullName,
|
||||||
Parent = newProject,
|
Parent = newProject,
|
||||||
CommandLineArguments = app.CommandLineArguments,
|
CommandLineArguments = app.CommandLineArguments,
|
||||||
|
LaunchesAsAdmin = app.LaunchesAsAdmin,
|
||||||
Maximized = app.Maximized,
|
Maximized = app.Maximized,
|
||||||
Minimized = app.Minimized,
|
Minimized = app.Minimized,
|
||||||
IsNotFound = false,
|
IsNotFound = false,
|
||||||
@@ -104,7 +106,9 @@ namespace ProjectsEditor.Utils
|
|||||||
Y = app.Position.Y,
|
Y = app.Position.Y,
|
||||||
},
|
},
|
||||||
MonitorNumber = app.Monitor,
|
MonitorNumber = app.Monitor,
|
||||||
});
|
};
|
||||||
|
newApp.InitializationFinished();
|
||||||
|
newProject.Applications.Add(newApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var monitor in project.MonitorConfiguration)
|
foreach (var monitor in project.MonitorConfiguration)
|
||||||
@@ -136,7 +140,7 @@ namespace ProjectsEditor.Utils
|
|||||||
MonitorConfiguration = new List<ProjectData.MonitorConfigurationWrapper> { },
|
MonitorConfiguration = new List<ProjectData.MonitorConfigurationWrapper> { },
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var app in project.Applications)
|
foreach (var app in project.Applications.Where(x => x.IsIncluded))
|
||||||
{
|
{
|
||||||
wrapper.Applications.Add(new ProjectData.ApplicationWrapper
|
wrapper.Applications.Add(new ProjectData.ApplicationWrapper
|
||||||
{
|
{
|
||||||
@@ -145,6 +149,7 @@ namespace ProjectsEditor.Utils
|
|||||||
Title = app.AppTitle,
|
Title = app.AppTitle,
|
||||||
PackageFullName = app.PackageFullName,
|
PackageFullName = app.PackageFullName,
|
||||||
CommandLineArguments = app.CommandLineArguments,
|
CommandLineArguments = app.CommandLineArguments,
|
||||||
|
LaunchesAsAdmin = app.LaunchesAsAdmin,
|
||||||
Maximized = app.Maximized,
|
Maximized = app.Maximized,
|
||||||
Minimized = app.Minimized,
|
Minimized = app.Minimized,
|
||||||
Position = new ProjectData.ApplicationWrapper.WindowPositionWrapper
|
Position = new ProjectData.ApplicationWrapper.WindowPositionWrapper
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace ProjectsEditor.ViewModels
|
|||||||
editedProject.IsShortcutNeeded = projectToSave.IsShortcutNeeded;
|
editedProject.IsShortcutNeeded = projectToSave.IsShortcutNeeded;
|
||||||
editedProject.PreviewIcons = projectToSave.PreviewIcons;
|
editedProject.PreviewIcons = projectToSave.PreviewIcons;
|
||||||
editedProject.PreviewImage = projectToSave.PreviewImage;
|
editedProject.PreviewImage = projectToSave.PreviewImage;
|
||||||
editedProject.Applications = projectToSave.Applications;
|
editedProject.Applications = projectToSave.Applications.Where(x => x.IsIncluded).ToList();
|
||||||
|
|
||||||
editedProject.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("AppsCountString"));
|
editedProject.OnPropertyChanged(new System.ComponentModel.PropertyChangedEventArgs("AppsCountString"));
|
||||||
editedProject.Initialize();
|
editedProject.Initialize();
|
||||||
@@ -233,7 +233,12 @@ namespace ProjectsEditor.ViewModels
|
|||||||
public void EditProject(Project selectedProject, bool isNewlyCreated = false)
|
public void EditProject(Project selectedProject, bool isNewlyCreated = false)
|
||||||
{
|
{
|
||||||
var editPage = new ProjectEditor(this);
|
var editPage = new ProjectEditor(this);
|
||||||
|
|
||||||
SetEditedProject(selectedProject);
|
SetEditedProject(selectedProject);
|
||||||
|
if (!isNewlyCreated)
|
||||||
|
{
|
||||||
|
selectedProject = new Project(selectedProject);
|
||||||
|
}
|
||||||
|
|
||||||
if (isNewlyCreated)
|
if (isNewlyCreated)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user