Html5Command.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. /* ==============================================================================
  2. * 功能描述:HTML5嵌入的命令
  3. * 创 建 者:Garrett
  4. * 创建日期:2018/3/27 11:42:20
  5. * ==============================================================================*/
  6. using System;
  7. using System.Collections.Generic;
  8. using System.IO;
  9. using System.Linq;
  10. using System.Text.RegularExpressions;
  11. using System.Windows;
  12. using Autodesk.Revit.Attributes;
  13. using Autodesk.Revit.DB;
  14. using Autodesk.Revit.DB.ExtensibleStorage;
  15. using Autodesk.Revit.DB.Mechanical;
  16. using Autodesk.Revit.UI;
  17. using CEFSharpWpf;
  18. using SAGA.DotNetUtils;
  19. using SAGA.DotNetUtils.Extend;
  20. using SAGA.DotNetUtils.Logger;
  21. using SAGA.MBI.Common;
  22. using SAGA.MBI.DataArrange;
  23. using SAGA.MBI.Login;
  24. using SAGA.MBI.Model;
  25. using SAGA.MBI.Tools;
  26. using SAGA.MBI.WinView;
  27. using SAGA.MBI.WinView.BeModingDutyList;
  28. using SAGA.MBI.WinView.Login;
  29. using SAGA.MBI.WinView.ModeInfoMaintenance;
  30. using SAGA.MBI.WinView.PositionBeaconModeling;
  31. using SAGA.MBI.WinView.Space;
  32. using SAGA.MBI.WinView.Upload;
  33. using SAGA.RevitUtils;
  34. using SAGA.RevitUtils.Extends;
  35. using SAGA.RevitUtils.Windows;
  36. using Application = Autodesk.Revit.Creation.Application;
  37. using Visibility = System.Windows.Visibility;
  38. namespace SAGA.MBI
  39. {
  40. /// <summary>
  41. /// 扫楼日志页
  42. /// </summary>
  43. [Transaction(TransactionMode.Manual)]
  44. [Regeneration(RegenerationOption.Manual)]
  45. public class ScanLogsCommand : ExternalCommand, IExternalCommandAvailability
  46. {
  47. public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
  48. {
  49. try
  50. {
  51. //var win = new WinScanLogs(new UrlInfo() { Url = "ScanLogs.html", Title = "扫楼日志" });
  52. //win.ShowDialog();
  53. string url = $"{MBIConst.Html5ScanLocalHost}buildLog?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
  54. var win = WinBrowser.Instance;
  55. win.Show(url, "扫楼日志");
  56. win.Height = 854;
  57. win.Width = 1530;
  58. win.Left = 320;
  59. win.Top = 190;
  60. }
  61. catch (Exception e)
  62. {
  63. MessageShow.Show(e);
  64. return Result.Cancelled;
  65. }
  66. return Result.Succeeded;
  67. }
  68. /// <summary>
  69. /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
  70. /// when a document is open.
  71. /// </summary>
  72. public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
  73. {
  74. return true;
  75. }
  76. }
  77. /// <summary>
  78. /// 扫楼数据整理
  79. /// </summary>
  80. [Transaction(TransactionMode.Manual)]
  81. [Regeneration(RegenerationOption.Manual)]
  82. public class ScanDataCommand : ExternalCommand, IExternalCommandAvailability
  83. {
  84. public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
  85. {
  86. try
  87. {
  88. //var win = new WinScanLogs(new UrlInfo() {
  89. // Url = "Element-ui-s.html",
  90. // Title = "扫楼数据整理"
  91. //});
  92. //win.ShowDialog();
  93. string url = $"{MBIConst.Html5ScanLocalHost}buildData?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
  94. var win = WinBrowser.Instance;
  95. win.Show(url, "扫楼数据整理");
  96. win.Height = 854;
  97. win.Width = 1530;
  98. win.Left = 320;
  99. win.Top = 190;
  100. }
  101. catch (Exception e)
  102. {
  103. MessageShow.Show(e);
  104. return Result.Cancelled;
  105. }
  106. return Result.Succeeded;
  107. }
  108. /// <summary>
  109. /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
  110. /// when a document is open.
  111. /// </summary>
  112. public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
  113. {
  114. return true;
  115. }
  116. }
  117. /// <summary>
  118. /// 扫楼用户管理
  119. /// </summary>
  120. [Transaction(TransactionMode.Manual)]
  121. [Regeneration(RegenerationOption.Manual)]
  122. public class ScanUserCommand : ExternalCommand, IExternalCommandAvailability
  123. {
  124. public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
  125. {
  126. try
  127. {
  128. //var win = new WinScanLogs(new UrlInfo() {
  129. // Url = "user.html",
  130. // Title = "扫楼用户管理"
  131. //});
  132. //win.ShowDialog();
  133. string url = $"{MBIConst.Html5ScanLocalHost}buildUser?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
  134. var win = WinBrowser.Instance;
  135. win.Show(url, "扫楼用户管理");
  136. win.Height = 854;
  137. win.Width = 1530;
  138. win.Left = 320;
  139. win.Top = 190;
  140. }
  141. catch (Exception e)
  142. {
  143. MessageShow.Show(e);
  144. return Result.Cancelled;
  145. }
  146. return Result.Succeeded;
  147. }
  148. /// <summary>
  149. /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
  150. /// when a document is open.
  151. /// </summary>
  152. public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
  153. {
  154. return true;
  155. }
  156. }
  157. /// <summary>
  158. /// 扫楼异常资产
  159. /// </summary>
  160. [Transaction(TransactionMode.Manual)]
  161. [Regeneration(RegenerationOption.Manual)]
  162. [Journaling(JournalingMode.UsingCommandData)]
  163. public class ScanExceptionFMCommand : ExternalCommand, IExternalCommandAvailability
  164. {
  165. public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
  166. {
  167. try
  168. {
  169. //var win = new WinScanLogs(new UrlInfo() {
  170. // Url = "user.html",
  171. // Title = "扫楼用户管理"
  172. //});
  173. //win.ShowDialog();
  174. string url = $"{MBIConst.Html5ScanLocalHost}buildAssets?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}&secret={MBIControl.ProjectCur.Password}";
  175. var win = WinBrowser.Instance;
  176. win.Show(url, "扫楼异常资产");
  177. win.Height = 854;
  178. win.Width = 1530;
  179. win.Left = 320;
  180. win.Top = 190;
  181. }
  182. catch (Exception e)
  183. {
  184. MessageShow.Show(e);
  185. return Result.Cancelled;
  186. }
  187. return Result.Succeeded;
  188. }
  189. /// <summary>
  190. /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
  191. /// when a document is open.
  192. /// </summary>
  193. public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
  194. {
  195. return true;
  196. }
  197. }
  198. /// <summary>
  199. /// 设置需采集的信息
  200. /// </summary>
  201. [Transaction(TransactionMode.Manual)]
  202. [Regeneration(RegenerationOption.Manual)]
  203. [Journaling(JournalingMode.UsingCommandData)]
  204. public class SetCollectInfosCommand : ExternalCommand, IExternalCommandAvailability
  205. {
  206. public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
  207. {
  208. try
  209. {
  210. string url = $"{MBIConst.Html5ScanLocalHost}buildFamily?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
  211. var win = WinBrowser.Instance;
  212. win.Show(url, "扫楼设置App信息点");
  213. win.Height = 854;
  214. win.Width = 1530;
  215. win.Left = 320;
  216. win.Top = 190;
  217. }
  218. catch (Exception e)
  219. {
  220. MessageShow.Show(e);
  221. return Result.Cancelled;
  222. }
  223. return Result.Succeeded;
  224. }
  225. /// <summary>
  226. /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
  227. /// when a document is open.
  228. /// </summary>
  229. public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
  230. {
  231. return true;
  232. }
  233. }
  234. /// <summary>
  235. /// 楼层平面图管理
  236. /// </summary>
  237. [Transaction(TransactionMode.Manual)]
  238. [Regeneration(RegenerationOption.Manual)]
  239. [Journaling(JournalingMode.UsingCommandData)]
  240. public class FloorPlanManageCommand : ExternalCommand, IExternalCommandAvailability
  241. {
  242. public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
  243. {
  244. try
  245. {
  246. //http://172.16.0.181:8888/#/buildGraphy?projId=Pj1101080003&userId=25518428919955458&secret=***
  247. string url = $"{MBIConst.Html5ScanLocalHost}buildGraphy?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}&secret={MBIConst.ProjectSecret}";
  248. var win = WinBrowser.Instance;
  249. win.Show(url, "楼层平面图管理");
  250. win.Height = 854;
  251. win.Width = 1530;
  252. win.Left = 320;
  253. win.Top = 190;
  254. }
  255. catch (Exception e)
  256. {
  257. MessageShow.Show(e);
  258. return Result.Cancelled;
  259. }
  260. return Result.Succeeded;
  261. }
  262. /// <summary>
  263. /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
  264. /// when a document is open.
  265. /// </summary>
  266. public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
  267. {
  268. return true;
  269. }
  270. }
  271. /// <summary>
  272. /// 业务空间清单
  273. /// </summary>
  274. [Transaction(TransactionMode.Manual)]
  275. [Regeneration(RegenerationOption.Manual)]
  276. [Journaling(JournalingMode.UsingCommandData)]
  277. public class SpaceListCommand : ExternalCommand, IExternalCommandAvailability
  278. {
  279. public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
  280. {
  281. try
  282. {
  283. //http://172.16.0.181:8888/#/businessSpace?projId=Pj1101080003&secret=saga123456
  284. string url = $"{MBIConst.Html5ScanLocalHost}businessSpace?projId={MBIControl.ProjectCur.Id}&secret={MBIConst.ProjectSecret}";
  285. var win = WinBrowser.Instance;
  286. win.Show(url, "业务空间清单");
  287. win.Height = 854;
  288. win.Width = 1530;
  289. win.Left = 320;
  290. win.Top = 190;
  291. }
  292. catch (Exception e)
  293. {
  294. MessageShow.Show(e);
  295. return Result.Cancelled;
  296. }
  297. return Result.Succeeded;
  298. }
  299. /// <summary>
  300. /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
  301. /// when a document is open.
  302. /// </summary>
  303. public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
  304. {
  305. return true;
  306. }
  307. }
  308. }