mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Work on document manager
This commit is contained in:
		
							
								
								
									
										61
									
								
								RainmeterEditor/UI/Dialogs/CreateDocumentDialog.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								RainmeterEditor/UI/Dialogs/CreateDocumentDialog.xaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,61 @@
 | 
			
		||||
<Window x:Class="RainmeterEditor.UI.Dialogs.CreateDocumentDialog"
 | 
			
		||||
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 | 
			
		||||
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
			
		||||
        Title="CreateDocumentDialog" Height="250" Width="400">
 | 
			
		||||
    <Grid Background="WhiteSmoke">
 | 
			
		||||
        <Grid.RowDefinitions>
 | 
			
		||||
            <RowDefinition />
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
            <RowDefinition Height="Auto" />
 | 
			
		||||
        </Grid.RowDefinitions>
 | 
			
		||||
        
 | 
			
		||||
        <ListView Name="listFormats" Grid.Row="0">
 | 
			
		||||
            <ListView.ItemTemplate>
 | 
			
		||||
                <DataTemplate>
 | 
			
		||||
                    <DockPanel>
 | 
			
		||||
                        <Image DockPanel.Dock="Left" Source="{Binding Icon}" 
 | 
			
		||||
                               Width="32" Height="32" Margin="2"
 | 
			
		||||
                               Stretch="Uniform" VerticalAlignment="Top" />
 | 
			
		||||
                        <StackPanel Orientation="Vertical" VerticalAlignment="Center">
 | 
			
		||||
                            <TextBlock Text="{Binding Name}" FontWeight="Bold" />
 | 
			
		||||
                            <TextBlock Text="{Binding Description}" />
 | 
			
		||||
                        </StackPanel>
 | 
			
		||||
                    </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.RowDefinitions>
 | 
			
		||||
                <RowDefinition />
 | 
			
		||||
                <RowDefinition />
 | 
			
		||||
            </Grid.RowDefinitions>
 | 
			
		||||
            <Grid.ColumnDefinitions>
 | 
			
		||||
                <ColumnDefinition Width="Auto" />
 | 
			
		||||
                <ColumnDefinition />
 | 
			
		||||
                <ColumnDefinition Width="Auto" />
 | 
			
		||||
            </Grid.ColumnDefinitions>
 | 
			
		||||
 | 
			
		||||
            <TextBlock Grid.Row="0">Path:</TextBlock>
 | 
			
		||||
            <TextBox Name="textPath" Grid.Row="0" Grid.Column="1"></TextBox>
 | 
			
		||||
            <Button Grid.Row="0" Grid.Column="2">...</Button>
 | 
			
		||||
 | 
			
		||||
        </Grid>
 | 
			
		||||
        
 | 
			
		||||
        <StackPanel Grid.Row="2" Orientation="Horizontal"
 | 
			
		||||
                    HorizontalAlignment="Right">
 | 
			
		||||
            <Button Name="buttonCreate" Click="buttonCreate_Click" IsDefault="True">Create</Button>
 | 
			
		||||
            <Button Name="buttonCancel" Click="buttonCancel_Click" IsCancel="True">Cancel</Button>
 | 
			
		||||
        </StackPanel>
 | 
			
		||||
        
 | 
			
		||||
    </Grid>
 | 
			
		||||
</Window>
 | 
			
		||||
							
								
								
									
										83
									
								
								RainmeterEditor/UI/Dialogs/CreateDocumentDialog.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								RainmeterEditor/UI/Dialogs/CreateDocumentDialog.xaml.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,83 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Controls;
 | 
			
		||||
using System.Windows.Data;
 | 
			
		||||
using System.Windows.Documents;
 | 
			
		||||
using System.Windows.Input;
 | 
			
		||||
using System.Windows.Media;
 | 
			
		||||
using System.Windows.Media.Imaging;
 | 
			
		||||
using System.Windows.Shapes;
 | 
			
		||||
using RainmeterEditor.Business;
 | 
			
		||||
using RainmeterEditor.Model;
 | 
			
		||||
 | 
			
		||||
namespace RainmeterEditor.UI.Dialogs
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Interaction logic for CreateDocumentDialog.xaml
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public partial class CreateDocumentDialog : Window
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the currently selected file format
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public DocumentFormat SelectedFormat
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return listFormats.SelectedItem as DocumentFormat;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                listFormats.SelectedItem = value;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets or sets the path
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string SelectedPath
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return textPath.Text;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                textPath.Text = value;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Creates a new instance of CreateDocumentDialog
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public CreateDocumentDialog()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
 | 
			
		||||
            PopulateFormats();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void PopulateFormats()
 | 
			
		||||
        {
 | 
			
		||||
            listFormats.ItemsSource = DocumentManager.Instance.DocumentFormats;
 | 
			
		||||
            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(listFormats.ItemsSource);
 | 
			
		||||
            view.GroupDescriptions.Add(new PropertyGroupDescription("Category"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void buttonCreate_Click(object sender, RoutedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            DialogResult = true;
 | 
			
		||||
            Close();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void buttonCancel_Click(object sender, RoutedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            DialogResult = false;
 | 
			
		||||
            Close();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user