コード例 #1
0
        static void Main(string[] args)
        {
            //Gtk.Application.Init();
            //Forms.Init();

            //var app = new App();
            //var window = new FormsWindow();
            //window.LoadApplication(app);
            //window.SetApplicationTitle("lindexi");
            //window.Show();
            //Gtk.Application.Run();

            Gtk.Application.Init();

            var app = new Gtk.Application("org.gtkapp.gtkapp", GLib.ApplicationFlags.None);

            app.Register(GLib.Cancellable.Current);

            var win = new FormsWindow();

            //app.AddWindow(FormsWindow.MainWindow);

            //win.Show();
            Gtk.Application.Run();
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            Application.Init();

            //Download icon
            InitIcon.download_icon();

            var app = new Application("org.PARSminexmr.PARSminexmr", GLib.ApplicationFlags.None);



            Choose_style.PreStartChoose();



            app.Register(GLib.Cancellable.Current);



            var win = new MainWindow();

            app.AddWindow(win);



            win.Show();
            Application.Run();
        }
コード例 #3
0
        /// <summary>
        /// Creates a new application instance.
        /// </summary>
        /// <returns>The application instance.</returns>
        private static Gtk.Application _createApplication()
        {
            var app = new Gtk.Application("cm.aliengames.alienengine", GLib.ApplicationFlags.None);

            app.Startup  += _appOnStartup;
            app.Shutdown += _appOnShutdown;

            return(app);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: shivangimittal41/Happiness
        public static void Main(string[] args)
        {
            GtkApp.Init();
            Forms.Init();
            var app    = new App();
            var window = new FormsWindow();

            window.LoadApplication(app);
            window.Show();
            GtkApp.Run();
        }
コード例 #5
0
        /* Public methods */

        public void Execute(Action methodToExecute)
        {
            GLib.Global.ApplicationName = applicationName;

            app            = new Gtk.Application(applicationID, GLibApplicationFlagsNonUnique);
            app.Activated += (sender, e) => {
                methodToExecute();
            };

            app.Run(0, "");
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: johnnyasantoss/EpouNoMore
        private static void SetupApplication()
        {
            var app = new Application("org.EpouNoMore.EpouNoMore", ApplicationFlags.None);

            app.Register(Cancellable.Current);

            var win = new MainWindow();

            app.AddWindow(win);

            win.Show();
        }
コード例 #7
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static async Task Main(string[] args)
        {
            var options = new CLIOptions();

            Parser.Default.ParseArguments <CLIOptions>(args)
            .WithParsed(r => options = r);

            if (options.RunBatchProcessing)
            {
                if (string.IsNullOrEmpty(options.TargetDirectory) || options.ManifestType == EManifestType.Unknown)
                {
                    Log.Error("Target directory not set, or manifest type not set.");
                    return;
                }

                // At this point, the options should be valid. Run batch processing.
                if (Directory.Exists(options.TargetDirectory))
                {
                    Log.Info("Generating manifest...");

                    var manifestGenerationHandler = new ManifestGenerationHandler();

                    var progressReporter = new Progress <ManifestGenerationProgressChangedEventArgs>
                                           (
                        e => Log.Info($"Processed file {e.Filepath} : {e.Hash} : {e.Filesize}")
                                           );

                    await manifestGenerationHandler.GenerateManifestAsync
                    (
                        options.TargetDirectory,
                        options.ManifestType,
                        progressReporter,
                        CancellationToken.None
                    );

                    Log.Info("Generation finished.");
                }
                else
                {
                    Log.Error("The selected directory did not exist.");
                }
            }
            else if (string.IsNullOrEmpty(options.TargetDirectory) && options.ManifestType == EManifestType.Unknown)
            {
                // Run a GTK UI instead of batch processing
                Application.Init();
                SynchronizationContext.SetSynchronizationContext(new GLibSynchronizationContext());

                var win = MainWindow.Create();
                win.Show();
                Application.Run();
            }
        }
コード例 #8
0
        /// <summary>
        /// The entry point.
        /// </summary>
        public static void Main()
        {
            // Bind any unhandled exceptions in the main thread so that they are logged.
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            // Set correct working directory for compatibility with double-clicking
            Directory.SetCurrentDirectory(DirectoryHelpers.GetLocalDir());

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Environment.SetEnvironmentVariable("GSETTINGS_SCHEMA_DIR", "share\\glib-2.0\\schemas\\");
            }

            log4net.Config.XmlConfigurator.Configure();

            Log.Info("----------------");
            Log.Info("Initializing Everlook...");

            Log.Info("Initializing OpenTK...");

            // OpenGL
            var toolkitOptions = new ToolkitOptions
            {
                Backend = PlatformBackend.PreferNative,
                EnableHighResolution = true
            };

            using (Toolkit.Init(toolkitOptions))
            {
                Log.Info($"OpenTK initialized using the {GetOpenTKBackend()} backend.");

                Log.Info("Initializing GTK...");

                // Bind any unhandled exceptions in the GTK UI so that they are logged.
                ExceptionManager.UnhandledException += OnGLibUnhandledException;

                Log.Info("Registering treeview types with the native backend...");
                GType nodeType = (GType)typeof(SerializedNode);
                GType.Register(nodeType, typeof(SerializedNode));

                GType referenceType = (GType)typeof(FileReference);
                GType.Register(referenceType, typeof(FileReference));

                // GTK
                IconManager.LoadEmbeddedIcons();
                Application.Init();
                MainWindow win = MainWindow.Create();
                win.Show();
                Application.Run();
            }
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: jorik041/ZXing.Net.Xamarin
        public static void Main(string[] args)
        {
            Application.Init();
            Forms.Init();
            ZXing.Net.Mobile.Forms.GTK.Platform.Init();

            var app    = new App();
            var window = new FormsWindow();

            window.LoadApplication(app);
            window.SetApplicationTitle("GTK example");
            window.Show();
            Application.Run();
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: johnnyasantoss/EpouNoMore
        public static void Main(string[] args)
        {
            _logger = new Logger <Program>();

            AppDomain.CurrentDomain.UnhandledException += (_, e) => OnUnhandledException(e);
            ExceptionManager.UnhandledException        += OnUnhandledException;

            Application.Init();

            SetupProcess();
            SetupApplication();

            Application.Run();
        }
コード例 #11
0
        private static void Main(string[] args)
        {
            Application.Init();
            Forms.Init();

            var app    = new App();
            var window = new FormsWindow();

            window.LoadApplication(app);
            window.Title = "Mandelbrot Plotter";
            window.Show();

            Application.Run();
        }
コード例 #12
0
        private static void Main(string[] args)
        {
            Application.Init();
            Forms.Init();

            var app    = new App();
            var window = new FormsWindow();

            window.LoadApplication(app);
            window.Title = app.MainPage.Title;
            window.Show();

            Application.Run();
        }
コード例 #13
0
        /// <summary>
        ///     The start-up process logic executed on program launch
        /// </summary>
        private static void Startup()
        {
            // if the application has been set to load an application on start-up
            if (Settings.Default.LoadOnStartup)
            {
                // store the location of the file in a variable
                var file = Settings.Default.FileOnStartup;

                // check to see if the file exists, and a lock file does not exist
                // load the main application with the startup file
                if (File.Exists(file) && !File.Exists(file + ".lk"))
                {
                    new ProjectWindow(file).Show();
                }
                else
                {
                    // if a lockfile does not exist for the startup program
                    if (!File.Exists(file + ".lk"))
                    {
                        // reset the the application settings for loading the file on startup
                        // and save the changes made.
                        Settings.Default.LoadOnStartup = false;
                        Settings.Default.FileOnStartup = null;
                        Settings.Default.Save();
                    }

#if DEBUG
                    Console.WriteLine(
                        $"{Settings.Default.LoadOnStartup} \n {Settings.Default.FileOnStartup}");
#endif
                    // show the welcome screen.
                    new MainWindow().Show();
                }
            }
            // if there isn't a set file tot load on startup show the welcome screen
            else
            {
                new MainWindow().Show();
            }

            // run the GTK application
            Application.Run();

            ApplicationHelper.UnlockFile();
#if DEBUG
            Console.WriteLine("Press any key to close...");
            Console.ReadKey();
#endif
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: Lomeli12/FuseeGUI
        public static void Main(string[] args)
        {
            Application.Init();

            var app = new Application("net.lomeli.FuseeGUI", ApplicationFlags.None);

            app.Register(Cancellable.Current);

            var win = new MainWindow();

            app.AddWindow(win);

            win.Show();
            Application.Run();
        }
コード例 #15
0
        public static void Main(string[] args)
        {
            Application.Init();

            var app = new Application("com.parzivail.ComlinkGtk", ApplicationFlags.None);

            app.Register(Cancellable.Current);

            var win = new MainWindow();

            app.AddWindow(win);

            win.Show();
            Application.Run();
        }
コード例 #16
0
 public ApplicationWindow(Gtk.Application application) : base(IntPtr.Zero)
 {
     if (GetType() != typeof(ApplicationWindow))
     {
         var vals  = new List <GLib.Value> ();
         var names = new List <string> ();
         if (application != null)
         {
             names.Add("application");
             vals.Add(new GLib.Value(application));
         }
         CreateNativeObject(names.ToArray(), vals.ToArray());
         return;
     }
     Raw = gtk_application_window_new(application == null ? IntPtr.Zero : application.Handle);
 }
コード例 #17
0
        private static void Main()
        {
            Application.Init();
            var h = new UnhandledExceptionHandler(OnException);

            ExceptionManager.UnhandledException += h;

            new MainWindow().Show();
            Application.Run();

            void OnException(UnhandledExceptionArgs args)
            {
                Console.WriteLine("Error in application: " + args.ExceptionObject);
                args.ExitApplication = false;
            }
        }
コード例 #18
0
ファイル: Program.cs プロジェクト: bmjoy/Everlook
        /// <summary>
        /// The entry point.
        /// </summary>
        public static void Main()
        {
            // Bind any unhandled exceptions in the main thread so that they are logged.
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;

            // Set correct working directory for compatibility with double-clicking
            Directory.SetCurrentDirectory(DirectoryHelpers.GetLocalDir());

            log4net.Config.XmlConfigurator.Configure();

            Log.Info("----------------");
            Log.Info("Initializing Everlook...");

            Log.Info("Initializing OpenTK...");

            // OpenGL
            Toolkit.Init(new ToolkitOptions
            {
                Backend = PlatformBackend.PreferNative
            });

            Log.Info($"OpenTK initialized using the {GetOpenTKBackend()} backend.");

            Log.Info("Initializing GTK...");

            // Bind any unhandled exceptions in the GTK UI so that they are logged.
            ExceptionManager.UnhandledException += OnGLibUnhandledException;

            Log.Info("Registering treeview types with the native backend...");
            GType nodeType = (GType)typeof(FileNode);

            GType.Register(nodeType, typeof(FileNode));

            GType referenceType = (GType)typeof(FileReference);

            GType.Register(referenceType, typeof(FileReference));

            // GTK
            IconManager.LoadEmbeddedIcons();
            Application.Init();
            MainWindow win = MainWindow.Create();

            win.Show();
            Application.Run();
        }
コード例 #19
0
        protected override void Initialize()
        {
            base.Initialize();
            Helper.Init();

            if (SynchronizationContext.Current == null)
            {
                SynchronizationContext.SetSynchronizationContext(new GtkSynchronizationContext());
            }

#if GTK3
            Control = new Gtk.Application(null, GLib.ApplicationFlags.None);
            Control.Register(GLib.Cancellable.Current);
            Helper.UseHeaderBar = true;
#else
            Helper.UseHeaderBar = false;
#endif
        }
コード例 #20
0
ファイル: ApplicationHandler.cs プロジェクト: zzlvff/Eto
        protected override void Initialize()
        {
            base.Initialize();
            Helper.Init();

            if (SynchronizationContext.Current == null)
            {
                SynchronizationContext.SetSynchronizationContext(new GtkSynchronizationContext());
            }

#if GTK3
            Control = new Gtk.Application(null, GLib.ApplicationFlags.None);
            Control.Register(GLib.Cancellable.Current);
            Helper.UseHeaderBar = Gtk.Global.MinorVersion >= 10 && NativeMethods.gtk_application_prefers_app_menu(Control.Handle);
#else
            Helper.UseHeaderBar = false;
#endif
        }
コード例 #21
0
        public void RegisterActions(Gtk.Application app, GLib.Menu menu)
        {
            app.AddAccelAction(CropToSelection, "<Primary><Shift>X");
            menu.AppendItem(CropToSelection.CreateMenuItem());

            app.AddAccelAction(AutoCrop, "<Ctrl><Alt>X");
            menu.AppendItem(AutoCrop.CreateMenuItem());

            app.AddAccelAction(Resize, "<Primary>R");
            menu.AppendItem(Resize.CreateMenuItem());

            app.AddAccelAction(CanvasSize, "<Primary><Shift>R");
            menu.AppendItem(CanvasSize.CreateMenuItem());

            var flip_section = new GLib.Menu();

            menu.AppendSection(null, flip_section);

            app.AddAction(FlipHorizontal);
            flip_section.AppendItem(FlipHorizontal.CreateMenuItem());

            app.AddAction(FlipVertical);
            flip_section.AppendItem(FlipVertical.CreateMenuItem());

            var rotate_section = new GLib.Menu();

            menu.AppendSection(null, rotate_section);

            app.AddAccelAction(RotateCW, "<Primary>H");
            rotate_section.AppendItem(RotateCW.CreateMenuItem());

            app.AddAccelAction(RotateCCW, "<Primary>G");
            rotate_section.AppendItem(RotateCCW.CreateMenuItem());

            app.AddAccelAction(Rotate180, "<Primary>J");
            rotate_section.AppendItem(Rotate180.CreateMenuItem());

            var flatten_section = new GLib.Menu();

            menu.AppendSection(null, flatten_section);

            app.AddAccelAction(Flatten, "<Primary><Shift>F");
            flatten_section.AppendItem(Flatten.CreateMenuItem());
        }
コード例 #22
0
ファイル: Program.cs プロジェクト: robertmuehsig/OmniGUI
        public static void Main(string[] args)
        {
            var assemblies = typeof(MainClass).Assembly
                             .GetReferencedAssemblies()
                             .Concat(new[] { new AssemblyName("OmniGui.Xaml"), new AssemblyName("OmniGui"), })
                             .Select(Assembly.Load)
                             .ToList();

            Application.Init();

            var window        = new MainWindow();
            var omniGuiWidget = new OmniGuiWidget(assemblies)
            {
                Source = "layout.xaml", DataContext = new SampleViewModel(new GtkMessageService(window))
            };

            window.Add(omniGuiWidget);
            window.Show();
            omniGuiWidget.Show();
            Application.Run();
        }
コード例 #23
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        private static async Task Main(string[] args)
        {
            // Set correct working directory for compatibility with double-clicking
            Directory.SetCurrentDirectory(DirectoryHelpers.GetLocalDir());

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                Environment.SetEnvironmentVariable("GSETTINGS_SCHEMA_DIR", "share\\glib-2.0\\schemas\\");
            }

            var options = new CLIOptions();

            Parser.Default.ParseArguments <CLIOptions>(args)
            .WithParsed(r => options    = r)
            .WithNotParsed(r => options = null);

            if (options is null)
            {
                // Parsing probably failed, bail out
                return;
            }

            if (options.RunBatchProcessing)
            {
                if (string.IsNullOrEmpty(options.TargetDirectory) || options.ManifestType == EManifestType.Unknown)
                {
                    Log.Error("Target directory not set, or manifest type not set.");
                    return;
                }

                // At this point, the options should be valid. Run batch processing.
                if (Directory.Exists(options.TargetDirectory))
                {
                    Log.Info("Generating manifest...");

                    var manifestGenerationHandler = new ManifestGenerationHandler();

                    var progressReporter = new Progress <ManifestGenerationProgressChangedEventArgs>
                                           (
                        e => Log.Info($"Processed file {e.Filepath} : {e.Hash} : {e.Filesize}")
                                           );

                    await manifestGenerationHandler.GenerateManifestAsync
                    (
                        options.TargetDirectory,
                        options.ManifestType,
                        progressReporter,
                        CancellationToken.None
                    );

                    Log.Info("Generation finished.");
                }
                else
                {
                    Log.Error("The selected directory did not exist.");
                }
            }
            else if (string.IsNullOrEmpty(options.TargetDirectory) && options.ManifestType == EManifestType.Unknown)
            {
                // Run a GTK UI instead of batch processing
                Application.Init();
                SynchronizationContext.SetSynchronizationContext(new GLibSynchronizationContext());

                var win = MainWindow.Create();
                win.Show();
                Application.Run();
            }
        }
コード例 #24
0
        public static void Main(string[] args)
        {
            // if the user is not running a Unix Based OS - set the enviroment var path accordingly
            if (!ApplicationHelper.IsUnix)
            {
                Environment.SetEnvironmentVariable("PATH",
                                                   Environment.Is64BitOperatingSystem
                        ? @"C:\msys64\mingw64\bin"
                        : @"C:\msys32\mingw32\bin"
                                                   );
            }
            try
            {
                Application.Init();
            }
            catch (DllNotFoundException e)
            {
                var str = $"A file required by Projects is missing:\n\n{e.Message}.";

                if (!ApplicationHelper.IsUnix)
                {
                    MessageBox.Show(str, "Missing prerequisite", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    Console.WriteLine(str);
                }

                Environment.Exit(0);
            }
            catch (TypeInitializationException e)
            {
                var str = $"An issue occurred while trying to load projects:\n\n{e.Message}\n\nIs Gtk installed?";

                if (!ApplicationHelper.IsUnix)
                {
                    MessageBox.Show(str, "Check Install", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    Console.WriteLine(str);
                }

                Environment.Exit(0);
            }

            // store system's default font in variable
            var font = SystemFonts.DefaultFont;

            // set the font to the default font
            global::Gtk.Settings.Default.FontName = font.Name + " " + font.SizeInPoints;
            // force usage of smooth font
            global::Gtk.Settings.Default.XftAntialias = 1;
            global::Gtk.Settings.Default.XftRgba      = "rgb";

            // if arguments have been passed to the program
            if (args.Length != 0)
            {
                // store first argument
                var file = args[0];

                // get the file's extension
                var extension = Path.GetExtension(file);

                // if the extension isn't null, the file exists and is of the right extension, and the lock file
                // does not exist,
                // load the main application with the argument passed to the program
                if (extension != null && File.Exists(file) && extension.Equals(".prj") && !File.Exists(file + ".lk"))
                {
                    new ProjectWindow(file).Show();
                }
                // if the requirements are not met, then proceed with the startup process
                else
                {
                    Startup();
                }
                Application.Run();
            }
            // if no arguments have been passed then go to the startup process
            else
            {
                Startup();
            }
        }