loupiottes/DMX-2.0/Main.cs
2013-11-19 11:29:06 +00:00

65 lines
No EOL
1.5 KiB
C#

using System;
using Gtk;
namespace DMX2
{
class MainClass
{
public static void Main (string[] args)
{
bool fullscreen = false, aguibtn = false;
// Traitement des options en ligne de commande :
foreach (string arg in args) {
switch (arg) {
case "fullscreen":
case "fs":
fullscreen = true;
break;
case "aguibtn":
aguibtn=true;
break;
default:
break;
}
}
// Initialisation GTK#
Application.Init ();
// Repertoire courrant est celui de l'executable
System.IO.Directory.SetCurrentDirectory (
(new System.IO.FileInfo (
System.Reflection.Assembly.GetExecutingAssembly ().Location
)).DirectoryName
);
// Chargement du style GTK
if (System.IO.File.Exists ("style.gtkrc"))
Gtk.Rc.Parse ("style.gtkrc");
else
using (System.IO.Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("style.gtkrc"))
using (System.IO.TextReader reader = new System.IO.StreamReader(stream))
Gtk.Rc.ParseString (reader.ReadToEnd ());
// Force l'instanciation du handle midi.
IntPtr ptr = MidiEventProvider.MidiSeqHandle.Handle;
// Creation de la fenetre principale
MainWindow win = new MainWindow ();
// application des options
if(fullscreen) win.ToggleFullscreen();
if(aguibtn) win.AfficheBoutonACGUI();
// Lancement
win.Show ();
Application.Run ();
// Nettoyage
if (Conduite.Courante != null) {
Conduite.Courante.Dispose ();
}
}
}
}