mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixes for project manager
This commit is contained in:
@ -34,7 +34,6 @@
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@ -43,18 +42,14 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Text="{x:Static r:Strings.CreateDocumentDialog_Name}" />
|
||||
<TextBox Name="textPath" Grid.Row="0" Grid.Column="1" Margin="1px"></TextBox>
|
||||
|
||||
<TextBlock Grid.Row="1">Path:</TextBlock>
|
||||
<TextBox Name="textPath1" Grid.Row="1" Grid.Column="1" Margin="1px"></TextBox>
|
||||
<Button Grid.Row="1" Grid.Column="2">...</Button>
|
||||
<TextBox Name="textName" Grid.Row="0" Grid.Column="1" Margin="1px" TextChanged="textName_TextChanged"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Name="buttonCreate" Click="buttonCreate_Click" IsDefault="True" Margin="1px">Create</Button>
|
||||
<Button Name="buttonCancel" Click="buttonCancel_Click" IsCancel="True" Margin="1px">Cancel</Button>
|
||||
<Button Name="buttonCreate" Content="{x:Static r:Strings.Dialog_Create}" IsDefault="True" Margin="1px" Click="buttonCreate_Click" />
|
||||
<Button Name="buttonCancel" Content="{x:Static r:Strings.Dialog_Cancel}" IsCancel="True" Margin="1px" Click="buttonCancel_Click" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using RainmeterStudio.Core.Utils;
|
||||
using RainmeterStudio.UI.Controller;
|
||||
using RainmeterStudio.UI.ViewModel;
|
||||
|
||||
@ -32,15 +33,15 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
/// <summary>
|
||||
/// Gets or sets the path
|
||||
/// </summary>
|
||||
public string SelectedPath
|
||||
public string SelectedName
|
||||
{
|
||||
get
|
||||
{
|
||||
return textPath.Text;
|
||||
return textName.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
textPath.Text = value;
|
||||
textName.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,13 +53,9 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
InitializeComponent();
|
||||
_documentController = docCtrl;
|
||||
|
||||
PopulateFormats();
|
||||
Validate();
|
||||
}
|
||||
listTemplates.ItemsSource = _documentController.DocumentTemplates.OrderBy(x => x.DisplayText);
|
||||
|
||||
private void PopulateFormats()
|
||||
{
|
||||
listTemplates.ItemsSource = _documentController.DocumentTemplates;
|
||||
Validate();
|
||||
}
|
||||
|
||||
private void buttonCreate_Click(object sender, RoutedEventArgs e)
|
||||
@ -77,9 +74,8 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
{
|
||||
bool res = true;
|
||||
|
||||
res &= !String.IsNullOrWhiteSpace(textPath.Text);
|
||||
res &= !textPath.Text.Intersect(System.IO.Path.GetInvalidFileNameChars()).Any();
|
||||
res &= (listTemplates.SelectedItem != null);
|
||||
res &= PathHelper.IsFileNameValid(SelectedName);
|
||||
|
||||
buttonCreate.IsEnabled = res;
|
||||
}
|
||||
@ -88,5 +84,10 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
{
|
||||
Validate();
|
||||
}
|
||||
|
||||
private void textName_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
Validate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,11 +32,11 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected file format
|
||||
/// </summary>
|
||||
public IDocumentTemplate SelectedTemplate
|
||||
public IProjectTemplate SelectedTemplate
|
||||
{
|
||||
get
|
||||
{
|
||||
return listTemplates.SelectedItem as IDocumentTemplate;
|
||||
return listTemplates.SelectedItem as IProjectTemplate;
|
||||
}
|
||||
set
|
||||
{
|
||||
@ -125,7 +125,7 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
private string GetLocation()
|
||||
{
|
||||
// Get setting
|
||||
string location = Settings.Default.CreateProjectDialog_SavedLocation;
|
||||
string location = Settings.Default.Project_SavedLocation;
|
||||
|
||||
// No location provided, use default
|
||||
if (String.IsNullOrEmpty(location))
|
||||
@ -197,7 +197,7 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
// Save location
|
||||
if (checkLocationDefault.IsChecked.HasValue && checkLocationDefault.IsChecked.Value)
|
||||
{
|
||||
Settings.Default.CreateProjectDialog_SavedLocation = SelectedLocation;
|
||||
Settings.Default.Project_SavedLocation = SelectedLocation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user