ubuntuusers.de

Mono + Windows Forms

Status: Ungelöst | Ubuntu-Version: Ubuntu 11.04 (Natty Narwhal)
Antworten |

Spitfire777

Anmeldungsdatum:
12. Januar 2010

Beiträge: 197

Wohnort: Karlsruhe

Hi,

ich will Windows Forms auf Ubuntu zum Laufen bekommen. (Studium verlangt's) Hab MonoDevelop als IDE und Mono ist ja bei Ubuntu mit dabei.

Um WinForms zu testen, hab ich mal schnell per Copy&Paste den Getting-Started-Code kopiert.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Drawing;
using System.Windows.Forms;
 
public class HelloWorld : Form
{
	static public void Main ()
	{
		Application.Run (new HelloWorld ());
	}
 
	public HelloWorld ()
	{
		Button b = new Button ();
		b.Text = "Click Me!";
		b.Click += new EventHandler (Button_Click);
		Controls.Add (b);
	}
 
	private void Button_Click (object sender, EventArgs e)
	{
		MessageBox.Show ("Button Clicked!");
	}
}

Fehlermeldungen: The Type or Namespace Name 'Drawing' does not exist.... blabla The Type or Namespace Name 'Windows' does not exist.... blabla

Hab dann mal gegoogelt und mono-winforms* per apt nachinstalliert, in der MonoDevelop-IDE kein Erfolg. Dann den Quellcode manuell durch den Compiler gejagt:

gmcs -pkg:dotnet Main.cs

Kompilieren hat diesmal geklappt, ausführen nicht:

spitfire777@Schlepptop777:~/Projects/Csharp/Csharp$ mono Main.exe
no implementation for interface method Atk.TableImplementor::get_SelectedColumns() in class UiaAtkBridge.Table
METHOD .ctor(System.Windows.Automation.Provider.IRawElementProviderFragment)
METHOD RaiseAutomationEvent(System.Windows.Automation.AutomationEvent,System.Windows.Automation.AutomationEventArgs)
METHOD RaiseStructureChangedEvent(object,System.Windows.Automation.StructureChangedEventArgs)
METHOD RaiseAutomationPropertyChangedEvent(System.Windows.Automation.AutomationPropertyChangedEventArgs)
METHOD RefAt(int,int)
METHOD GetIndexAt(int,int)
METHOD GetColumnAtIndex(int)
METHOD GetRowAtIndex(int)
METHOD get_NColumns()
METHOD get_NRows()
METHOD GetColumnExtentAt(int,int)
METHOD GetRowExtentAt(int,int)
METHOD get_Caption()
METHOD set_Caption(Atk.Object)
METHOD GetColumnDescription(int)
METHOD GetColumnHeader(int)
METHOD GetRowDescription(int)
METHOD GetRowHeader(int)
METHOD get_Summary()
METHOD set_Summary(Atk.Object)
METHOD SetColumnDescription(int,string)
METHOD SetColumnHeader(int,Atk.Object)
METHOD SetRowDescription(int,string)
METHOD SetRowHeader(int,Atk.Object)
METHOD GetSelectedColumns(int&)
METHOD GetSelectedColumns(int[]&)
METHOD GetSelectedRows(int&)
METHOD GetSelectedRows(int[]&)
METHOD IsColumnSelected(int)
METHOD IsRowSelected(int)
METHOD IsSelected(int,int)
METHOD AddRowSelection(int)
METHOD RemoveRowSelection(int)
METHOD AddColumnSelection(int)
METHOD RemoveColumnSelection(int)
METHOD EmitRowReorderingSignal()
METHOD OnRefStateSet()

** (Main.exe:17020): WARNING **: The class UiaAtkBridge.Table could not be loaded, used in UiaAtkBridge, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f4ceacb585d99812
Error setting up UIA: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Automation.Provider.AutomationInteropProvider ---> System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
  at System.Windows.Automation.Provider.BridgeManager.GetAutomationBridge () [0x00000] in <filename unknown>:0 
  at System.Windows.Automation.Provider.AutomationInteropProvider..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.UIAutomation.Winforms.FormListener.Initialize () [0x00000] in <filename unknown>:0 
  at Mono.UIAutomation.Winforms.Global.Initialize () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Application.InitializeUIAutomation () [0x00000] in <filename unknown>:0 

Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.WindowsFormsSynchronizationContext ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Forms.XplatUI ---> System.TypeInitializationException: An exception was thrown by the type initializer for System.Windows.Automation.Provider.AutomationInteropProvider ---> System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
  at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
  at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
  at System.Windows.Automation.Provider.BridgeManager.GetAutomationBridge () [0x00000] in <filename unknown>:0 
  at System.Windows.Automation.Provider.AutomationInteropProvider..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at Mono.UIAutomation.Winforms.FormListener.Initialize () [0x00000] in <filename unknown>:0 
  at Mono.UIAutomation.Winforms.Global.Initialize () [0x00000] in <filename unknown>:0 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Windows.Forms.Theme.get_MenuAccessKeysUnderlined () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.SystemInformation.get_MenuAccessKeysUnderlined () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Control:.ctor ()
  at System.Windows.Forms.WindowsFormsSynchronizationContext..cctor () [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Windows.Forms.Control..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ScrollableControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.ContainerControl..ctor () [0x00000] in <filename unknown>:0 
  at System.Windows.Forms.Form..ctor () [0x00000] in <filename unknown>:0 
  at HelloWorld..ctor () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) HelloWorld:.ctor ()
  at HelloWorld.Main () [0x00000] in <filename unknown>:0 
Antworten |