Work on project manager and project panel

This commit is contained in:
2014-07-27 16:21:06 +03:00
parent 48972dfb52
commit 5e526fa48c
40 changed files with 961 additions and 139 deletions

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using RainmeterStudio.Model;
@ -16,11 +17,6 @@ namespace RainmeterStudio.Business
/// </summary>
public Project ActiveProject { get; protected set; }
/// <summary>
/// Gets the currently opened project's path
/// </summary>
public string ActiveProjectPath { get; protected set; }
/// <summary>
/// Gets or sets the project storage
/// </summary>
@ -61,9 +57,10 @@ namespace RainmeterStudio.Business
// Create project object
ActiveProject = new Project();
ActiveProject.Name = name;
ActiveProject.Path = path;
// Save to file
ActiveProjectPath = path;
Directory.CreateDirectory(Path.GetDirectoryName(path));
SaveActiveProject();
// Raise event
@ -83,7 +80,7 @@ namespace RainmeterStudio.Business
// Open using storage
ActiveProject = Storage.Load(path);
ActiveProjectPath = path;
ActiveProject.Path = path;
// Raise event
if (ActiveProjectChanged != null)
@ -100,7 +97,7 @@ namespace RainmeterStudio.Business
throw new InvalidOperationException("Cannot save a project that is not opened.");
// Save
Storage.Save(ActiveProjectPath, ActiveProject);
Storage.Save(ActiveProject.Path, ActiveProject);
}
/// <summary>
@ -109,7 +106,6 @@ namespace RainmeterStudio.Business
public void Close()
{
ActiveProject = null;
ActiveProjectPath = null;
// Raise event
if (ActiveProjectChanged != null)