Work on resource and settings managers, added some documentation.

This commit is contained in:
Tiberiu Chibici 2014-08-15 15:31:33 +03:00
parent 03d9848b50
commit ef8aec25b7
36 changed files with 1148 additions and 671 deletions

Binary file not shown.

View File

@ -1,4 +1,6 @@
using RainmeterStudio.Core.Model;
using System.Collections.Generic;
using System.Linq;
using RainmeterStudio.Core.Model;
namespace RainmeterStudio.Core.Documents
{
@ -17,6 +19,18 @@ namespace RainmeterStudio.Core.Documents
/// </summary>
public string DefaultExtension { get; private set; }
/// <summary>
/// Gets or sets the properties of this template
/// </summary>
/// <remarks>Properties are used to display a form dialog after the "New item" dialog closes.</remarks>
public virtual IEnumerable<Property> Properties
{
get
{
return Enumerable.Empty<Property>();
}
}
/// <summary>
/// Initializes the document template
/// </summary>

View File

@ -35,6 +35,7 @@
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -62,7 +63,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Storage\SerializableTree.cs" />
<Compile Include="Utils\DirectoryHelper.cs" />
<Compile Include="Utils\InputHelper.cs" />
<Compile Include="Utils\LinqExtension.cs" />
<Compile Include="Utils\BitmapHelper.cs" />
<Compile Include="Utils\TreeExtensions.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace RainmeterStudio.Core.Utils
{
public static class BitmapHelper
{
public static ImageSource GetImageSource(this System.Drawing.Bitmap image)
{
BitmapSource destination;
IntPtr bitmapHandle = image.GetHbitmap();
BitmapSizeOptions sizeOptions = BitmapSizeOptions.FromEmptyOptions();
destination = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bitmapHandle, IntPtr.Zero, Int32Rect.Empty, sizeOptions);
destination.Freeze();
return destination;
}
}
public class BitmapToImageSourceConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var bitmap = value as System.Drawing.Bitmap;
if (bitmap != null)
{
return bitmap.GetImageSource();
}
return null;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}
}

View File

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
namespace RainmeterStudio.Core.Utils
{
/// <summary>
/// Helper methods for key gestures
/// </summary>
public static class InputHelper
{
/// <summary>
/// Converts a key gesture into its string representation
/// </summary>
/// <param name="gesture">Key gesture</param>
/// <returns>The string representation</returns>
public static string ConvertToString(this KeyGesture gesture)
{
// Safety check
if (gesture == null)
return null;
// Build string
string text = String.Empty;
if ((gesture.Modifiers & ModifierKeys.Windows) != 0)
text += "Win+";
if ((gesture.Modifiers & ModifierKeys.Control) != 0)
text += "Ctrl+";
if ((gesture.Modifiers & ModifierKeys.Alt) != 0)
text += "Alt+";
if ((gesture.Modifiers & ModifierKeys.Shift) != 0)
text += "Shift+";
text += Enum.GetName(typeof(Key), gesture.Key);
return text;
}
/// <summary>
/// Obtains a key gesture from a string representation
/// </summary>
/// <param name="keyGesture">The key gesture string</param>
/// <returns>A key gesture object</returns>
public static KeyGesture GetKeyGesture(string keyGesture)
{
// Safety check
if (keyGesture == null)
return null;
// Variables
ModifierKeys mods = ModifierKeys.None;
Key key = Key.None;
// Parse each field
foreach (var field in keyGesture.Split('+'))
{
// Trim surrounding white space
string trimmed = field.Trim();
// Parse
if (trimmed.Equals("Win", StringComparison.InvariantCultureIgnoreCase))
mods |= ModifierKeys.Windows;
if (trimmed.Equals("Ctrl", StringComparison.InvariantCultureIgnoreCase))
mods |= ModifierKeys.Control;
if (trimmed.Equals("Alt", StringComparison.InvariantCultureIgnoreCase))
mods |= ModifierKeys.Alt;
if (trimmed.Equals("Shift", StringComparison.InvariantCultureIgnoreCase))
mods |= ModifierKeys.Shift;
else Enum.TryParse<Key>(field, out key);
}
return new KeyGesture(key, mods);
}
}
}

View File

