Work on resource and settings managers, added some documentation.

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

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,49 +0,0 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
namespace RainmeterStudio.UI.Controller
{
public static class SettingsProvider
{
/// <summary>
/// Attempts to retrieve the setting of type T, where T is class
/// </summary>
/// <typeparam name="T">Any class type</typeparam>
/// <param name="name">Name of setting</param>
/// <returns>Retrieved setting, or null if not found</returns>
public static T GetSetting<T> (string name) where T : class
{
var property = Properties.Settings.Default.Properties
.OfType<SettingsProperty>()
.FirstOrDefault(x => String.Equals(x.Name, name));
return (property == null) ? null : (property.DefaultValue as T);
}
/// <summary>
/// Attempts to retrieve the setting of type T
/// </summary>
/// <typeparam name="T">Any type</typeparam>
/// <param name="name">Name of setting</param>
/// <param name="value">Output value</param>
/// <returns>True if attempt was successful</returns>
public static bool TryGetSetting<T>(string name, out T value)
{
var property = Properties.Settings.Default.Properties.OfType<SettingsProperty>().FirstOrDefault(x => x.Name.Equals(name));
if (property != null)
{
value = (T)property.DefaultValue;
return true;
}
else
{
value = default(T);
return false;
}
}
}
}