I just installed the latest Mono framework and MonoDevelop.
When I create a new solution under C# there is no GUI based application.
How do I create an app that has a GUI and buttons etc
you can create GUI by mono in mac follow these steps:
File->New->Solution.
Select C# and then select Gtk# enter a name for your project then click Forward.
in the solution window at the left side of the window click the arrow next to your project name, then right-click on the MainWindow.cs click open.
after it opened at the bottom of the window there is (Source code and Designer) click on the Designer, enjoy it you can see a form now.
so if want to add buttons, textboxes, lables,... etc there is a toolbox window at the right of the window.
If you are on Linux or Windows, the project type is called "Gtk# 2.0 Project". If you are on Mac, there is no visual designer for Gtk#, you will have to code it by hand.
If you're already familiar with WinForms and C# development using Visual Studio--and if you don't mind developing a GUI without a visual editor--then you can develop a WinForms application in MonoDevelop.
This tutorial should get you started:
http://zetcode.com/tutorials/monowinformstutorial/firststeps/
After creating a new C# solution (File|New > Solution...), add references to System.Drawing and System.Windows.Forms (Project|Edit References...). In the constructor for your Form subclass you can define buttons and other controls. That should get you on your way.
There may still be bugs and odd quirks in MonoDevelop. For example, autocomplete for adding an event handler (such as MyButton.Click += HandleMyButtonClick) works if I insert a space after "+=", but not if I tab. Otherwise the environment should feel familiar.
There are a number of bindings for Mono and Cocoa which allow you to build OS X apps using Mono with native looking interfaces.
Some time ago there was the Cocoa# project, which is still shipped with Mono, but is now dead on the water and no longer updated.
However, just a few days ago, I myself asked about the state of Cocoa# and other solutions were highlighted. The best (IMHO) is Monobj, which also has Monodevelop/IB templates.
Just install Xcode together with MonoFramework and MonoDevelop, then you can use the native iOS interface builder!
MonoDevelop works perfectly (although a little buggy on some functions) with xcode.
During development of say, an iPhone-app, I switch between Monodevelop and Xcode, MonoDevelop for writing all code-behind/delegates etc., and Xcode for designing using the native interface-builder for Mac OSX and iOS apps...
You need:
MonoDevelop
http://monodevelop.com/
MonoTouch (UI framework to interface with CocaoTouch on iOS)
http://xamarin.com/monotouch
And of course the actual mono-framework (C# to Obj-C)
http://www.mono-project.com/
MonoDevelop supports
MonoMac for OS X Lion applications
MonoTouch for iOS applications
Related
For the first time I am trying Visual Studio for Mac and I located a tutorial for writing a exe that shows a window with a simple menu.
My two questions are:
How does a user of a Mac get the Mono platform? I can't find instructions for deploying Mono. When I look in my exe folder there is no other files. Just the exe.
Maybe this should be a different question but I could not find any "WinForms" version in Visual Studio for mac. I had to use Gtk2 (I think).
If there is a better place to ask these questions please direct me. Thanks.
I know understand that the best course of action was:
Create a Xamarin.Forms multi-platform project.
Create a Cocoa Mac OS project.
Add a reference to project 1 into project 2.
Using Nuget Package Manager download Xamarin.Forms into each project.
Now it is easy to create an application with XAML (similar to WPF).
Visual Studio for Mac creates the multi-platform project (step 1 above) automatically with the Android and iOS platform builds, but not the macOS.
I also see that I don't really need to download Mono as it is all dealt with automatically.
.NET Core does support Mac and Linux. And even though .NET Core now supports Windows Forms. Windows Forms is only supported on Windows. It's unlikely this will ever change due to Windows Forms dependency on the Windows APIs.
How can I programmatically change/set the lock screen background image (using VB.NET, C# or Visual C++)? I am using Win 10 Pro and have Visual Studio 2017 Pro.
I've had a look online but most solutions don't seem to work. For example:
Both Change Win 10 Lockscreen Image Mutiple Times C# WPF and Change Windows Lock Screen background image in C# provide sample code but the imports System.Windows.Media.Imaging, Windows.Storage, Windows.Storage.Streams, Windows.System.UserProfile cannot be found when I paste the code. Do I need to add specific references?
Lock screen personalization sample looks very promising but upon opening the solution/project file, Visual Studio throws an error saying that the provided format is unreadable.
Most sources (also Windows Dev Center - LockScreen Class) seem to suggest
Windows.System.UserProfile.LockScreen.SetImageFileAsync(file);
but I am apparently missing the specific namespace/import/package to make it run.
Any help would be appreciated.
I've found an easier way using this question Windows 10 Pro lockscreen mass change. All I need to do is set the registry entries under
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PersonalizationCSP
DesktopImagePath
DesktopImageUrl
LockScreenImagePath
LockScreenImageUrl
to the path of the desired picture, which works without UWP or WPF.
As alluded to in my comment, the Windows.System.UserProfile namespace is part of the UWP platform and requires having the Windows 10 SDK installed to utilize.
You can install the SDK by running the Visual Studio Installer, click "Modify" and then choose the "Universal Windows Platform development" workload, or choose the SDK from the list of "Individual Components". More details can be found here.
You may be able to use the library from a desktop .NET app as mentioned in this question How to Interop with Windows Runtime in .NET 4.5 and this link from the answer, but there's no guarantee that Microsoft will continue to allow that so you're probably better off developing using the UWP.
There is a sample from Microsoft for Lock Screen Personalisation on Windows 10 on GitHub here.
ImageGlass, an open-source image viewer, provides a command-line utility to change the Windows LockScreen image: igcmdWin10.exe
Usage: igcmdWin10.exe setlockimage "C:\image.jpg"
Extract it from the .zip release on their Github repository
ImageGlass official documentation for reference.
I'll try to be concrete so this doesn't get tagged as a discussion question.
I'm a complete programming beginner learning C#, and one exercise includes creating a universal win10 app. Except my version of Visual Studio 2015 doesn't have this type of template pre-installed, so I clicked to download it. Turns out it's 12 Gb.
My question is whether I can opt out of some of the things that Microsoft want to install, specifically "Common tools for Visual C++ 2015". I tried unchecking it, but then it automatically also removed "Tools (1.4) and Windows 10 SDK (10.0.10586)", which seems a lot more important. So maybe I need tools for C++, even though I'm not using C++?
I notice there is another one you can check, called "Windows 10 SDK (10.0.10240)", and I thought perhaps I can choose that one instead. This one allows me to uncheck C++, which gives me back 6Gb of harddrive.
Since I'm just trying to learn, I don't need the app to be compatible with win8, I don't need to emulate a phone or Xbox or what have you. I just need to make an app with a GUI, to see how it's done.
I am new to programming and I am interested in developing applications in C# using Mono. I would like to choose a GUI framework other than GTK+: either WinForms or XWT (https://github.com/mono/xwt).
Is there a designer to design WinForms GUIs? What about one for XWT? I am using MonoDevelop as my IDE.
If there is no designers for either WinForms or XWT, do you think it possible to write the application in C# in .NET with WinForms using Visual Studio 2012 and just compile it using Mono when I want to deploy?
That's probably two questions.
1.) What are my Mono GUI RAD options?
If you want a Mono GUI RAD your only choice is GTK# as far as I know.
If you want a GUI RAD for Windows.Forms, it's called Visual Studio (or potentially VS Express for Desktop in Win8) and requires Windows/working outside of MonoDevelop. ;) On the plus side, it's a really good GUI RAD.
2.) What GUI framework is best for writing once and running everywhere?
Gtk#. Unfortunately, Mono's Windows.Forms doesn't work well and is a dead end tech. See here for a similar question.
As I mention in an answer there, if you want to write a utility that targets multiple OSes in Mono (or you're Linux-centric), you probably do want Gtk#. If you want to create a traditional client app, prepare to rewrite your GUI on each target platform.
Edit: Less nepotistic question on a similar subject here.
Edit2: There is a Mono WinForms designer that I forgot about here, but its description readily admits that, "Unfortunately the designer is not ready yet for proper use," and the blocking bug they refer to is from 2007, so not much help.
Good luck!
Looking at current direction of mono who driven by Xamarin, they promotes the native UI for each platform. means you writing business process as separate project and GUI for each target platform. as for desktop, using XWT is preferable as you will uses similar API to access native UI in each platform, without loosing ability to add more advance UI for each platform.
XWT API is based on GTK# API (easy for Xamarin folks to migrate their existing apps), and provides with lot of common widget/control which implemented for each target platform (WPF for Windows, Cocoa for Mac, GTK for Linux). furthermore it easier to add advance/custom widget and hosted in XWT as it actually like hosted in native toolkit in each platform
Update:
About Winform is already answered, for XWT seem no designer yet, but for deploying, just creates projects XWT GUI (Shared all XWT GUI), XWT.WPF (XWT launcher for windows) and XWT.Cocoa (XWT MonoMac application for Mac). But the each launcher only can be compile in each platform
I was told that VisusalStudio has no version for Mac. So what should I use if I want to develop in C# on Mac ? Anybody has experiences with this ? I'm looking for native IDE, I don't want to run VS using VirtualBox or any virtualization solution.
And if I create application with WPF GUI will it run on Mac ? Or is WPF only for Windows GUI developing ?
MonoDevelop is a free open source IDE based on the Mono project. There's builds available for Linux, MacOS X and Windows.
For GUI development, you'll need to use the GTK+ framework included with Mono - there's no plans to implement WPF on any platform other than Windows. GTK+ is cross-platform, though, so you can compile the same app for MacOS, Windows and Linux if you need to.
EDIT: It appears MonoDevelop also supports WinForms - http://www.mono-project.com/WinForms
There are a couple of alternative IDEs but nothing comparable to MonoDevelop in terms of features - but you can always just write C# code in your favourite editor and compile it using the Mono build tools, of course.
WPF can run on any environment that supports it in its runtime environment. Currently that is only Windows since the Mono project has no plans to implement WPF
Check out the Mono Project.
For an IDE check out MonoDevelop.
You can also check out the MonoTouch to develop to the IPhone.
As already mentioned WPF isn't supported but they do mention an alternative:
Silverlight implement a subset of the
WPF APIs and is available on Windows,
MacOS X and through our own open
source effort Moonlight it is
available on Linux and other Unix
systems.
As far as I know there is no complete IDE that support C# with intelli sense, etc.
So Vmware Fusion + Windows including Studio in Unity mode will be it :)
Simple C# syntax highlighting you can get with textmate.