89 lines
2.1 KiB
C#
89 lines
2.1 KiB
C#
using Autodesk.Revit.DB;
|
|
using KMBIM.Revit.Tools.License;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Runtime.Serialization;
|
|
using System.Runtime.Serialization.Formatters.Binary;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using System.Xml;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace KMBIM.Revit.Tools
|
|
{
|
|
[Serializable()]
|
|
public sealed class WorkMain
|
|
{
|
|
private static volatile WorkMain _instance;
|
|
// Lock synchronization object
|
|
private static object syncLock = new object();
|
|
|
|
|
|
public bool IsOpend { get; set; }
|
|
public string AppPath { get; set; }
|
|
public string SettingsPath { get; set; }
|
|
|
|
|
|
public bool IsValid { get; set; }
|
|
|
|
|
|
public List<Parameter> CopiedParameters { get; set; } // 복사한 파라미터
|
|
public Element CopiedParametersElement { get; set; } // 복사한 파라미터의 소유자(요소)
|
|
|
|
|
|
|
|
private WorkMain()
|
|
{
|
|
IsOpend = false;
|
|
string FullPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
|
AppPath = Path.GetDirectoryName(FullPath);
|
|
SettingsPath = GetSettingsFolders();
|
|
CopiedParametersElement = null;
|
|
CopiedParameters = new List<Parameter>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static string GetSettingsFolders()
|
|
{
|
|
string strTempPath = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
|
if (strTempPath.Last() != '\\')
|
|
{
|
|
strTempPath += "\\";
|
|
}
|
|
|
|
string settingsFolder = strTempPath + "KMBIMRevitXTools";
|
|
return settingsFolder;
|
|
}
|
|
|
|
public static WorkMain GetInstance()
|
|
{
|
|
if (_instance == null)
|
|
{
|
|
|
|
lock (syncLock)
|
|
{
|
|
|
|
if (_instance == null)
|
|
{
|
|
_instance = new WorkMain();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
return _instance;
|
|
|
|
}
|
|
|
|
}
|
|
}
|