maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   HOWTO: C# compiling on the unit itself (https://talk.maemo.org/showthread.php?t=17119)

b-man 2008-03-25 17:12

Re: HOWTO: C# compiling on the unit itself
 
This seems like a echo frome my last post but whenever i try to compile my program called roundedrects i get the same case-sensitive eror: /home/user/mcs # mcs roundedrects.cs -pkg:mono-cairo -pkg:gtk-sharp-2.0
error CS2001: Source file `roundedrects.cs' could not be found
Compilation failed: 1 error(s), 0 warnings
/home/user/mcs #
But even when i verry carefully type the compile in frome the web page and frome what you provided i still get the same eror. is this case-sensitive eror a bug in the compiler or frome a nother cause?
here's my program:
using System;
using System.Reflection;
using System.Runtime.InteropServices;
using Cairo;
using Gtk;

public class GtkCairo
{
static void Main ()
{
Application.Init ();
Gtk.Window w = new Gtk.Window ("Mono-Cairo Rounded Rectangles");

DrawingArea a = new CairoGraphic ();

Box box = new HBox (true, 0);
box.Add (a);
w.Add (box);
w.Resize (500, 500);
w.DeleteEvent += close_window;
w.ShowAll ();

Application.Run ();
}

static void close_window (object obj, DeleteEventArgs args)
{
Application.Quit ();
}
}

public class CairoGraphic : DrawingArea
{
static double min (params double[] arr)
{
int minp = 0;
for (int i = 1; i < arr.Length; i++)
if (arr[i] < arr[minp])
minp = i;

return arr[minp];
}

static void DrawRoundedRectangle (Cairo.Context gr, double x, double y, double width, double height, double radius)
{
gr.Save ();

if ((radius > height / 2) || (radius > width / 2))
radius = min (height / 2, width / 2);

gr.MoveTo (x, y + radius);
gr.Arc (x + radius, y + radius, radius, Math.PI, -Math.PI / 2);
gr.LineTo (x + width - radius, y);
gr.Arc (x + width - radius, y + radius, radius, -Math.PI / 2, 0);
gr.LineTo (x + width, y + height - radius);
gr.Arc (x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
gr.LineTo (x + radius, y + height);
gr.Arc (x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
gr.ClosePath ();
gr.Restore ();
}

static void DrawCurvedRectangle (Cairo.Context gr, double x, double y, double width, double height)
{
gr.Save ();
gr.MoveTo (x, y + height / 2);
gr.CurveTo (x, y, x, y, x + width / 2, y);
gr.CurveTo (x + width, y, x + width, y, x + width, y + height / 2);
gr.CurveTo (x + width, y + height, x + width, y + height, x + width / 2, y + height);
gr.CurveTo (x, y + height, x, y + height, x, y + height / 2);
gr.Restore ();
}

protected override bool OnExposeEvent (Gdk.EventExpose args)
{
using (Context g = Gdk.CairoHelper.Create (args.Window)){
DrawCurvedRectangle (g, 30, 30, 300, 200);
DrawRoundedRectangle (g, 70, 250, 300, 200, 40);
g.Color = new Color (0.1, 0.6, 1, 1);
g.FillPreserve ();
g.Color = new Color (0.2, 0.8, 1, 1);
g.LineWidth = 5;
g.Stroke ();
}
return true;
}
}

p.s. That advice you provided finaly made my hello.cs program compile and run successfuly!:)

pipeline 2008-03-25 17:36

Re: HOWTO: C# compiling on the unit itself
 
your code is irrelevant since it cant find the file. that's why i asked for output of
ls -l

from that directory

and you dont need to compile as root

b-man 2008-03-25 21:12

Re: HOWTO: C# compiling on the unit itself
 
this is probibly a really annoying and silly question, but then again i am new at programing, how do i get output of is -l

pipeline 2008-03-25 23:26

Re: HOWTO: C# compiling on the unit itself
 
no problem.. it would be pretty important to know that in order to compile :)

from within xterm just do this :

/media/mmc1/source/winforms $ ls -l
-rw-r--r-- 1 user root 948 Mar 25 15:39 hello.cs
-rw-r--r-- 1 user root 4096 Mar 25 15:39 hello.exe
/media/mmc1/source/winforms $

so ls -l (read LS -L except lowercase) will print directory saying who owns it and what permissions are... i currently run off mmc (fat) so it just says user owns, anyone can read, and user can write.

So do an ls -l then using stylus highlight those lines and in menu do edit/copy... then paste into a reply to this message from device (if you can or just type here what the roundedrects.cs file permissions and owner is)

b-man 2008-03-26 02:53

Re: HOWTO: C# compiling on the unit itself
 
Do i have to create those folders /source/winforms/ in my external memory card? or do i need to obtain thoses frome a source?
As well do i need to be in root mode when doing this or not?
Just to be safe...

pipeline 2008-03-26 03:27

Re: HOWTO: C# compiling on the unit itself
 
Um no thats an example, run wherever your source files are...
You do not need to be root

pipeline 2008-04-20 21:09

Re: HOWTO: C# compiling on the unit itself
 
2 Attachment(s)
1.9 libs are working very nicely. Although they are still in testing, they are much more stable and capable than the official (old) runtime in the official repo.

So if anyone wants to run the -test- 1.9 libs :
- Uninstall all packages except the pkgconfig and then change repo to :
(web address 'http://go-mono.com/maemo', dist 'chinook', components 'test')
- If you want web servers install my xsp maemo package
- These libs are still 'test' so expect to have to reinstall all the many packages later.

Ok well that aside, i've been enjoying aspx development so i thought i'd pass along some screenshots showing a web based wysiwyg html editor based on the FreeTextBox control.

Also, to show how cool .net byte code and mono is, i grabbed the mono xsp web server binaries, zipped them up and ran them on Windows machine and the web server works exactly the same... running against microsoft's official .net framework (both 1.1 and 2.0). This makes a more even matched development environment if you dont need or have the full IDE for web development. XSP servers are fully functional and can accept connections from outside users. Grab xsp and xsp2 for your desktop if you want (linux desktop users can probably get it from mono repo)

You can grab this wysiwyg editor sample or check out several other samples (based on the 1.9 mono libs) here :
http://wardenclyffetower.com/MaemoFi...o/samples-1.9/

zybook 2008-04-21 02:58

Re: HOWTO: C# compiling on the unit itself
 
it seems very good!

psykosis 2008-04-21 13:32

Re: HOWTO: C# compiling on the unit itself
 
Looks excellent Pipeline. Are the 2.0 Winform libraries working properly with the previous version?

pipeline 2008-04-21 14:55

Re: HOWTO: C# compiling on the unit itself
 
Quote:

Originally Posted by psykosis (Post 172567)
Looks excellent Pipeline. Are the 2.0 Winform libraries working properly with the previous version?

Previous version of what...mono? Old mono/maemo never had gdilibs/winforms so 1.9 winforms is a first for maemo.

BTW the previous editor is aspx based running in microb... and the entire editor control is a pre-built binary/assembly built for real asp.net so its not like i had to hack it to get it to work. I just download the zipped sample web from internet and used that as base for adding simple document management to work with files in MyDocs.

Winforms still has issues i suppose with FlatStyle (2.0 cil problem only), FontDialog, ColorDialog, glitchy FIleDialog, missing taskbar icon, and no fullscreen. Hopefully Everaldo will be able to resolve some of these for official release.


All times are GMT. The time now is 09:00.

vBulletin® Version 3.8.8