@ -35,6 +35,7 @@
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@ -84,7 +85,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\Graphics\transparent_background.png" />
<Resource Include="Resources\Graphics\transparent_background.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Graphics.resx">
@ -100,6 +101,9 @@
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\Icons\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -61,11 +61,12 @@ namespace RainmeterStudio.SkinDesignerPlugin.Resources {
}
/// <summary>
/// Looks up a localized string similar to /Resources/Graphics/transparent_background.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static string TransparentBackground {
public static System.Drawing.Bitmap TransparentBackground {
get {
return ResourceManager.GetString("TransparentBackground", resourceCulture);
object obj = ResourceManager.GetObject("TransparentBackground", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}

View File

@ -117,7 +117,8 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="TransparentBackground" xml:space="preserve">
<value>/Resources/Graphics/transparent_background.png</value>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="TransparentBackground" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>graphics\transparent_background.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -18,7 +18,7 @@ namespace RainmeterStudio.SkinDesignerPlugin
/// Initializes this skin template
/// </summary>
public SkinDocumentTemplate()
: base("Skin", "ini")
: base("Skin", "rsskin")
{
}

View File

@ -35,6 +35,7 @@
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@ -45,6 +46,16 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Resources\Icons.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Icons.resx</DependentUpon>
</Compile>
<Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Include="TextDocument.cs" />
<Compile Include="TextDocumentTemplate.cs" />
<Compile Include="TextEditor.cs" />
@ -67,6 +78,22 @@
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Icons.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Icons.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Resources\Icons\32\text_generic.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Icons\16\text_generic.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@ -0,0 +1,83 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RainmeterStudio.TextEditorPlugin.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Icons {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Icons() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RainmeterStudio.TextEditorPlugin.Resources.Icons", typeof(Icons).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap ProjectItem_txt {
get {
object obj = ResourceManager.GetObject("ProjectItem_txt", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
public static System.Drawing.Bitmap Template_Text_Icon {
get {
object obj = ResourceManager.GetObject("Template_Text_Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ProjectItem_txt" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\text_generic.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Template_Text_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\32\text_generic.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

Before

Width:  |  Height:  |  Size: 778 B

After

Width:  |  Height:  |  Size: 778 B

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,81 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace RainmeterStudio.TextEditorPlugin.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Strings {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Strings() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("RainmeterStudio.TextEditorPlugin.Resources.Strings", typeof(Strings).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Blank text file.
/// </summary>
public static string Template_Text_Description {
get {
return ResourceManager.GetString("Template_Text_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Text file.
/// </summary>
public static string Template_Text_DisplayText {
get {
return ResourceManager.GetString("Template_Text_DisplayText", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Template_Text_Description" xml:space="preserve">
<value>Blank text file</value>
</data>
<data name="Template_Text_DisplayText" xml:space="preserve">
<value>Text file</value>
</data>
</root>

View File

@ -15,7 +15,7 @@ namespace RainmeterStudio.TextEditorPlugin
public class TextDocumentTemplate : DocumentTemplate
{
public TextDocumentTemplate()
: base("TextDocument", "txt")
: base("Text", "txt")
{
}

View File

@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Reflection;
using System.Resources;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using RainmeterStudio.Core.Utils;
namespace RainmeterStudio.Resources
namespace RainmeterStudio.Business
{
/// <summary>
/// Manages and provides resources
@ -19,6 +19,11 @@ namespace RainmeterStudio.Resources
{
public ResourceManager Manager;
public Assembly Assembly;
public override string ToString()
{
return String.Format("{{{0}; {1}}}", Manager, Assembly);
}
}
private static List<ResourceManagerInfo> _resourceManagers = new List<ResourceManagerInfo>();
@ -94,13 +99,12 @@ namespace RainmeterStudio.Resources
foreach (var info in _resourceManagers)
{
// Try to get resource
var path = info.Manager.GetString(key);
var bitmap = info.Manager.GetObject(key) as System.Drawing.Bitmap;
// Found
if (path != null)
if (bitmap != null)
{
Uri fullPath = new Uri("/" + info.Assembly.GetName().Name + ";component" + path, UriKind.Relative);
image = new BitmapImage(fullPath);
image = bitmap.GetImageSource();
if (keepInCache)
_cacheImages[key] = image;

View File

@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
namespace RainmeterStudio.UI.Controller
namespace RainmeterStudio.Business
{
public static class SettingsProvider
{
@ -45,5 +43,21 @@ namespace RainmeterStudio.UI.Controller
return false;
}
}
/// <summary>
/// Saves the settings
/// </summary>
public static void SaveSettings()
{
Properties.Settings.Default.Save();
}
/// <summary>
/// Resets settings to default
/// </summary>
public static void ResetSettings()
{
Properties.Settings.Default.Reset();
}
}
}

View File

@ -39,6 +39,9 @@ namespace RainmeterStudio
// Create & run app
var uiManager = new UIManager(projectManager, documentManager);
uiManager.Run();
// Run finished, persist settings
SettingsProvider.SaveSettings();
}
}
}

View File

@ -87,5 +87,65 @@ namespace RainmeterStudio.Properties {
this["DocumentCloseCommand_Shortcut"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("800")]
public double MainWindow_Width {
get {
return ((double)(this["MainWindow_Width"]));
}
set {
this["MainWindow_Width"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("600")]
public double MainWindow_Height {
get {
return ((double)(this["MainWindow_Height"]));
}
set {
this["MainWindow_Height"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Normal")]
public global::System.Windows.WindowState MainWindow_WindowState {
get {
return ((global::System.Windows.WindowState)(this["MainWindow_WindowState"]));
}
set {
this["MainWindow_WindowState"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("10")]
public double MainWindow_Left {
get {
return ((double)(this["MainWindow_Left"]));
}
set {
this["MainWindow_Left"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("10")]
public double MainWindow_Top {
get {
return ((double)(this["MainWindow_Top"]));
}
set {
this["MainWindow_Top"] = value;
}
}
}
}

View File

@ -17,5 +17,20 @@
<Setting Name="DocumentCloseCommand_Shortcut" Roaming="true" Type="System.String" Scope="User">
<Value Profile="(Default)">Ctrl+W</Value>
</Setting>
<Setting Name="MainWindow_Width" Type="System.Double" Scope="User">
<Value Profile="(Default)">800</Value>
</Setting>
<Setting Name="MainWindow_Height" Type="System.Double" Scope="User">
<Value Profile="(Default)">600</Value>
</Setting>
<Setting Name="MainWindow_WindowState" Type="System.Windows.WindowState" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="MainWindow_Left" Type="System.Double" Scope="User">
<Value Profile="(Default)">10</Value>
</Setting>
<Setting Name="MainWindow_Top" Type="System.Double" Scope="User">
<Value Profile="(Default)">10</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -78,7 +78,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>Icons.resx</DependentUpon>
</Compile>
<Compile Include="Resources\ResourceProvider.cs" />
<Compile Include="Business\ResourceProvider.cs" />
<Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@ -88,7 +88,7 @@
<Compile Include="UI\Command.cs" />
<Compile Include="UI\Controller\IconProvider.cs" />
<Compile Include="UI\Controller\ProjectController.cs" />
<Compile Include="UI\Controller\SettingsProvider.cs" />
<Compile Include="Business\SettingsProvider.cs" />
<Compile Include="UI\Dialogs\CreateDocumentDialog.xaml.cs">
<DependentUpon>CreateDocumentDialog.xaml</DependentUpon>
</Compile>
@ -156,6 +156,7 @@
<EmbeddedResource Include="Resources\Icons.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Icons.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
@ -169,56 +170,50 @@
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\32\text_generic.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\splash.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\arrow_left.png" />
<None Include="Resources\Icons\16\arrow_left.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\arrow_right.png" />
<None Include="Resources\Icons\16\arrow_right.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\arrow_backward.png" />
<Resource Include="Resources\Icons\16\arrow_forward.png" />
<None Include="Resources\Icons\16\arrow_backward.png" />
<None Include="Resources\Icons\16\arrow_forward.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\page_white_star.png" />
<None Include="Resources\Icons\16\page_white_star.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\project.png" />
<Resource Include="Resources\Icons\16\project_star.png" />
<None Include="Resources\Icons\16\project.png" />
<None Include="Resources\Icons\16\project_star.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\page_white_delete.png" />
<None Include="Resources\Icons\16\page_white_delete.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\folder.png" />
<None Include="Resources\Icons\16\folder.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\text_generic.png" />
<None Include="Resources\Icons\16\file_generic.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\file_generic.png" />
<None Include="Resources\Icons\16\arrow_refresh_small.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\arrow_refresh_small.png" />
<None Include="Resources\Icons\16\plus.png" />
<None Include="Resources\Icons\16\minus.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\plus.png" />
<Resource Include="Resources\Icons\16\minus.png" />
<None Include="Resources\Icons\16\folder_explore.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\folder_explore.png" />
<None Include="Resources\Icons\16\view-refresh.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\view-refresh.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Icons\16\folder_project.png" />
<None Include="Resources\Icons\16\folder_project.png" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />

View File

@ -61,128 +61,122 @@ namespace RainmeterStudio.Resources {
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/page_white_star.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string DocumentCreateCommand {
internal static System.Drawing.Bitmap Command_DocumentCreateCommand_Icon {
get {
return ResourceManager.GetString("DocumentCreateCommand", resourceCulture);
object obj = ResourceManager.GetObject("Command_DocumentCreateCommand_Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/32/text_generic.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string DocumentTemplate_Text {
internal static System.Drawing.Bitmap Command_ProjectCreateCommand_Icon {
get {
return ResourceManager.GetString("DocumentTemplate_Text", resourceCulture);
object obj = ResourceManager.GetObject("Command_ProjectCreateCommand_Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/project_star.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectCreateCommand {
internal static System.Drawing.Bitmap Command_ProjectOpenCommand_Icon {
get {
return ResourceManager.GetString("ProjectCreateCommand", resourceCulture);
object obj = ResourceManager.GetObject("Command_ProjectOpenCommand_Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/project.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectItem_rsproj {
internal static System.Drawing.Bitmap Command_ProjectPanel_CollapseAllCommand_Icon {
get {
return ResourceManager.GetString("ProjectItem_rsproj", resourceCulture);
object obj = ResourceManager.GetObject("Command_ProjectPanel_CollapseAllCommand_Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/text_generic.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectItem_txt {
internal static System.Drawing.Bitmap Command_ProjectPanel_ExpandAllCommand_Icon {
get {
return ResourceManager.GetString("ProjectItem_txt", resourceCulture);
object obj = ResourceManager.GetObject("Command_ProjectPanel_ExpandAllCommand_Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/folder.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectItemDirectory {
internal static System.Drawing.Bitmap Command_ProjectPanel_RefreshCommand_Icon {
get {
return ResourceManager.GetString("ProjectItemDirectory", resourceCulture);
object obj = ResourceManager.GetObject("Command_ProjectPanel_RefreshCommand_Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/page_white_delete.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectItemNone {
internal static System.Drawing.Bitmap Command_ProjectPanel_ShowAllFilesCommand_Icon {
get {
return ResourceManager.GetString("ProjectItemNone", resourceCulture);
object obj = ResourceManager.GetObject("Command_ProjectPanel_ShowAllFilesCommand_Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/file_generic.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectItemUnknown {
internal static System.Drawing.Bitmap Command_ProjectPanel_SyncWithActiveViewCommand_Icon {
get {
return ResourceManager.GetString("ProjectItemUnknown", resourceCulture);
object obj = ResourceManager.GetObject("Command_ProjectPanel_SyncWithActiveViewCommand_Icon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/folder_project.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectOpenCommand {
internal static System.Drawing.Bitmap ProjectItem_rsproj {
get {
return ResourceManager.GetString("ProjectOpenCommand", resourceCulture);
object obj = ResourceManager.GetObject("ProjectItem_rsproj", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/minus.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectPanel_CollapseAllCommand {
internal static System.Drawing.Bitmap ProjectItemDirectory {
get {
return ResourceManager.GetString("ProjectPanel_CollapseAllCommand", resourceCulture);
object obj = ResourceManager.GetObject("ProjectItemDirectory", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/plus.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectPanel_ExpandAllCommand {
internal static System.Drawing.Bitmap ProjectItemNone {
get {
return ResourceManager.GetString("ProjectPanel_ExpandAllCommand", resourceCulture);
object obj = ResourceManager.GetObject("ProjectItemNone", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/view-refresh.png.
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static string ProjectPanel_RefreshCommand {
internal static System.Drawing.Bitmap ProjectItemUnknown {
get {
return ResourceManager.GetString("ProjectPanel_RefreshCommand", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/folder_explore.png.
/// </summary>
internal static string ProjectPanel_ShowAllFilesCommand {
get {
return ResourceManager.GetString("ProjectPanel_ShowAllFilesCommand", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to /Resources/Icons/16/arrow_refresh_small.png.
/// </summary>
internal static string ProjectPanel_SyncWithActiveViewCommand {
get {
return ResourceManager.GetString("ProjectPanel_SyncWithActiveViewCommand", resourceCulture);
object obj = ResourceManager.GetObject("ProjectItemUnknown", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}

View File

@ -117,46 +117,41 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="DocumentCreateCommand" xml:space="preserve">
<value>/Resources/Icons/16/page_white_star.png</value>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Command_DocumentCreateCommand_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\page_white_star.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DocumentTemplate_Text" xml:space="preserve">
<value>/Resources/Icons/32/text_generic.png</value>
<data name="Command_ProjectCreateCommand_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\project_star.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectCreateCommand" xml:space="preserve">
<value>/Resources/Icons/16/project_star.png</value>
<data name="Command_ProjectOpenCommand_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\folder_project.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectItemDirectory" xml:space="preserve">
<value>/Resources/Icons/16/folder.png</value>
<data name="Command_ProjectPanel_CollapseAllCommand_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\minus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectItemNone" xml:space="preserve">
<value>/Resources/Icons/16/page_white_delete.png</value>
<data name="Command_ProjectPanel_ExpandAllCommand_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectItemUnknown" xml:space="preserve">
<value>/Resources/Icons/16/file_generic.png</value>
<data name="Command_ProjectPanel_RefreshCommand_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\view-refresh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectItem_rsproj" xml:space="preserve">
<value>/Resources/Icons/16/project.png</value>
<data name="Command_ProjectPanel_ShowAllFilesCommand_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\folder_explore.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectItem_txt" xml:space="preserve">
<value>/Resources/Icons/16/text_generic.png</value>
<data name="Command_ProjectPanel_SyncWithActiveViewCommand_Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\arrow_refresh_small.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectOpenCommand" xml:space="preserve">
<value>/Resources/Icons/16/folder_project.png</value>
<data name="ProjectItemDirectory" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\folder.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectPanel_CollapseAllCommand" xml:space="preserve">
<value>/Resources/Icons/16/minus.png</value>
<data name="ProjectItemNone" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\file_generic.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectPanel_ExpandAllCommand" xml:space="preserve">
<value>/Resources/Icons/16/plus.png</value>
<data name="ProjectItemUnknown" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\page_white_delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ProjectPanel_RefreshCommand" xml:space="preserve">
<value>/Resources/Icons/16/view-refresh.png</value>
</data>
<data name="ProjectPanel_ShowAllFilesCommand" xml:space="preserve">
<value>/Resources/Icons/16/folder_explore.png</value>
</data>
<data name="ProjectPanel_SyncWithActiveViewCommand" xml:space="preserve">
<value>/Resources/Icons/16/arrow_refresh_small.png</value>
<data name="ProjectItem_rsproj" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>icons\16\project.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -61,11 +61,245 @@ namespace RainmeterStudio.Resources {
}
/// <summary>
/// Looks up a localized string similar to Utility.
/// Looks up a localized string similar to _Close.
/// </summary>
public static string Category_Utility {
public static string Command_DocumentCloseCommand_DisplayText {
get {
return ResourceManager.GetString("Category_Utility", resourceCulture);
return ResourceManager.GetString("Command_DocumentCloseCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Close active document.
/// </summary>
public static string Command_DocumentCloseCommand_ToolTip {
get {
return ResourceManager.GetString("Command_DocumentCloseCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _File....
/// </summary>
public static string Command_DocumentCreateCommand_DisplayText {
get {
return ResourceManager.GetString("Command_DocumentCreateCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create a new file.
/// </summary>
public static string Command_DocumentCreateCommand_ToolTip {
get {
return ResourceManager.GetString("Command_DocumentCreateCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Project....
/// </summary>
public static string Command_ProjectCreateCommand_DisplayText {
get {
return ResourceManager.GetString("Command_ProjectCreateCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create a new project.
/// </summary>
public static string Command_ProjectCreateCommand_ToolTip {
get {
return ResourceManager.GetString("Command_ProjectCreateCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Project....
/// </summary>
public static string Command_ProjectOpenCommand_DisplayText {
get {
return ResourceManager.GetString("Command_ProjectOpenCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open existing project.
/// </summary>
public static string Command_ProjectOpenCommand_ToolTip {
get {
return ResourceManager.GetString("Command_ProjectOpenCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Collapse all.
/// </summary>
public static string Command_ProjectPanel_CollapseAllCommand_DisplayText {
get {
return ResourceManager.GetString("Command_ProjectPanel_CollapseAllCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Collapse all.
/// </summary>
public static string Command_ProjectPanel_CollapseAllCommand_ToolTip {
get {
return ResourceManager.GetString("Command_ProjectPanel_CollapseAllCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Expand all.
/// </summary>
public static string Command_ProjectPanel_ExpandAllCommand_DisplayText {
get {
return ResourceManager.GetString("Command_ProjectPanel_ExpandAllCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Expand all.
/// </summary>
public static string Command_ProjectPanel_ExpandAllCommand_ToolTip {
get {
return ResourceManager.GetString("Command_ProjectPanel_ExpandAllCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Refresh.
/// </summary>
public static string Command_ProjectPanel_RefreshCommand_DisplayText {
get {
return ResourceManager.GetString("Command_ProjectPanel_RefreshCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Refresh.
/// </summary>
public static string Command_ProjectPanel_RefreshCommand_ToolTip {
get {
return ResourceManager.GetString("Command_ProjectPanel_RefreshCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show all files.
/// </summary>
public static string Command_ProjectPanel_ShowAllFilesCommand_DisplayText {
get {
return ResourceManager.GetString("Command_ProjectPanel_ShowAllFilesCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show all files.
/// </summary>
public static string Command_ProjectPanel_ShowAllFilesCommand_ToolTip {
get {
return ResourceManager.GetString("Command_ProjectPanel_ShowAllFilesCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sync with active view.
/// </summary>
public static string Command_ProjectPanel_SyncWithActiveViewCommand_DisplayText {
get {
return ResourceManager.GetString("Command_ProjectPanel_SyncWithActiveViewCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sync with active view.
/// </summary>
public static string Command_ProjectPanel_SyncWithActiveViewCommand_ToolTip {
get {
return ResourceManager.GetString("Command_ProjectPanel_SyncWithActiveViewCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Name:.
/// </summary>
public static string CreateDocumentDialog_Name {
get {
return ResourceManager.GetString("CreateDocumentDialog_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Path:.
/// </summary>
public static string CreateDocumentDialog_Path {
get {
return ResourceManager.GetString("CreateDocumentDialog_Path", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to New item.
/// </summary>
public static string CreateDocumentDialog_Title {
get {
return ResourceManager.GetString("CreateDocumentDialog_Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Location:.
/// </summary>
public static string CreateProjectDialog_Location {
get {
return ResourceManager.GetString("CreateProjectDialog_Location", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Set location as default.
/// </summary>
public static string CreateProjectDialog_LocationDefault {
get {
return ResourceManager.GetString("CreateProjectDialog_LocationDefault", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Name:.
/// </summary>
public static string CreateProjectDialog_Name {
get {
return ResourceManager.GetString("CreateProjectDialog_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Path:.
/// </summary>
public static string CreateProjectDialog_Path {
get {
return ResourceManager.GetString("CreateProjectDialog_Path", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create directory for project.
/// </summary>
public static string CreateProjectDialog_PathCreateFolder {
get {
return ResourceManager.GetString("CreateProjectDialog_PathCreateFolder", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create project.
/// </summary>
public static string CreateProjectDialog_Title {
get {
return ResourceManager.GetString("CreateProjectDialog_Title", resourceCulture);
}
}
@ -132,69 +366,6 @@ namespace RainmeterStudio.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to _Close.
/// </summary>
public static string DocumentCloseCommand_DisplayText {
get {
return ResourceManager.GetString("DocumentCloseCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Close active document.
/// </summary>
public static string DocumentCloseCommand_ToolTip {
get {
return ResourceManager.GetString("DocumentCloseCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _File....
/// </summary>
public static string DocumentCreateCommand_DisplayText {
get {
return ResourceManager.GetString("DocumentCreateCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create a new file.
/// </summary>
public static string DocumentCreateCommand_ToolTip {
get {
return ResourceManager.GetString("DocumentCreateCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Text Editor.
/// </summary>
public static string DocumentEditor_Text_Name {
get {
return ResourceManager.GetString("DocumentEditor_Text_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Blank text file.
/// </summary>
public static string DocumentFormat_TextFile_Description {
get {
return ResourceManager.GetString("DocumentFormat_TextFile_Description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Text file.
/// </summary>
public static string DocumentFormat_TextFile_Name {
get {
return ResourceManager.GetString("DocumentFormat_TextFile_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _File.
/// </summary>
@ -223,191 +394,11 @@ namespace RainmeterStudio.Resources {
}
/// <summary>
/// Looks up a localized string similar to _Project....
/// Looks up a localized string similar to Rainmeter Studio.
/// </summary>
public static string ProjectCreateCommand_DisplayText {
public static string MainWindow_Title {
get {
return ResourceManager.GetString("ProjectCreateCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create a new project.
/// </summary>
public static string ProjectCreateCommand_ToolTip {
get {
return ResourceManager.GetString("ProjectCreateCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Location:.
/// </summary>
public static string ProjectCreateDialog_Location {
get {
return ResourceManager.GetString("ProjectCreateDialog_Location", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Set location as default.
/// </summary>
public static string ProjectCreateDialog_LocationDefault {
get {
return ResourceManager.GetString("ProjectCreateDialog_LocationDefault", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Name:.
/// </summary>
public static string ProjectCreateDialog_Name {
get {
return ResourceManager.GetString("ProjectCreateDialog_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Path:.
/// </summary>
public static string ProjectCreateDialog_Path {
get {
return ResourceManager.GetString("ProjectCreateDialog_Path", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create directory for project.
/// </summary>
public static string ProjectCreateDialog_PathCreateFolder {
get {
return ResourceManager.GetString("ProjectCreateDialog_PathCreateFolder", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Create project.
/// </summary>
public static string ProjectCreateDialog_Title {
get {
return ResourceManager.GetString("ProjectCreateDialog_Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Project....
/// </summary>
public static string ProjectOpenCommand_DisplayText {
get {
return ResourceManager.GetString("ProjectOpenCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Open existing project.
/// </summary>
public static string ProjectOpenCommand_ToolTip {
get {
return ResourceManager.GetString("ProjectOpenCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Collapse all.
/// </summary>
public static string ProjectPanel_CollapseAllCommand_DisplayText {
get {
return ResourceManager.GetString("ProjectPanel_CollapseAllCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Collapse all.
/// </summary>
public static string ProjectPanel_CollapseAllCommand_ToolTip {
get {
return ResourceManager.GetString("ProjectPanel_CollapseAllCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Expand all.
/// </summary>
public static string ProjectPanel_ExpandAllCommand_DisplayText {
get {
return ResourceManager.GetString("ProjectPanel_ExpandAllCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Expand all.
/// </summary>
public static string ProjectPanel_ExpandAllCommand_ToolTip {
get {
return ResourceManager.GetString("ProjectPanel_ExpandAllCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Refresh.
/// </summary>
public static string ProjectPanel_RefreshCommand_DisplayText {
get {
return ResourceManager.GetString("ProjectPanel_RefreshCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Refresh.
/// </summary>
public static string ProjectPanel_RefreshCommand_ToolTip {
get {
return ResourceManager.GetString("ProjectPanel_RefreshCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show all files.
/// </summary>
public static string ProjectPanel_ShowAllFilesCommand_DisplayText {
get {
return ResourceManager.GetString("ProjectPanel_ShowAllFilesCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show all files.
/// </summary>
public static string ProjectPanel_ShowAllFilesCommand_ToolTip {
get {
return ResourceManager.GetString("ProjectPanel_ShowAllFilesCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sync with active view.
/// </summary>
public static string ProjectPanel_SyncWithActiveViewCommand_DisplayText {
get {
return ResourceManager.GetString("ProjectPanel_SyncWithActiveViewCommand_DisplayText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sync with active view.
/// </summary>
public static string ProjectPanel_SyncWithActiveViewCommand_ToolTip {
get {
return ResourceManager.GetString("ProjectPanel_SyncWithActiveViewCommand_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Utility.
/// </summary>
public static string TemplateCategory_Utility {
get {
return ResourceManager.GetString("TemplateCategory_Utility", resourceCulture);
return ResourceManager.GetString("MainWindow_Title", resourceCulture);
}
}
}

View File

@ -117,8 +117,14 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Category_Utility" xml:space="preserve">
<value>Utility</value>
<data name="CreateDocumentDialog_Name" xml:space="preserve">
<value>Name:</value>
</data>
<data name="CreateDocumentDialog_Path" xml:space="preserve">
<value>Path:</value>
</data>
<data name="CreateDocumentDialog_Title" xml:space="preserve">
<value>New item</value>
</data>
<data name="Dialog_Browse" xml:space="preserve">
<value>Browse</value>
@ -141,27 +147,18 @@
<data name="Dialog_OpenProject_Title" xml:space="preserve">
<value>Open project...</value>
</data>
<data name="DocumentCloseCommand_DisplayText" xml:space="preserve">
<data name="Command_DocumentCloseCommand_DisplayText" xml:space="preserve">
<value>_Close</value>
</data>
<data name="DocumentCloseCommand_ToolTip" xml:space="preserve">
<data name="Command_DocumentCloseCommand_ToolTip" xml:space="preserve">
<value>Close active document</value>
</data>
<data name="DocumentCreateCommand_DisplayText" xml:space="preserve">
<data name="Command_DocumentCreateCommand_DisplayText" xml:space="preserve">
<value>_File...</value>
</data>
<data name="DocumentCreateCommand_ToolTip" xml:space="preserve">
<data name="Command_DocumentCreateCommand_ToolTip" xml:space="preserve">
<value>Create a new file</value>
</data>
<data name="DocumentEditor_Text_Name" xml:space="preserve">
<value>Text Editor</value>
</data>
<data name="DocumentFormat_TextFile_Description" xml:space="preserve">
<value>Blank text file</value>
</data>
<data name="DocumentFormat_TextFile_Name" xml:space="preserve">
<value>Text file</value>
</data>
<data name="MainWindow_File" xml:space="preserve">
<value>_File</value>
</data>
@ -171,67 +168,67 @@
<data name="MainWindow_File_Open" xml:space="preserve">
<value>_Open</value>
</data>
<data name="ProjectCreateCommand_DisplayText" xml:space="preserve">
<data name="Command_ProjectCreateCommand_DisplayText" xml:space="preserve">
<value>_Project...</value>
</data>
<data name="ProjectCreateCommand_ToolTip" xml:space="preserve">
<data name="Command_ProjectCreateCommand_ToolTip" xml:space="preserve">
<value>Create a new project</value>
</data>
<data name="ProjectCreateDialog_Location" xml:space="preserve">
<data name="CreateProjectDialog_Location" xml:space="preserve">
<value>Location:</value>
</data>
<data name="ProjectCreateDialog_LocationDefault" xml:space="preserve">
<data name="CreateProjectDialog_LocationDefault" xml:space="preserve">
<value>Set location as default</value>
</data>
<data name="ProjectCreateDialog_Name" xml:space="preserve">
<data name="CreateProjectDialog_Name" xml:space="preserve">
<value>Name:</value>
</data>
<data name="ProjectCreateDialog_Path" xml:space="preserve">
<data name="CreateProjectDialog_Path" xml:space="preserve">
<value>Path:</value>
</data>
<data name="ProjectCreateDialog_PathCreateFolder" xml:space="preserve">
<data name="CreateProjectDialog_PathCreateFolder" xml:space="preserve">
<value>Create directory for project</value>
</data>
<data name="ProjectCreateDialog_Title" xml:space="preserve">
<data name="CreateProjectDialog_Title" xml:space="preserve">
<value>Create project</value>
</data>
<data name="ProjectOpenCommand_DisplayText" xml:space="preserve">
<data name="Command_ProjectOpenCommand_DisplayText" xml:space="preserve">
<value>_Project...</value>
</data>
<data name="ProjectOpenCommand_ToolTip" xml:space="preserve">
<data name="Command_ProjectOpenCommand_ToolTip" xml:space="preserve">
<value>Open existing project</value>
</data>
<data name="ProjectPanel_CollapseAllCommand_DisplayText" xml:space="preserve">
<data name="Command_ProjectPanel_CollapseAllCommand_DisplayText" xml:space="preserve">
<value>Collapse all</value>
</data>
<data name="ProjectPanel_CollapseAllCommand_ToolTip" xml:space="preserve">
<data name="Command_ProjectPanel_CollapseAllCommand_ToolTip" xml:space="preserve">
<value>Collapse all</value>
</data>
<data name="ProjectPanel_ExpandAllCommand_DisplayText" xml:space="preserve">
<data name="Command_ProjectPanel_ExpandAllCommand_DisplayText" xml:space="preserve">
<value>Expand all</value>
</data>
<data name="ProjectPanel_ExpandAllCommand_ToolTip" xml:space="preserve">
<data name="Command_ProjectPanel_ExpandAllCommand_ToolTip" xml:space="preserve">
<value>Expand all</value>
</data>
<data name="ProjectPanel_RefreshCommand_DisplayText" xml:space="preserve">
<data name="Command_ProjectPanel_RefreshCommand_DisplayText" xml:space="preserve">
<value>Refresh</value>
</data>
<data name="ProjectPanel_RefreshCommand_ToolTip" xml:space="preserve">
<data name="Command_ProjectPanel_RefreshCommand_ToolTip" xml:space="preserve">
<value>Refresh</value>
</data>
<data name="ProjectPanel_ShowAllFilesCommand_DisplayText" xml:space="preserve">
<data name="Command_ProjectPanel_ShowAllFilesCommand_DisplayText" xml:space="preserve">
<value>Show all files</value>
</data>
<data name="ProjectPanel_ShowAllFilesCommand_ToolTip" xml:space="preserve">
<data name="Command_ProjectPanel_ShowAllFilesCommand_ToolTip" xml:space="preserve">
<value>Show all files</value>
</data>
<data name="ProjectPanel_SyncWithActiveViewCommand_DisplayText" xml:space="preserve">
<data name="Command_ProjectPanel_SyncWithActiveViewCommand_DisplayText" xml:space="preserve">
<value>Sync with active view</value>
</data>
<data name="ProjectPanel_SyncWithActiveViewCommand_ToolTip" xml:space="preserve">
<data name="Command_ProjectPanel_SyncWithActiveViewCommand_ToolTip" xml:space="preserve">
<value>Sync with active view</value>
</data>
<data name="TemplateCategory_Utility" xml:space="preserve">
<value>Utility</value>
<data name="MainWindow_Title" xml:space="preserve">
<value>Rainmeter Studio</value>
</data>
</root>

View File

@ -1,10 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows.Media;
using RainmeterStudio.UI.Controller;
using RainmeterStudio.Business;
using RainmeterStudio.Core.Utils;
namespace RainmeterStudio.UI
{
@ -26,9 +24,6 @@ namespace RainmeterStudio.UI
/// </summary>
public string Name { get; set; }
#region Display text property
private string _displayText = null;
/// <summary>
/// Gets or sets the display text of the command
/// </summary>
@ -36,22 +31,10 @@ namespace RainmeterStudio.UI
{
get
{
if (_displayText == null)
return Resources.Strings.ResourceManager.GetString(Name + "_DisplayText");
return _displayText;
}
set
{
_displayText = value;
return ResourceProvider.GetString("Command_" + Name + "_DisplayText");
}
}
#endregion
#region ToolTip property
private string _toolTip = null;
/// <summary>
/// Gets or sets the tooltip
/// </summary>
@ -59,20 +42,9 @@ namespace RainmeterStudio.UI
{
get
{
if (_toolTip == null)
return Resources.Strings.ResourceManager.GetString(Name + "_ToolTip");
return _toolTip;
}
set
{
_toolTip = value;
return ResourceProvider.GetString("Command_" + Name + "_ToolTip");
}
}
#endregion
#region Icon property
private ImageSource _icon = null;
/// <summary>
/// Gets or sets the command's icon
@ -81,21 +53,9 @@ namespace RainmeterStudio.UI
{
get
{
if (_icon == null)
return IconProvider.GetIcon(Name);
return _icon;
}
set
{
_icon = value;
return ResourceProvider.GetImage("Command_" + Name + "_Icon");
}
}
#endregion
#region Keyboard shortcut property
private KeyGesture _shortcut;
/// <summary>
/// Gets or sets the keyboard shortcut of this command
@ -104,17 +64,8 @@ namespace RainmeterStudio.UI
{
get
{
if (_shortcut == null)
{
string str = SettingsProvider.GetSetting<string>(Name + "_Shortcut");
return GetKeyGestureFromString(str);
}
return _shortcut;
}
set
{
_shortcut = value;
string str = SettingsProvider.GetSetting<string>("Command_" + Name + "_Shortcut");
return InputHelper.GetKeyGesture(str);
}
}
@ -125,73 +76,20 @@ namespace RainmeterStudio.UI
{
get
{
// Safety check
if (Shortcut == null)
return null;
// Build string
string text = String.Empty;
if ((Shortcut.Modifiers & ModifierKeys.Windows) != 0)
text += "Win+";
if ((Shortcut.Modifiers & ModifierKeys.Control) != 0)
text += "Ctrl+";
if ((Shortcut.Modifiers & ModifierKeys.Alt) != 0)
text += "Alt+";
if ((Shortcut.Modifiers & ModifierKeys.Shift) != 0)
text += "Shift+";
text += Enum.GetName(typeof(Key), Shortcut.Key);
return text;
return SettingsProvider.GetSetting<string>("Command_" + Name + "_Shortcut");
}
set
{
Shortcut = GetKeyGestureFromString(value);
}
}
private KeyGesture GetKeyGestureFromString(string k)
{
// Safety check
if (k == null)
return null;
// Variables
ModifierKeys mods = ModifierKeys.None;
Key key = Key.None;
// Parse each field
foreach (var field in k.Split('+'))
{
// Trim surrounding white space
string trimmed = field.Trim();
// Parse
if (trimmed.Equals("Win", StringComparison.InvariantCultureIgnoreCase))
mods |= ModifierKeys.Windows;
if (trimmed.Equals("Ctrl", StringComparison.InvariantCultureIgnoreCase))
mods |= ModifierKeys.Control;
if (trimmed.Equals("Alt", StringComparison.InvariantCultureIgnoreCase))
mods |= ModifierKeys.Alt;
if (trimmed.Equals("Shift", StringComparison.InvariantCultureIgnoreCase))
mods |= ModifierKeys.Shift;
else Enum.TryParse<Key>(field, out key);
}
return new KeyGesture(key, mods);
}
#endregion
#endregion
/// <summary>
/// Event triggered when the command execution status changes
/// </summary>
public event EventHandler CanExecuteChanged;
/// <summary>
/// Triggers the can execute changed event
/// </summary>
public void NotifyCanExecuteChanged()
{
if (CanExecuteChanged != null)
@ -252,7 +150,7 @@ namespace RainmeterStudio.UI
}
}
public static class UIElementExtensions
public static partial class UIElementExtensions
{
/// <summary>
/// Adds a keyboard shortcut to an UI element

View File

@ -66,7 +66,7 @@ namespace RainmeterStudio.UI.Controller
var dialog = new CreateDocumentDialog(this)
{
Owner = OwnerWindow,
SelectedTemplate = defaultFormat,
SelectedTemplate = new DocumentTemplateViewModel(defaultFormat),
SelectedPath = defaultPath
};
bool? res = dialog.ShowDialog();
@ -78,7 +78,7 @@ namespace RainmeterStudio.UI.Controller
var path = dialog.SelectedPath;
// Call manager
DocumentManager.Create(format);
DocumentManager.Create(format.Template);
}
public void Create(DocumentTemplate format)

View File

@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using RainmeterStudio.Business;
using RainmeterStudio.Core.Model;
using RainmeterStudio.Resources;
namespace RainmeterStudio.UI.Controller
{

View File

@ -1,31 +1,21 @@
<Window x:Class="RainmeterStudio.UI.Dialogs.CreateDocumentDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Create..." Height="250" Width="400"
xmlns:r="clr-namespace:RainmeterStudio.Resources"
Title="{x:Static r:Strings.CreateDocumentDialog_Title}" Height="250" Width="400"
WindowStartupLocation="CenterOwner"
WindowStyle="ToolWindow" ShowInTaskbar="False"
Background="WhiteSmoke" >
<Grid Margin="2px">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="2" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<Grid Margin="2px">
<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"/>
<GridSplitter Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<ListView Name="listFormats" Grid.Row="0" Grid.Column="2" Margin="1px">
<ListView Name="listTemplates" Grid.Row="0" Margin="1px"
SelectionChanged="listFormats_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate>
<DockPanel>
@ -41,7 +31,7 @@
</ListView.ItemTemplate>
</ListView>
<Grid Grid.Row="1" Grid.ColumnSpan="3">
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
@ -52,13 +42,16 @@
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0">Path:</TextBlock>
<TextBlock Grid.Row="0" Text="{x:Static r:Strings.CreateDocumentDialog_Name}" />
<TextBox Name="textPath" Grid.Row="0" Grid.Column="1" Margin="1px"></TextBox>
<Button Grid.Row="0" Grid.Column="2">...</Button>
<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>
</Grid>
<StackPanel Grid.Row="2" Grid.ColumnSpan="3" Orientation="Horizontal"
<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>

View File

@ -1,19 +1,9 @@
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 RainmeterStudio.Business;
using RainmeterStudio.Core.Documents;
using RainmeterStudio.UI.Controller;
using RainmeterStudio.UI.ViewModel;
namespace RainmeterStudio.UI.Dialogs
{
@ -27,15 +17,15 @@ namespace RainmeterStudio.UI.Dialogs
/// <summary>
/// Gets or sets the currently selected file format
/// </summary>
public DocumentTemplate SelectedTemplate
public DocumentTemplateViewModel SelectedTemplate
{
get
{
return listFormats.SelectedItem as DocumentTemplate;
return listTemplates.SelectedItem as DocumentTemplateViewModel;
}
set
{
listFormats.SelectedItem = value;
listTemplates.SelectedItem = value;
}
}
@ -62,29 +52,13 @@ namespace RainmeterStudio.UI.Dialogs
InitializeComponent();
_documentController = docCtrl;
PopulateCategories();
RepopulateFormats();
PopulateFormats();
Validate();
}
private void PopulateCategories()
private void PopulateFormats()
{
listCategories.ItemsSource = _documentController.DocumentTemplates
.Select(template => template.Category)
.Where(cat => cat != null)
.Distinct()
.Concat(new[] { "All" });
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));
listTemplates.ItemsSource = _documentController.DocumentTemplates;
}
private void buttonCreate_Click(object sender, RoutedEventArgs e)
@ -102,15 +76,17 @@ namespace RainmeterStudio.UI.Dialogs
private void Validate()
{
bool res = true;
res &= !String.IsNullOrWhiteSpace(textPath.Text);
res &= (listFormats.SelectedItem != null);
res &= !textPath.Text.Intersect(System.IO.Path.GetInvalidFileNameChars()).Any();
res &= (listTemplates.SelectedItem != null);
buttonCreate.IsEnabled = res;
}
private void listCategories_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void listFormats_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
RepopulateFormats();
Validate();
}
}
}

View File

@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:r="clr-namespace:RainmeterStudio.Resources"
Title="{x:Static r:Strings.ProjectCreateDialog_Title}" Height="320" Width="480"
Title="{x:Static r:Strings.CreateProjectDialog_Title}" Height="320" Width="480"
WindowStartupLocation="CenterOwner"
WindowStyle="ToolWindow" ShowInTaskbar="False">
@ -55,31 +55,31 @@
</Grid.ColumnDefinitions>
<!-- Name -->
<TextBlock Grid.Row="0" Text="{x:Static r:Strings.ProjectCreateDialog_Name}" />
<TextBlock Grid.Row="0" Text="{x:Static r:Strings.CreateProjectDialog_Name}" />
<TextBox Name="textName"
Grid.Row="0" Grid.Column="1"
TextChanged="textName_TextChanged"/>
<!-- Location -->
<TextBlock Grid.Row="1" Text="{x:Static r:Strings.ProjectCreateDialog_Location}" />
<TextBlock Grid.Row="1" Text="{x:Static r:Strings.CreateProjectDialog_Location}" />
<ComboBox Name="textLocation" IsEditable="True"
Grid.Row="1" Grid.Column="1" />
<Button Grid.Row="1" Grid.Column="2" Content="{x:Static r:Strings.Dialog_Browse}"/>
<CheckBox Name="checkLocationDefault"
Grid.Row="1" Grid.Column="3"
Content="{x:Static r:Strings.ProjectCreateDialog_LocationDefault}"
Content="{x:Static r:Strings.CreateProjectDialog_LocationDefault}"
VerticalAlignment="Center"/>
<!-- Path -->
<TextBlock Grid.Row="2" Text="{x:Static r:Strings.ProjectCreateDialog_Path}"/>
<TextBlock Grid.Row="2" Text="{x:Static r:Strings.CreateProjectDialog_Path}"/>
<ComboBox Name="textPath"
IsEditable="True"
Grid.Row="2" Grid.Column="1" />
<Button Grid.Row="2" Grid.Column="2" Content="{x:Static r:Strings.Dialog_Browse}" />
<CheckBox Name="checkCreateDirectory"
Grid.Row="2" Grid.Column="3"
Content="{x:Static r:Strings.ProjectCreateDialog_PathCreateFolder}"
Content="{x:Static r:Strings.CreateProjectDialog_PathCreateFolder}"
IsChecked="True"
Checked="checkCreateDirectory_CheckChanged"
Unchecked="checkCreateDirectory_CheckChanged"

View File

@ -5,7 +5,15 @@
xmlns:ad="clr-namespace:Xceed.Wpf.AvalonDock;assembly=Xceed.Wpf.AvalonDock"
xmlns:adlayout="clr-namespace:Xceed.Wpf.AvalonDock.Layout;assembly=Xceed.Wpf.AvalonDock"
xmlns:r="clr-namespace:RainmeterStudio.Resources"
Title="Rainmeter Studio" Height="600" Width="800"
xmlns:p="clr-namespace:RainmeterStudio.Properties"
Title="{x:Static r:Strings.MainWindow_Title}"
Height="{Binding Source={x:Static p:Settings.Default}, Path=MainWindow_Height, Mode=TwoWay}"
Width="{Binding Source={x:Static p:Settings.Default}, Path=MainWindow_Width, Mode=TwoWay}"
WindowState="{Binding Source={x:Static p:Settings.Default}, Path=MainWindow_WindowState, Mode=TwoWay}"
Left="{Binding Source={x:Static p:Settings.Default}, Path=MainWindow_Left, Mode=TwoWay}"
Top="{Binding Source={x:Static p:Settings.Default}, Path=MainWindow_Top, Mode=TwoWay}"
ResizeMode="CanResizeWithGrip" >
<Grid>

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Media;
using System.Windows.Media;
using RainmeterStudio.Business;
using RainmeterStudio.Core.Documents;
using RainmeterStudio.UI.Controller;
namespace RainmeterStudio.UI.ViewModel
{
@ -20,34 +16,17 @@ namespace RainmeterStudio.UI.ViewModel
/// </summary>
public string Name { get { return Template.Name; } }
#region Icon property
private ImageSource _icon = null;
/// <summary>
/// Gets or sets the icon of this document template
/// </summary>
public virtual ImageSource Icon
public ImageSource Icon
{
get
{
if (_icon == null)
return IconProvider.GetIcon("Template_" + Name);
return _icon;
}
set
{
_icon = value;
return ResourceProvider.GetImage("Template_" + Name + "_Icon");
}
}
#endregion
#region Display text property
private string _displayText = null;
/// <summary>
/// Gets or sets the display text
/// </summary>
@ -55,23 +34,10 @@ namespace RainmeterStudio.UI.ViewModel
{
get
{
if (_displayText == null)
return Resources.Strings.ResourceManager.GetString("Template_" + Name + "_DisplayText");
return _displayText;
}
set
{
_displayText = value;
return ResourceProvider.GetString("Template_" + Name + "_DisplayText");
}
}
#endregion
#region Description property
private string _description = null;
/// <summary>
/// Gets or sets the description of this document template
/// </summary>
@ -79,43 +45,10 @@ namespace RainmeterStudio.UI.ViewModel
{
get
{
if (_description == null)
return Resources.Strings.ResourceManager.GetString("Template_" + Name + "_Description");
return _description;
}
set
{
_description = value;
return ResourceProvider.GetString("Template_" + Name + "_Description");
}
}
#endregion
#region Category property
private string _category = null;
/// <summary>
/// Gets or sets the category of this template
/// </summary>
public string Category
{
get
{
if (_category == null)
return Resources.Strings.ResourceManager.GetString("Template_" + Name + "_Category");
return _category;
}
set
{
_category = value;
}
}
#endregion
/// <summary>
/// Initializes the document template view model
/// </summary>

View File

@ -22,6 +22,21 @@
<setting name="DocumentCloseCommand_Shortcut" serializeAs="String">
<value>Ctrl+W</value>
</setting>
<setting name="MainWindow_Width" serializeAs="String">
<value>800</value>
</setting>
<setting name="MainWindow_Height" serializeAs="String">
<value>600</value>
</setting>
<setting name="MainWindow_WindowState" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="MainWindow_Left" serializeAs="String">
<value>10</value>
</setting>
<setting name="MainWindow_Top" serializeAs="String">
<value>10</value>
</setting>
</RainmeterStudio.Properties.Settings>
</userSettings>
</configuration>