学习为Mac编写C# [英] Learning write c# for mac

查看:318
本文介绍了学习为Mac编写C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iam使用C#Windows应用程序,但是我的某些客户端在Mac系统上工作
所以我需要制作在其系统上运行的应用程序
搜索后,我发现要使用mono develepoment
但是我需要任何资源来学习它.

iam using c# windows application but some of my client is working on mac system
so i need to make application that run on their system
after search i found that to use mono develepoment
but i need any rescources to learn it

推荐答案

基本上,有两种几乎相反的方法,您可以设计一些组合.

首先,就Mono而言,Mac OS X可能是最敌对的系统.以Linux为例.我怀疑,Mac OS X会与没有使用C/Objective-C和XCode :-)而不使用Mac原生方式开发的任何东西相抵触.

第一种方法是:如果您使用标准的.NET库以及System.Windows.Forms在Windows上开发应用程序并且做得非常准确,则此类应用程序将在Mac OS X上的Mono 下运行而无需重新编译.但是,在Mac OS X上,这样的应用程序看起来很丑,甚至调整大小的角落也很丑.菜单的概念与Max上的应用程序激活的概念完全不同,因此您的Forms菜单将位于应用程序Windows上,而本机Mac主菜单将显示……好吧,您不想看它.但是,它以某种方式起作用.存在许多不兼容甚至错误,但是通常您可以解决它们.

第二种方法是使用Mono,但以Mac方式进行.为此,您需要同时使用Mono和另一个名为MonobjC的开源产品:
http://en.wikipedia.org/wiki/Monobjc [ http://www.monobjc.net/ [ ^ ].

从文档中可以看出,有一件关键事情并非100%显而易见:如何运行开发的应用程序?答案是:您应该使用MonobjC运行时而不是Mono.如果开发了应用程序"MyApplication.EXE",则应以
Basically, there are two almost opposite approaches and you can devise some combination.

First of all, Mac OS X is probably the most hostile system in respect to Mono. Compared to Linux, for example. I suspect, Mac OS X is hostile to anything developed not using Mac native way with C/Objective-C and XCode :-).

First approach is this: if you develop applications on Windows using standard .NET libraries plus System.Windows.Forms and do it very accurately, such application will work on Mac OS X under Mono without recompilation. However, on Mac OS X, such application look quite ugly, even the resize corner looks ugly. And the concept of menu, the concept of application activation on Max is completely different, so you Forms menu will be on the application Windows, and the native Mac main menu will show… well, you don''t want to look at it. Nevertheless, it somehow works. There are a number of incompatibilities or even bugs, but generally you can work around them.

The second approach is using Mono but doing it in a Mac way. For this purpose, you need to use both Mono and another Open-Source product called MonobjC:
http://en.wikipedia.org/wiki/Monobjc[^],
http://www.monobjc.net/[^].

There is one key thing that is not 100% apparent from the documentation: how to run the developed applications? The answer is: you should use MonobjC runtime instead of Mono. If you developed an application "MyApplication.EXE", you should run it as
monobjc MyApplication.EXE

的身份运行它.使用MonobjC,您可以创建具有所有特定Mac UI元素的行为类似于Mac上的一等公民的UI.您会找到详细的Apple文档和MonobjC文档,可以将它们进行比较以找到结尾.有很多代码示例.

您可以在Windows上开发MonobjC应用程序,但无法对其进行调试.另外,您不能将Designer用于UI.不幸的是,要使用设计器并进行调试,您至少需要在Mac上进行设计和调试.您可以将MonoDevelop与Mac专用附件一起使用.不幸的是,使用设计器会使项目文件无法在Windows上构建.
请参见 http://en.wikipedia.org/wiki/MonoDevelop [ http://monodevelop.com/ [ ^ ].

您需要确定可以投入多少精力以及需要什么结果.

另一个问题是:您只能将其作为POSIX脚本运行(希望您熟悉POSIX). Mac OS X可以与POSIX一起使用,但是在Finder(Mac文件管理器)中集成应用程序是基于名为Application Bundle和Apple Script的概念.只需单击即可启用Mac上运行的Mono应用程序,您将需要学习如何制作这些捆绑包.基本上,这是一个具有特殊内部结构的特殊目录.您单击捆绑包的顶层目录;并运行该应用程序.参见:
http://en.wikipedia.org/wiki/Application_bundle [ http://en.wikipedia.org/wiki/Apple_Script [ http://sveinbjorn.org/platypus [

With MonobjC you can create UI which behaves like first-class citizen on Mac, with all the specific Mac UI elements. You will find detailed Apple documentation and MonobjC documentation which you can compare to find the end. There is a good bunch of code samples.

You can develop MonobjC applications on Windows, but you won''t be able to debug them. Also, you cannot use Designer for UI. Unfortunately, to use the Designer and debugging, you need to do it on Mac, at least part of work. You can use MonoDevelop with a special add-on for Mac. Unfortunately, using the designer will make the project files not buildable on Windows.
See http://en.wikipedia.org/wiki/MonoDevelop[^],
http://monodevelop.com/[^].

You need to decide how much effort you can put in it and what result do you need.

Another problem is this: you can only run it as a POSIX script (I hope you''re familiar with POSIX). Mac OS X does work with POSIX, but integration of the application in Finder (Mac file manager) is based on the concept called Application Bundle and Apple Script. Just to enable your Mono application running on Mac on click, you will need to learn how to make those bundle. Basically, this is a special directory with special inner structure. You click in a bundle top directory; and the application runs. See:
http://en.wikipedia.org/wiki/Application_bundle[^],
http://en.wikipedia.org/wiki/Apple_Script[^].

I know two way of making application bundles out of the POSIX script shown above. First, you can use Mac Script Builder to create a script calling this POSIX script (just a line withing the Apple Script) and save it as an Application Bundle. Another way is using Platypus: a tool which can take a POSIX script, add options and build an Application Bundle out of it.
See http://sveinbjorn.org/platypus[^].

—SA


这是它的库: http://docs.go-mono.com/ [^ ]
AND
http://www.mono-project.com/Start [
Here is it''s library : http://docs.go-mono.com/[^]
AND
http://www.mono-project.com/Start[^]


这篇关于学习为Mac编写C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