Example #1
0
        public static int StartPlayer(string[]args)
        {
            Application.Init ();

            Catalog.Init (Config.packageName,
                      Config.prefix + "/share/locale");

            try
            {
                session = new Session ();
                string filename = null;
                if (args.Length == 1
                    && System.IO.File.Exists (args[0]))
                  {
                      filename = args[0];
                  }
                new ChessWindow (filename);
                Application.Run ();
            }
            catch (System.Exception e)
            {
                try
                {
                    MessageDialog md =
                        new MessageDialog (null,
                                   DialogFlags.
                                   DestroyWithParent,
                                   MessageType.
                                   Error,
                                   ButtonsType.
                                   Close,
                                   Catalog.
                                   GetString
                                   ("<b>Unexpected exception occured</b>\n\n")
                                   +
                                   GLib.
                                   Markup.
                                   EscapeText
                                   (e.
                                    ToString
                                    ()) +
                                   "\n" +
                                   Catalog.
                                   GetString
                                   ("Please send this bug report to\n")
                                   +
                                   "Nickolay V. Shmyrev  &lt;[email protected]&gt;\n");
                    md.Run ();
                    md.Hide ();
                    md.Dispose ();

                }
                catch
                {
                    throw e;
                }
            }

            return 0;
        }
Example #2
0
        public static int Main(string [] args)
        {
            Application.Init ();

            Catalog.Init (Config.packageName, Config.prefix + "/share/locale");

            try {

                session = new Session ();

                string filename = null;

                if (args.Length == 1 && System.IO.File.Exists (args[0])) {
                   filename = args[0];
                }

                            ChessWindow win = new ChessWindow (filename);

                            Application.Run ();

            } catch (ApplicationException) {
                return 1;
            } catch (System.Exception e) {

                 try {
                     MessageDialog md =
                                                new MessageDialog (null,
                                                                   DialogFlags.
                                                               DestroyWithParent,
                                                               MessageType.Error,
                                                                   ButtonsType.Close,
                                           Catalog.GetString ("An unexpected exception occured:\n\n") +
                                       e.ToString() + "\n" +
                                                       Catalog.GetString ("Please report about this exception to \n") +
                                      "Nickolay V. Shmyrev <*****@*****.**>");

                     md.Run ();
                                 md.Hide ();
                                 md.Dispose ();

                 } catch (Exception ex) {

                     throw e;

                     }
            }

            return 0;
        }
Example #3
0
        static int StartViewer(string[]args)
        {
            Application.Init ();

            Catalog.Init (Config.packageName,
                      Config.prefix + "/share/locale");

            try
            {
                session = new Session ();
                GameViewer.CreateInstance ();
                CsBoard.Plugin.PluginManager.Instance.
                    StartPlugins ();
                if (args.Length > 1)
                    GameViewer.Instance.Load (args[1]);
                Application.Run ();
            }
            catch (ApplicationException)
            {
                return 1;
            }
            catch (System.Exception e)
            {

                try
                {
                    MessageDialog md =
                        new MessageDialog (null,
                                   DialogFlags.
                                   DestroyWithParent,
                                   MessageType.
                                   Error,
                                   ButtonsType.
                                   Close,
                                   Catalog.
                                   GetString
                                   ("<b>Unexpected exception occured</b>\n\n")
                                   +
                                   GLib.
                                   Markup.
                                   EscapeText
                                   (e.
                                    ToString
                                    ()) +
                                   "\n" +
                                   Catalog.
                                   GetString
                                   ("Please send this bug report to\n")
                                   +
                                   "Nickolay V. Shmyrev  &lt;[email protected]&gt;\n");
                    md.Run ();
                    md.Hide ();
                    md.Dispose ();

                }
                catch
                {

                    throw e;

                }
            }

            return 0;
        }