mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Fixes for project manager
This commit is contained in:
@ -31,6 +31,8 @@ namespace RainmeterStudio.UI.Controller
|
||||
|
||||
public Command DocumentCreateCommand { get; private set; }
|
||||
|
||||
public Command DocumentOpenCommand { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
@ -58,25 +60,22 @@ namespace RainmeterStudio.UI.Controller
|
||||
DocumentManager = documentManager;
|
||||
ProjectManager = projectManager;
|
||||
|
||||
DocumentCreateCommand = new Command("DocumentCreateCommand", () => CreateWindow());
|
||||
DocumentCreateCommand = new Command("DocumentCreateCommand", () => Create(), () => ProjectManager.ActiveProject != null);
|
||||
ProjectManager.ActiveProjectChanged += new EventHandler((obj, e) => DocumentCreateCommand.NotifyCanExecuteChanged());
|
||||
}
|
||||
|
||||
public void CreateWindow(IDocumentTemplate defaultFormat = null, string defaultPath = "")
|
||||
public void Create()
|
||||
{
|
||||
// Show dialog
|
||||
var dialog = new CreateDocumentDialog(this)
|
||||
{
|
||||
Owner = OwnerWindow,
|
||||
SelectedTemplate = new DocumentTemplateViewModel(defaultFormat),
|
||||
SelectedPath = defaultPath
|
||||
};
|
||||
var dialog = new CreateDocumentDialog(this);
|
||||
dialog.Owner = OwnerWindow;
|
||||
bool? res = dialog.ShowDialog();
|
||||
|
||||
if (!res.HasValue || !res.Value)
|
||||
return;
|
||||
|
||||
var format = dialog.SelectedTemplate;
|
||||
var path = dialog.SelectedPath;
|
||||
var path = dialog.SelectedName;
|
||||
|
||||
// Call manager
|
||||
DocumentManager.Create(format.Template);
|
||||
|
@ -8,6 +8,7 @@ using RainmeterStudio.Business;
|
||||
using RainmeterStudio.Core.Model;
|
||||
using RainmeterStudio.UI.Dialogs;
|
||||
using RainmeterStudio.UI.ViewModel;
|
||||
using RainmeterStudio.Properties;
|
||||
|
||||
namespace RainmeterStudio.UI.Controller
|
||||
{
|
||||
@ -115,9 +116,10 @@ namespace RainmeterStudio.UI.Controller
|
||||
|
||||
string selectedName = dialog.SelectedName;
|
||||
string selectedPath = dialog.SelectedPath;
|
||||
IProjectTemplate selectedTemplate = dialog.SelectedTemplate;
|
||||
|
||||
// Call manager
|
||||
Manager.CreateProject(selectedName, selectedPath);
|
||||
Manager.CreateProject(selectedName, selectedPath, selectedTemplate);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -132,6 +134,7 @@ namespace RainmeterStudio.UI.Controller
|
||||
+ Resources.Strings.Dialog_FileType_AllFiles + "|*.*";
|
||||
dialog.Title = Resources.Strings.Dialog_OpenProject_Title;
|
||||
dialog.Multiselect = false;
|
||||
dialog.InitialDirectory = Settings.Default.Project_SavedLocation;
|
||||
|
||||
// Show dialog
|
||||
bool? res = dialog.ShowDialog(OwnerWindow);
|
||||
|
Reference in New Issue
Block a user