mirror of
				https://github.com/chibicitiberiu/rainmeter-studio.git
				synced 2024-02-24 04:33:31 +00:00 
			
		
		
		
	Completed rename from RainmeterEditor to RainmeterStudio
This commit is contained in:
		
							
								
								
									
										78
									
								
								RainmeterStudio/Business/DocumentManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								RainmeterStudio/Business/DocumentManager.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,78 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using RainmeterStudio.Model;
 | 
			
		||||
using RainmeterStudio.Model.Events;
 | 
			
		||||
 | 
			
		||||
namespace RainmeterStudio.Business
 | 
			
		||||
{
 | 
			
		||||
    public class DocumentManager
 | 
			
		||||
    {
 | 
			
		||||
        #region Singleton instance
 | 
			
		||||
        private static DocumentManager _instance = null;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Gets the instance of DocumentManager
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public static DocumentManager Instance
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (_instance == null)
 | 
			
		||||
                    _instance = new DocumentManager();
 | 
			
		||||
 | 
			
		||||
                return _instance;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        private DocumentManager()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        List<IDocumentEditorFactory> _factories = new List<IDocumentEditorFactory>();
 | 
			
		||||
        List<IDocumentEditor> _editors = new List<IDocumentEditor>();
 | 
			
		||||
 | 
			
		||||
        public event EventHandler<DocumentOpenedEventArgs> DocumentOpened;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Registers a document editor factory
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="factory">Document editor factory</param>
 | 
			
		||||
        public void RegisterEditorFactory(IDocumentEditorFactory factory)
 | 
			
		||||
        {
 | 
			
		||||
            _factories.Add(factory);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Creates a new document in the specified path, with the specified format, and opens it
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="format"></param>
 | 
			
		||||
        /// <param name="path"></param>
 | 
			
		||||
        public void Create(DocumentFormat format, string path)
 | 
			
		||||
        {
 | 
			
		||||
            // Create document
 | 
			
		||||
            var document = format.Factory.CreateDocument(format, path);
 | 
			
		||||
 | 
			
		||||
            // Create editor
 | 
			
		||||
            var editor = format.Factory.CreateEditor(document);
 | 
			
		||||
            _editors.Add(editor);
 | 
			
		||||
 | 
			
		||||
            // Trigger event
 | 
			
		||||
            if (DocumentOpened != null)
 | 
			
		||||
                DocumentOpened(this, new DocumentOpenedEventArgs(editor));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public IEnumerable<DocumentFormat> DocumentFormats
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                foreach (var f in _factories)
 | 
			
		||||
                    foreach (var df in f.CreateDocumentFormats)
 | 
			
		||||
                        yield return df;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										16
									
								
								RainmeterStudio/Business/ProjectManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								RainmeterStudio/Business/ProjectManager.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using RainmeterStudio.Model;
 | 
			
		||||
 | 
			
		||||
namespace RainmeterStudio.Business
 | 
			
		||||
{
 | 
			
		||||
    public class ProjectManager
 | 
			
		||||
    {
 | 
			
		||||
        public Project ActiveProject { get; protected set; }
 | 
			
		||||
 | 
			
		||||
        public void Open() { }
 | 
			
		||||
        public void Close() { }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user