123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329 |
- /* ==============================================================================
- * 功能描述:HTML5嵌入的命令
- * 创 建 者:Garrett
- * 创建日期:2018/3/27 11:42:20
- * ==============================================================================*/
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Windows;
- using Autodesk.Revit.Attributes;
- using Autodesk.Revit.DB;
- using Autodesk.Revit.DB.ExtensibleStorage;
- using Autodesk.Revit.DB.Mechanical;
- using Autodesk.Revit.UI;
- using CEFSharpWpf;
- using SAGA.DotNetUtils;
- using SAGA.DotNetUtils.Extend;
- using SAGA.DotNetUtils.Logger;
- using SAGA.MBI.Common;
- using SAGA.MBI.DataArrange;
- using SAGA.MBI.Login;
- using SAGA.MBI.Model;
- using SAGA.MBI.Tools;
- using SAGA.MBI.WinView;
- using SAGA.MBI.WinView.BeModingDutyList;
- using SAGA.MBI.WinView.Login;
- using SAGA.MBI.WinView.ModeInfoMaintenance;
- using SAGA.MBI.WinView.PositionBeaconModeling;
- using SAGA.MBI.WinView.Space;
- using SAGA.MBI.WinView.Upload;
- using SAGA.RevitUtils;
- using SAGA.RevitUtils.Extends;
- using SAGA.RevitUtils.Windows;
- using Application = Autodesk.Revit.Creation.Application;
- using Visibility = System.Windows.Visibility;
- namespace SAGA.MBI
- {
- /// <summary>
- /// 扫楼日志页
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class ScanLogsCommand : ExternalCommand, IExternalCommandAvailability
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- try
- {
- //var win = new WinScanLogs(new UrlInfo() { Url = "ScanLogs.html", Title = "扫楼日志" });
- //win.ShowDialog();
- string url = $"{MBIConst.Html5ScanLocalHost}buildLog?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
-
- var win = WinBrowser.Instance;
- win.Show(url, "扫楼日志");
- win.Height = 854;
- win.Width = 1530;
- win.Left = 320;
- win.Top = 190;
- }
- catch (Exception e)
- {
- MessageShow.Show(e);
- return Result.Cancelled;
- }
- return Result.Succeeded;
- }
- /// <summary>
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
- /// when a document is open.
- /// </summary>
- public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 扫楼数据整理
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class ScanDataCommand : ExternalCommand, IExternalCommandAvailability
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- try
- {
- //var win = new WinScanLogs(new UrlInfo() {
- // Url = "Element-ui-s.html",
- // Title = "扫楼数据整理"
- //});
- //win.ShowDialog();
- string url = $"{MBIConst.Html5ScanLocalHost}buildData?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
- var win = WinBrowser.Instance;
- win.Show(url, "扫楼数据整理");
- win.Height = 854;
- win.Width = 1530;
- win.Left = 320;
- win.Top = 190;
- }
- catch (Exception e)
- {
- MessageShow.Show(e);
- return Result.Cancelled;
- }
- return Result.Succeeded;
- }
- /// <summary>
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
- /// when a document is open.
- /// </summary>
- public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 扫楼用户管理
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class ScanUserCommand : ExternalCommand, IExternalCommandAvailability
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- try
- {
- //var win = new WinScanLogs(new UrlInfo() {
- // Url = "user.html",
- // Title = "扫楼用户管理"
- //});
- //win.ShowDialog();
- string url = $"{MBIConst.Html5ScanLocalHost}buildUser?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
- var win = WinBrowser.Instance;
- win.Show(url, "扫楼用户管理");
- win.Height = 854;
- win.Width = 1530;
- win.Left = 320;
- win.Top = 190;
- }
- catch (Exception e)
- {
- MessageShow.Show(e);
- return Result.Cancelled;
- }
- return Result.Succeeded;
- }
- /// <summary>
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
- /// when a document is open.
- /// </summary>
- public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 扫楼异常资产
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- [Journaling(JournalingMode.UsingCommandData)]
- public class ScanExceptionFMCommand : ExternalCommand, IExternalCommandAvailability
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- try
- {
- //var win = new WinScanLogs(new UrlInfo() {
- // Url = "user.html",
- // Title = "扫楼用户管理"
- //});
- //win.ShowDialog();
- string url = $"{MBIConst.Html5ScanLocalHost}buildAssets?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}&secret={MBIControl.ProjectCur.Password}";
- var win = WinBrowser.Instance;
- win.Show(url, "扫楼异常资产");
- win.Height = 854;
- win.Width = 1530;
- win.Left = 320;
- win.Top = 190;
- }
- catch (Exception e)
- {
- MessageShow.Show(e);
- return Result.Cancelled;
- }
- return Result.Succeeded;
- }
- /// <summary>
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
- /// when a document is open.
- /// </summary>
- public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 设置需采集的信息
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- [Journaling(JournalingMode.UsingCommandData)]
- public class SetCollectInfosCommand : ExternalCommand, IExternalCommandAvailability
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- try
- {
- string url = $"{MBIConst.Html5ScanLocalHost}buildFamily?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}";
- var win = WinBrowser.Instance;
- win.Show(url, "扫楼设置App信息点");
- win.Height = 854;
- win.Width = 1530;
- win.Left = 320;
- win.Top = 190;
- }
- catch (Exception e)
- {
- MessageShow.Show(e);
- return Result.Cancelled;
- }
- return Result.Succeeded;
- }
- /// <summary>
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
- /// when a document is open.
- /// </summary>
- public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 楼层平面图管理
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- [Journaling(JournalingMode.UsingCommandData)]
- public class FloorPlanManageCommand : ExternalCommand, IExternalCommandAvailability
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- try
- {
- //http://172.16.0.181:8888/#/buildGraphy?projId=Pj1101080003&userId=25518428919955458&secret=***
- string url = $"{MBIConst.Html5ScanLocalHost}buildGraphy?projId={MBIControl.ProjectCur.Id}&userId={MBIControl.ManageInfo.Person_Id}&secret={MBIConst.ProjectSecret}";
- var win = WinBrowser.Instance;
- win.Show(url, "楼层平面图管理");
- win.Height = 854;
- win.Width = 1530;
- win.Left = 320;
- win.Top = 190;
- }
- catch (Exception e)
- {
- MessageShow.Show(e);
- return Result.Cancelled;
- }
- return Result.Succeeded;
- }
- /// <summary>
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
- /// when a document is open.
- /// </summary>
- public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 业务空间清单
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- [Journaling(JournalingMode.UsingCommandData)]
- public class SpaceListCommand : ExternalCommand, IExternalCommandAvailability
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- try
- {
- //http://172.16.0.181:8888/#/businessSpace?projId=Pj1101080003&secret=saga123456
- string url = $"{MBIConst.Html5ScanLocalHost}businessSpace?projId={MBIControl.ProjectCur.Id}&secret={MBIConst.ProjectSecret}";
- var win = WinBrowser.Instance;
- win.Show(url, "业务空间清单");
- win.Height = 854;
- win.Width = 1530;
- win.Left = 320;
- win.Top = 190;
- }
- catch (Exception e)
- {
- MessageShow.Show(e);
- return Result.Cancelled;
- }
- return Result.Succeeded;
- }
- /// <summary>
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
- /// when a document is open.
- /// </summary>
- public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- }
|