mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 19:27:56 +01:00
Merge branch 'dev/feature/projects' of https://github.com/microsoft/PowerToys into dev/feature/projects
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
ui:TitleBar.IsIconVisible="True"
|
||||
ui:WindowHelper.UseModernWindowStyle="True"
|
||||
MinWidth="700"
|
||||
MinHeight="480"
|
||||
MinHeight="680"
|
||||
AutomationProperties.Name="Projects Editor"
|
||||
Closing="OnClosing"
|
||||
ContentRendered="OnContentRendered"
|
||||
|
||||
@@ -21,11 +21,6 @@ namespace ProjectsEditor.Models
|
||||
{
|
||||
public class Project : INotifyPropertyChanged
|
||||
{
|
||||
public class ScreenHeader : Application
|
||||
{
|
||||
public string Title { get; set; }
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string EditorWindowTitle { get; set; }
|
||||
|
||||
@@ -44,6 +39,7 @@ namespace ProjectsEditor.Models
|
||||
{
|
||||
_name = value;
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(Name)));
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(nameof(CanBeSaved)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +119,11 @@ namespace ProjectsEditor.Models
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanBeSaved
|
||||
{
|
||||
get => Name.Length > 0 && Applications.Where(x => x.IsSelected).Any();
|
||||
}
|
||||
|
||||
private bool _isPopupVisible;
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -145,6 +145,7 @@
|
||||
Margin="0,6,0,6"
|
||||
HorizontalAlignment="Left"
|
||||
GotFocus="EditNameTextBox_GotFocus"
|
||||
TextChanged="EditNameTextBox_TextChanged"
|
||||
KeyDown="EditNameTextBoxKeyDown" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
@@ -235,6 +236,7 @@
|
||||
Margin="20,0,0,0"
|
||||
Padding="24,0,24,0"
|
||||
Height="36"
|
||||
IsEnabled="{Binding CanBeSaved, UpdateSourceTrigger=PropertyChanged}"
|
||||
Content="{x:Static props:Resources.Save_project}"
|
||||
AutomationProperties.Name="{x:Static props:Resources.Save_project}"
|
||||
Click="SaveButtonClicked"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// 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.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
@@ -28,6 +29,7 @@ namespace ProjectsEditor
|
||||
CheckBox checkBox = sender as CheckBox;
|
||||
Models.Application application = checkBox.DataContext as Models.Application;
|
||||
Models.Project project = application.Parent;
|
||||
project.OnPropertyChanged(new PropertyChangedEventArgs(nameof(Project.CanBeSaved)));
|
||||
project.Initialize();
|
||||
}
|
||||
|
||||
@@ -82,5 +84,12 @@ namespace ProjectsEditor
|
||||
Project project = app.Parent;
|
||||
project.Initialize();
|
||||
}
|
||||
|
||||
private void EditNameTextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
Project project = this.DataContext as Project;
|
||||
project.Name = EditNameTextBox.Text;
|
||||
project.OnPropertyChanged(new PropertyChangedEventArgs(nameof(Project.CanBeSaved)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user