Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="listArg"></param>
        /// <returns></returns>
        private static bool ExecuteService(string commandName, ScheduleCommandArgList listArg, bool langIsEn = false)//参数不考虑顺序可以使用Dictionary
        {
            CommandImpService service = CreateCommandService();
            string            result  = service.exe(GetCommandArgs(commandName, listArg, langIsEn));

            return("true".Equals(result, StringComparison.OrdinalIgnoreCase));
        }
Exemplo n.º 2
0
        private static void ExecuteServiceAsync(string commandName, ScheduleCommandArgList listArg, CompleteScheduleCommand callback, bool langIsEn = false)
        {
            CommandImpService service = CreateCommandService();

            service.exeCompleted += (object sender, exeCompletedEventArgs e) =>
            {
                if (e.Error != null)
                {
                    System.Windows.MessageBox.Show(e.Error.Message, "执行命令错误");
                }
                else if (e.Cancelled)
                {
                    System.Windows.MessageBox.Show("命令被取消!");
                }
                else if (!string.IsNullOrWhiteSpace(e.Result))
                {
                    if (callback != null)
                    {
                        callback("true".Equals(e.Result, StringComparison.OrdinalIgnoreCase));
                    }
                }
            };
            service.exeAsync(GetCommandArgs(commandName, listArg, langIsEn));
        }