小编lpi*_*nho的帖子

Xamarin Android - 使用复杂参数(对象)发出Rest请求抛出异常,在.NET中它工作正常(使用通道工厂)

我开始使用mono droid或Xamarin for Android,所以,我的想法是重用我已经在.NET中使用的大部分代码.

我需要我的android和ios应用程序做的事情之一就是使用带有json编码的wcf rest调用Web服务.

所以我的代码很简单:

WebHttpBinding webBinding = new WebHttpBinding();
EndpointAddress endPointAddress = new EndpointAddress("http://192.168.126.24:8025/Services/SecurityManagement");
ChannelFactory<ISecurityManagement> newFactory = new ChannelFactory<ISecurityManagement>(webBinding, endPointAddress);

newFactory.Endpoint.Behaviors.Add(new WebHttpBehavior() { DefaultOutgoingRequestFormat = System.ServiceModel.Web.WebMessageFormat.Json, DefaultOutgoingResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json });

newFactory.Endpoint.Behaviors.Add(new RestEndPointBehavior());

ISecurityManagement newProxy = newFactory.CreateChannel();
ValidateUserExistenceOutput output = newProxy.ValidateUserExistence(new ValidateUserExistenceInput() { Domain = "CRITICAL", Username = "myUserName" });
Run Code Online (Sandbox Code Playgroud)

很简单,让我开始(至少,这是我的单声道的想法,使单声道的.net重用)

但是,当我运行此代码时,我得到以下异常异常:

System.NotSupportedException: Loading...
07-25 10:43:40.922 E/mono    ( 1950): 
07-25 10:43:40.922 E/mono    ( 1950): Unhandled Exception:
07-25 10:43:40.922 E/mono    ( 1950): System.NotSupportedException: Conversion from the argument parameterType 'BusinessOrchestration.SecurityManagement.InputObjects.ValidateUserExistenceInput' …
Run Code Online (Sandbox Code Playgroud)

rest wcf android xamarin

5
推荐指数
1
解决办法
705
查看次数

ICSharpCode.Decompiler + Mono.Cecil - >如何为单个方法生成代码?

我可以使用Mono.Cecil和ICSharpCode.Decompiler来生成类型或程序集的代码.

但是,如果我尝试为单个方法生成代码,我将收到错误"对象引用未设置为对象的实例".

你们能给我任何关于此的提示吗?感谢所有的帮助.

用于为程序集内的所有类型生成代码的代码:

DirectoryInfo di = new DirectoryInfo(appPath);
FileInfo[] allAssemblies = di.GetFiles("*.dll");
foreach (var assemblyFile in allAssemblies)
{
    string pathToAssembly = assemblyFile.FullName;
    System.Reflection.Assembly assembly = System.Reflection.Assembly.ReflectionOnlyLoadFrom(pathToAssembly);
    Mono.Cecil.AssemblyDefinition assemblyDefinition = Mono.Cecil.AssemblyDefinition.ReadAssembly(pathToAssembly,parameters);
    AstBuilder astBuilder = null;

    foreach (var typeInAssembly in assemblyDefinition.MainModule.Types)
    {
        if (typeInAssembly.IsPublic)
        {
             Console.WriteLine("T:{0}", typeInAssembly.Name);
            //just reset the builder to include only code for a single type
            astBuilder = new AstBuilder(new ICSharpCode.Decompiler.DecompilerContext(assemblyDefinition.MainModule));
            astBuilder.AddType(typeInAssembly);
            StringWriter output = new StringWriter();
            astBuilder.GenerateCode(new PlainTextOutput(output));
            string result = output.ToString();
            output.Dispose();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

用于为程序集内的所有公共方法生成代码的代码: …

c# reflection icsharpcode decompiler mono.cecil

4
推荐指数
1
解决办法
5027
查看次数

在软件键盘上绑定"GO"键

我有一个登录按钮绑定到我ViewModel喜欢的命令中,所以:

this.AddBindings(new Dictionary<object, string>{{btnLogin,"TouchUpInside LoginCommand"}});
Run Code Online (Sandbox Code Playgroud)

如果在键盘外部某处进行触摸,则会禁止软键盘UITextField.为了防止用户必须在屏幕上某处单击一次以使键盘消失然后按下登录按钮,我想将键盘中定义的登录命令ViewModel与"GO"键相关联.这可能吗?

xamarin.ios mvvmcross xamarin

3
推荐指数
2
解决办法
1250
查看次数

iText 7:如何构建混合不同字体的段落?

我一直在使用iText 7来构建pdf文件,不幸的是,iText 7与iText 5非常不同,文档仍然非常不完整.

我正在尝试构建一个混合两种字体或两种字体样式的段落(例如:在段落中间有一个粗体文本)

使用iText 5可以使用Chunks完成:

Font regular = new Font(FontFamily.HELVETICA, 12);
Font bold = Font font = new Font(FontFamily.HELVETICA, 12, Font.BOLD);
Phrase p = new Phrase("NAME: ", bold);
p.add(new Chunk(cc_cust_dob, regular));
PdfPCell cell = new PdfPCell(p);
Run Code Online (Sandbox Code Playgroud)

使用iText 7,我仍然没有办法做到这一点.

有没有人试图使用最新版本的iText做到这一点?

注意:我正在使用csharp,但java也很有用

谢谢,

路易斯皮尼奥

itext itext7

3
推荐指数
1
解决办法
5305
查看次数