/// <summary> /// 由Id唤醒方法 /// </summary> /// <param name="commandData"></param> /// <param name="message"></param> /// <param name="elements"></param> /// <param name="strUseId"></param> /// <returns></returns> private Result InvokeById(ExternalCommandData commandData, ref string message, ElementSet elements, string strUseId) { //实际处理器 IExternalCommand tempCommand = null; //设置addinId DEBUGUtility.SetAddInId(strUseId); //缓存判断 if (!m_useCommandObject.ContainsKey(strUseId)) { //获取命令对象 var useCommandPacker = m_useCMDDic[strUseId]; object tempCommandObj = CreatObjByHandlerInfo(useCommandPacker); //多态转换 tempCommand = tempCommandObj as IExternalCommand; m_useCommandObject.Add(strUseId, tempCommand); } else { tempCommand = m_useCommandObject[strUseId]; } //若是debug模式不单例命令对象 if (DEBUGUtility.IfDebugModel) { //清除已缓存命令对象 m_useCommandObject.Remove(strUseId); } return(tempCommand.Execute(commandData, ref message, elements)); }
protected virtual void SetupData() { _retainFeedXml = false; _now = new DateTime(2010, 5, 1, 16, 11, 12); _feedAddress = "http://test"; _feedInfo = new FeedInfo(_controlFile); _feedInfo.Format.Value = PodcastFeedFormat.RSS; _feedInfo.NamingStyle.Value = PodcastEpisodeNamingStyle.UrlFileName; _feedInfo.Address = new Uri(_feedAddress); _feedInfo.MaximumDaysOld.Value = int.MaxValue; _feedInfo.DownloadStrategy.Value = PodcastEpisodeDownloadStrategy.All; _retryWaitTime = 13; _rootFolder = "c:\\TestRoot"; _podcastInfo = new PodcastInfo(_controlFile); _podcastInfo.Folder = "TestFolder"; _podcastInfo.Feed = _feedInfo; _podcastFeedItems = new List <IPodcastFeedItem>(10); _externalCommand = new ExternalCommand(); }
public static Result RunCommand <T>() where T : IExternalCommand { Result result = Result.Failed; Type type = typeof(T); IExternalCommand icmd = Activator.CreateInstance(type) as IExternalCommand; result = icmd.Execute(Helper.CommandData, ref Helper.Message, Helper.ElementSet); return(Result.Succeeded); }
public static IExternalCommand GetCommandFromType(Type type) { IExternalCommand command = Activator.CreateInstance(type) as IExternalCommand; if (command == null) { throw new Exception("Could not get Remote Command"); } return(command); }
public async Task Publish(IExternalCommand command) { var factory = new ConnectionFactory { HostName = config.HostName, UserName = "******", Password = "******" }; using (var connection = factory.CreateConnection()) using (var channel = connection.CreateModel()) { channel.QueueDeclare(queue: command.GetType().Name, durable: true, exclusive: false, autoDelete: false, arguments: null); var body = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(command)); channel.BasicPublish(exchange: "", routingKey: command.GetType().Name, basicProperties: null, body: body); } //_channel.BasicPublish("logs", routingKey: "Commands.ValidUser", basicProperties: null, body: body); }
/// <summary> /// Creates a push button data. /// </summary> /// <returns></returns> public static PushButtonData CreatePushButtonData(this IExternalCommand cmd, string text, ImageSource image, bool isAvailable = false) { if (string.IsNullOrEmpty(text)) { throw new ArgumentNullException(nameof(text)); } if (image == null) { throw new ArgumentNullException(nameof(image)); } var type = cmd.GetType(); return(new PushButtonData(type.Name, text, type.Assembly.Location, type.FullName) { LargeImage = image, AvailabilityClassName = isAvailable ? type.FullName : null }); }
public CommandExportSvfzip() { _Command = new InnerCommandExportSvfzip(); }
public CommandExportGltf() { _Command = new InnerCommandExportGltf(); }
public CommandExportCesium3DTiles() { _Command = new InnerCommandExportCesium3DTiles(); }