mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Improved resource manager, plugin manager
This commit is contained in:
@ -3,16 +3,29 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Create..." Height="250" Width="400"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
WindowStyle="ToolWindow" ShowInTaskbar="False">
|
||||
WindowStyle="ToolWindow" ShowInTaskbar="False"
|
||||
Background="WhiteSmoke" >
|
||||
|
||||
<Grid Background="WhiteSmoke">
|
||||
<Grid Margin="2px">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*" />
|
||||
<ColumnDefinition Width="2" />
|
||||
<ColumnDefinition Width="3*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<ListView Name="listCategories" Grid.Row="0" Grid.Column="0"
|
||||
SelectionChanged="listCategories_SelectionChanged"
|
||||
Margin="1px"/>
|
||||
|
||||
<ListView Name="listFormats" Grid.Row="0">
|
||||
<GridSplitter Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
|
||||
<ListView Name="listFormats" Grid.Row="0" Grid.Column="2" Margin="1px">
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<DockPanel>
|
||||
@ -26,18 +39,9 @@
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
<ListView.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.HeaderTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock FontWeight="Bold" FontSize="13pt" Text="{Binding Name}" />
|
||||
</DataTemplate>
|
||||
</GroupStyle.HeaderTemplate>
|
||||
</GroupStyle>
|
||||
</ListView.GroupStyle>
|
||||
</ListView>
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid Grid.Row="1" Grid.ColumnSpan="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
@ -49,15 +53,15 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0">Path:</TextBlock>
|
||||
<TextBox Name="textPath" Grid.Row="0" Grid.Column="1"></TextBox>
|
||||
<TextBox Name="textPath" Grid.Row="0" Grid.Column="1" Margin="1px"></TextBox>
|
||||
<Button Grid.Row="0" Grid.Column="2">...</Button>
|
||||
|
||||
</Grid>
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal"
|
||||
|
||||
<StackPanel Grid.Row="2" Grid.ColumnSpan="3" Orientation="Horizontal"
|
||||
HorizontalAlignment="Right">
|
||||
<Button Name="buttonCreate" Click="buttonCreate_Click" IsDefault="True">Create</Button>
|
||||
<Button Name="buttonCancel" Click="buttonCancel_Click" IsCancel="True">Cancel</Button>
|
||||
<Button Name="buttonCreate" Click="buttonCreate_Click" IsDefault="True" Margin="1px">Create</Button>
|
||||
<Button Name="buttonCancel" Click="buttonCancel_Click" IsCancel="True" Margin="1px">Cancel</Button>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
@ -13,6 +13,7 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using RainmeterStudio.Business;
|
||||
using RainmeterStudio.Core.Documents;
|
||||
using RainmeterStudio.UI.Controller;
|
||||
|
||||
namespace RainmeterStudio.UI.Dialogs
|
||||
{
|
||||
@ -21,6 +22,8 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
/// </summary>
|
||||
public partial class CreateDocumentDialog : Window
|
||||
{
|
||||
private DocumentController _documentController;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected file format
|
||||
/// </summary>
|
||||
@ -54,20 +57,34 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
/// <summary>
|
||||
/// Creates a new instance of CreateDocumentDialog
|
||||
/// </summary>
|
||||
public CreateDocumentDialog()
|
||||
public CreateDocumentDialog(DocumentController docCtrl)
|
||||
{
|
||||
InitializeComponent();
|
||||
_documentController = docCtrl;
|
||||
|
||||
PopulateFormats();
|
||||
PopulateCategories();
|
||||
RepopulateFormats();
|
||||
Validate();
|
||||
}
|
||||
|
||||
private void PopulateFormats()
|
||||
private void PopulateCategories()
|
||||
{
|
||||
//listFormats.ItemsSource = DocumentManager.Instance.DocumentFormats;
|
||||
listCategories.ItemsSource = _documentController.DocumentTemplates
|
||||
.Select(template => template.Category)
|
||||
.Where(cat => cat != null)
|
||||
.Distinct()
|
||||
.Concat(new[] { "All" });
|
||||
|
||||
CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listFormats.ItemsSource);
|
||||
view.GroupDescriptions.Add(new PropertyGroupDescription("Category"));
|
||||
listCategories.SelectedIndex = listCategories.Items.Count - 1;
|
||||
}
|
||||
|
||||
private void RepopulateFormats()
|
||||
{
|
||||
if (Object.Equals(listCategories.SelectedItem, "All"))
|
||||
listFormats.ItemsSource = _documentController.DocumentTemplates;
|
||||
|
||||
else
|
||||
listFormats.ItemsSource = _documentController.DocumentTemplates.Where(x => Object.Equals(x.Category, listCategories.SelectedItem));
|
||||
}
|
||||
|
||||
private void buttonCreate_Click(object sender, RoutedEventArgs e)
|
||||
@ -90,5 +107,10 @@ namespace RainmeterStudio.UI.Dialogs
|
||||
|
||||
buttonCreate.IsEnabled = res;
|
||||
}
|
||||
|
||||
private void listCategories_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
RepopulateFormats();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user