Пример #1
0
 public void DoCancel()
 {
     Gtk.MessageDialog qdlg = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning,
                                                    Gtk.ButtonsType.YesNo, Catalog.GetString("Cancelling an export will result in an invalid GPX file.\nAre you sure?"));
     if ((int)ResponseType.Yes == qdlg.Run())
     {
         qdlg.Hide();
         qdlg.Dispose();
         this.Hide();
         this.Dispose();
         m_writer.Cancel = true;
         return;
     }
     qdlg.Hide();
     this.ShowNow();
 }
        public QuestionResponse AskQuestionWithCancel(string question, string caption)
        {
            using (Gtk.MessageDialog md = new Gtk.MessageDialog ((Gtk.Window) WorkbenchSingleton.Workbench, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Question, Gtk.ButtonsType.None, question)) {

                md.AddActionWidget (new Button (Gtk.Stock.No), ResponseType.No);
                md.AddActionWidget (new Button (Gtk.Stock.Cancel), ResponseType.Cancel);
                md.AddActionWidget (new Button (Gtk.Stock.Yes), ResponseType.Yes);
                md.ActionArea.ShowAll ();

                Gtk.ResponseType response = (Gtk.ResponseType)md.Run ();
                md.Hide ();

                if (response == Gtk.ResponseType.Yes) {
                    return QuestionResponse.Yes;
                }

                if (response == Gtk.ResponseType.No) {
                    return QuestionResponse.No;
                }

                if (response == Gtk.ResponseType.Cancel) {
                    return QuestionResponse.Cancel;
                }

                return QuestionResponse.Cancel;
            }
        }
        public bool AskQuestion(string question, string caption)
        {
            using (Gtk.MessageDialog md = new Gtk.MessageDialog ((Gtk.Window) WorkbenchSingleton.Workbench, Gtk.DialogFlags.Modal | Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, question)) {
                int response = md.Run ();
                md.Hide ();

                if ((Gtk.ResponseType) response == Gtk.ResponseType.Yes)
                    return true;
                else
                    return false;
            }
        }
 protected virtual void OnDeleteClicked(object sender, System.EventArgs e)
 {
     ExternalTool tool = GetSelectedTool();
     MessageDialog dlg = new MessageDialog(this, DialogFlags.Modal, MessageType.Question,
                                           ButtonsType.YesNo, Catalog.GetString("Are you sure you wish to delete '{0}'"),
                                           tool.Name);
     if ((int) ResponseType.Yes == dlg.Run())
     {
         m_toolList.DeleteTool(tool.Name);
         RefreshList ();
     }
     dlg.Hide();
 }
 public static void ShowErrorWindow( string errorMessage, Window parentWindow=null )
 {
     var dialog = new MessageDialog(
         parentWindow,
         DialogFlags.Modal,
         MessageType.Error,
         ButtonsType.Ok,
         errorMessage
     );
     dialog.WindowPosition = WindowPosition.Center;
     dialog.Show();
     dialog.Run();
     dialog.Hide();
 }
Пример #6
0
		private void MessageDialogClicked (object o, EventArgs args)
		{
			using (Dialog dialog = new MessageDialog (this,
								  DialogFlags.Modal | DialogFlags.DestroyWithParent,
								  MessageType.Info,
								  ButtonsType.Ok,
								  "This message box has been popped up the following\nnumber of times:\n\n {0}",
								  i)) {
				dialog.Run ();
				dialog.Hide ();
			}

			i++;
		}
Пример #7
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;
        }
Пример #8
0
 public static void DictionaryInfoDialog(object sender, EventArgs e)
 {
     Gtk.MessageDialog md = new Gtk.MessageDialog(
         game.Window,
         DialogFlags.DestroyWithParent,
         MessageType.Info,
         ButtonsType.Ok,
         "Slovník obsahuje:\n" + game.dictionary.WordCount +
         "\t\tslov\n" + game.dictionary.NodeCount +
         "\t\tvrcholů\nNejdelší slovo má delku " + game.dictionary.MaxDepth + "." +
         "\nNačten z:\n\t" + Scrabble.Game.InitialConfig.dicPath);
     md.Run();
     md.Hide();
     md.Destroy();
 }
Пример #9
0
 public static void Info(string msg)
 {
     GLib.Idle.Add (new GLib.IdleHandler (delegate() {
         MessageDialog md = new MessageDialog(null, DialogFlags.DestroyWithParent,
             MessageType.Info, ButtonsType.Ok, msg);
         md.DeleteEvent += delegate(object o, DeleteEventArgs args) {
             md.Destroy();
         };
         md.Response += delegate(object o, ResponseArgs args) {
             md.Hide();
             md.Destroy();
         };
         md.Show ();
         return false;
     }));
 }
 public void DoCancel()
 {
     Gtk.MessageDialog qdlg = new Gtk.MessageDialog (this, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning,
                                                    Gtk.ButtonsType.YesNo, Catalog.GetString("Cancelling an export will result in an invalid GPX file.\nAre you sure?"));
     if ((int) ResponseType.Yes == qdlg.Run())
     {
         qdlg.Hide();
         qdlg.Dispose();
         this.Hide();
         this.Dispose();
         m_writer.Cancel = true;
         return;
     }
     qdlg.Hide();
     this.ShowNow();
 }
Пример #11
0
        void HandleExceptionManagerUnhandledException(UnhandledExceptionArgs args)
        {
            Exception ex = (Exception)args.ExceptionObject;

            Console.WriteLine("Unhandled Exception: {0}", ex.GetType ().ToString ());
            Console.WriteLine("\t{0}", ex.Message);
            Console.WriteLine("\t{0}", ex.Source);
            Console.WriteLine("\t{0}", ex.StackTrace);

            MessageDialog d = new MessageDialog (null, DialogFlags.Modal, MessageType.Error,
                                                 ButtonsType.Close, true, "<b>{0}</b>: {1} at <i>{2}</i>",
                                                 ex.GetType ().ToString(),
                                                 ex.Message, ex.Source);
            d.Run ();
            d.Hide ();
            d.Dispose ();
            args.ExitApplication = true;
        }
Пример #12
0
 public void SetCache(Geocache cache)
 {
     if (saveButton.Sensitive == true)
     {
         MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo, Catalog.GetString("You have unsaved notes, do you wish to save them?"));
         if ((int)ResponseType.Yes ==  dlg.Run())
         {
             SaveNotes();
         }
         dlg.Hide();
     }
     current = cache;
     if (cache != null)
     {
         editorWidget.Text = cache.Notes;
         editorWidget.Sensitive = true;
     }
     else
     {
         editorWidget.Sensitive = false;
         editorWidget.Text = String.Empty;
     }
     saveButton.Sensitive = false;
 }
        public void AddFilesToProject()
        {
            Project project = CurrentNode.GetParentDataItem (typeof(Project), true) as Project;

            using (FileSelector fdiag  = new FileSelector (GettextCatalog.GetString ("Add files"))) {
                fdiag.SelectMultiple = true;

                int result = fdiag.Run ();
                try {
                    if (result != (int) ResponseType.Ok)
                        return;

                    int action = -1;
                    foreach (string file in fdiag.Filenames) {
                        if (file.StartsWith (project.BaseDirectory)) {
                            MoveCopyFile (project, CurrentNode, file, true, true);
                        } else {
                            using (MessageDialog md = new MessageDialog (
                                 (Window) WorkbenchSingleton.Workbench,
                                 DialogFlags.Modal | DialogFlags.DestroyWithParent,
                                 MessageType.Question, ButtonsType.None,
                                 String.Format (GettextCatalog.GetString ("{0} is outside the project directory, what should I do?"), file)))
                            {
                                CheckButton remember = null;
                                if (fdiag.Filenames.Length > 1) {
                                    remember = new CheckButton (GettextCatalog.GetString ("Use the same action for all selected files."));
                                    md.VBox.PackStart (remember, false, false, 0);
                                }
                                md.AddButton (Gtk.Stock.Copy, 1);
                                md.AddButton (GettextCatalog.GetString ("_Move"), 2);
                                md.AddButton (Gtk.Stock.Cancel, ResponseType.Cancel);
                                md.VBox.ShowAll ();

                                int ret = -1;
                                if (action < 0) {
                                    ret = md.Run ();
                                    md.Hide ();
                                    if (ret < 0) return;
                                    if (remember != null && remember.Active) action = ret;
                                } else {
                                    ret = action;
                                }

                                try {
                                    MoveCopyFile (project, CurrentNode, file, ret == 2, false);
                                }
                                catch (Exception ex) {
                                    Runtime.MessageService.ShowError (ex, GettextCatalog.GetString ("An error occurred while attempt to move/copy that file. Please check your permissions."));
                                }
                            }
                        }
                    }
                } finally {
                    fdiag.Hide ();
                }
            }
        }
Пример #14
0
        protected virtual void doRemove(object sender, System.EventArgs e)
        {
            Waypoint toDelete = GetSelectedWaypoint ();

            MessageDialog md = new MessageDialog (null, DialogFlags.DestroyWithParent, MessageType.Info, ButtonsType.YesNo, "Are you sure you wish to delete " + toDelete.Name);

            try {
                if ((int)ResponseType.Yes == md.Run ()) {
                    if (toDelete.Symbol == "Final Location")
                        m_mon.SelectedCache.HasFinal = false;
                    Engine.getInstance ().Store.DeleteWaypoint (toDelete.Name);
                    UpdateCacheInfo ();
                }
                md.Hide ();
                md.Dispose ();
            } catch (Exception ex) {
                md.Hide ();
                md.Dispose ();
                UIMonitor.ShowException (ex);
            }
        }
Пример #15
0
 public void GrabWaypoints()
 {
     Geocache cache = m_mon.SelectedCache;
     String expr = @"\b[NnSs] ?[0-9]+.? ?[0-9]*\.[0-9]*\s[WwEe] ?[0-9]+.? ?[0-9]*\.[0-9]*";
     String desc = cache.ShortDesc + cache.LongDesc;
     MatchCollection matches = Regex.Matches(desc, expr);
     m_mon.StartProgressLoad(Catalog.GetString("Grabbing Waypoints"), false);
     if (matches.Count > 0)
     {
         ScanWaypointsDialog dlg = new ScanWaypointsDialog(matches.Count, this, matches);
         dlg.Run();
     }
     else
     {
         MessageDialog dlg = new MessageDialog(m_mon.Main, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
                                               Catalog.GetString("OCM was unable to find any child waypoints."));
         dlg.Run();
         dlg.Hide();
     }
     m_mon.SetProgressDone(false);
 }
Пример #16
0
        public void Start(String targetDB, bool isMove, ModeEnum modeType, OCMMainWindow win)
        {
            if (isMove)
            {
                Title = Catalog.GetString ("Move Caches...");
                copyLabel.Markup = Catalog.GetString ("Moving Geocaches");
            }
            List<Geocache> caches;
            if (modeType == CopyingProgress.ModeEnum.VISIBLE)
            {
                caches = win.CacheList.UnfilteredCaches;
            }
            else if (modeType == CopyingProgress.ModeEnum.SELECTED)
            {
                caches = new List<Geocache> ();
                caches.Add (win.CacheList.SelectedCache);
            }
            else
            {
                caches = null;
                //caches = new List<Geocache> (UIMonitor.getInstance ().CacheStore.GetUnfilteredCaches(0d,0d,new string[0]));
            }
            ACacheStore target = new FileStore (targetDB);
            ACacheStore source = win.App.CacheStore;
            targetDBLabel.Text = targetDB;
            double count = 0;
            total = caches.Count;
            if (target.NeedsUpgrade)
            {
                MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
                                                      Catalog.GetString("The target database needs to be upgraded. " +
                                                      	"Please open the target database before trying to copy/move caches."));
                dlg.Run();
                dlg.Hide();
                this.Hide();
                return;
            }
            buttonOk.Visible = false;
            List<String> str = new List<String>();
            foreach(Geocache c in caches)
            {
                str.Add(c.Name);
            }

            target.StartUpdate();
            target.PurgeAllLogs(str.ToArray());
            target.PurgeAllAttributes(str.ToArray());
            target.PurgeAllTravelBugs(str.ToArray());
            foreach(Geocache cache in caches)
            {
                if (cancel)
                {
                    target.CancelUpdate();
                    this.Hide();
                    this.Dispose();
                    return;
                }

                count++;
                UpdateProgress(count, cache.Name);
                target.AddWaypointOrCache(cache, false, false);
                List<CacheLog> logs = source.GetCacheLogs(cache.Name);
                foreach(CacheLog log in logs)
                {
                    target.AddLog(cache.Name, log);
                }

                List<Waypoint> children = source.GetChildWaypoints(new string[]{cache.Name});
                foreach (Waypoint child in children)
                {
                    target.AddWaypointOrCache(child, false, false);
                }

                CacheAttribute[]  attributes = source.GetAttributes(cache.Name);
                foreach (CacheAttribute attribute in attributes)
                {
                    target.AddAttribute(cache.Name,attribute);
                }

                if (isMove)
                    source.DeleteWaypoint(cache.Name);
            }
            statusLabel.Markup = Catalog.GetString("<i>Complete</i>");
            progressBar.Text = Catalog.GetString("Complete");
            buttonOk.Visible = true;
            buttonCancel.Visible = false;
            target.CompleteUpdate();
        }
 protected virtual void OnDeleteButtonClicked(object sender, System.EventArgs e)
 {
     Gtk.TreeIter itr;
     Gtk.TreeModel model;
     if (mapView.Selection.GetSelected (out model, out itr)) {
         MapDescription map = (MapDescription)model.GetValue (itr, 0);
         MessageDialog dlg = new MessageDialog (null, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, String.Format (Catalog.GetString ("Are you sure you want to delete map {0}?"), map.Name));
         if ((int)ResponseType.Yes == dlg.Run ()) {
             m_maps.Remove(map);
             ReloadMaps();
         }
         dlg.Hide();
     }
 }
Пример #18
0
        void HandleShouldRemove(object sender, ShouldRemoveEventArgs e)
        {
            string title;
            string message;

            if (e.DeleteData) {
                title = _("Delete torrent");
                message = _("Remove torrent and delete all data?");
            } else {
                title = _("Remove torrent");
                message = _("Are you sure you want to remove the torrent?");
            }

            MessageDialog messageDialog = new MessageDialog (this,
                                                             DialogFlags.Modal,
                                                             MessageType.Question,
                                                             ButtonsType.YesNo, message);
            messageDialog.Title = title;
            e.ShouldRemove = (ResponseType) messageDialog.Run() == ResponseType.Yes;
            messageDialog.Hide();
            messageDialog.Destroy ();
        }
Пример #19
0
 public void GrabWaypoints()
 {
     String expr = @"\b[NnSs] ?[0-9]+.? ?[0-9]*\.[0-9]*\s[WwEe] ?[0-9]+.? ?[0-9]*\.[0-9]*";
     String desc = m_Cache.ShortDesc + m_Cache.LongDesc;
     MatchCollection matches = Regex.Matches(desc, expr);
     if (matches.Count > 0)
     {
         ScanWaypointsDialog dlg = new ScanWaypointsDialog(matches.Count, this, matches);
         dlg.Run();
     }
     else
     {
         MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok,
                                               Catalog.GetString("OCM was unable to find any child waypoints."));
         dlg.Run();
         dlg.Hide();
     }
 }
Пример #20
0
 public void AddTool(ExternalTool tool)
 {
     if (m_tools.ContainsKey(tool.Name))
     {
         MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo,
                                               String.Format(Catalog.GetString("Are you sure you wish to " +
                                               	"overwrite \"{0}\"?"), tool.Name));
         if ((int) ResponseType.Yes != dlg.Run())
         {
             dlg.Hide();
             return;
         }
         else
         {
             dlg.Hide();
             m_tools.Remove(tool.Name);
         }
     }
     m_tools.Add(tool.Name, tool);
     UpdateETFile();
 }
Пример #21
0
 public void AddProfile(GPSProfile prof)
 {
     if (m_profiles.ContainsKey(prof.Name))
     {
         MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo,
                                               String.Format(Catalog.GetString("Are you sure you wish to " +
                                               	"overwrite \"{0}\"?"), prof.Name));
         if ((int) ResponseType.Yes != dlg.Run())
         {
             dlg.Hide();
             return;
         }
         else
         {
             dlg.Hide();
             m_profiles.Remove(prof.Name);
         }
     }
     m_profiles.Add(prof.Name, prof);
     UpdateProfFile();
 }
Пример #22
0
        public void on_board_move(string move)
        {
            if (!control.MakeMove (move)) {

                                MessageDialog md =
                                        new MessageDialog (csboardWindow,
                                                           DialogFlags.
                                                           DestroyWithParent,
                                                           MessageType.
                                                           Warning,
                                                           ButtonsType.Close,
                                                           Catalog.GetString("Illegal move"));
                                md.Run ();
                                md.Hide ();
                                md.Dispose ();

                        }
                        return;
        }
Пример #23
0
 protected virtual void doRemove(object sender, System.EventArgs e)
 {
     Waypoint toDelete = GetSelectedWaypoint ();
     MessageDialog md = new MessageDialog (null, DialogFlags.DestroyWithParent,
                                           MessageType.Info, ButtonsType.YesNo,
                                           "Are you sure you wish to delete " + toDelete.Name);
     if ((int)ResponseType.Yes == md.Run ())
     {
         if (toDelete.Symbol == "Final Location")
             m_Cache.HasFinal = false;
         m_App.DeleteChildPoint(toDelete.Name);
     }
     md.Hide ();
     md.Dispose ();
 }
Пример #24
0
        public void on_book_activate(System.Object b, EventArgs e)
        {
            ArrayList result = control.Book ();

                        if (result.Count == 0) {

                                MessageDialog md =
                                        new MessageDialog (csboardWindow,
                                                           DialogFlags.
                                                           DestroyWithParent,
                                                           MessageType.Info,
                                                           ButtonsType.Close,
                                                           Catalog.GetString("There is no book move in this position"));
                                md.Run ();
                                md.Hide ();
                                md.Dispose ();
                        }
                        else {
                                BookDialog dialog = new BookDialog (result);

                                if (dialog.Run () == (int) ResponseType.Apply) {
                                        dialog.Hide ();

                                        string move;
                                        move = dialog.GetMove ();
                                        if (move != null) {
                                                control.MakeMove (move);
                                        }

                                        dialog.Dispose ();
                                }
                                else {
                                        dialog.Hide ();
                                        dialog.Dispose ();
                                }
                        }
        }
 protected virtual void OnRestoreButtonClicked(object sender, System.EventArgs e)
 {
     MessageDialog dlg = new MessageDialog (null, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, String.Format (Catalog.GetString ("Are really want to delete all maps and restore the default maps?")));
     if ((int)ResponseType.Yes == dlg.Run ()) {
         m_maps = MapManager.GetMapsFromFile("maps/defaultmaps.xml");
         ReloadMaps();
     }
     dlg.Hide();
 }
Пример #26
0
        public void on_control_game_over(string reason)
        {
            statusbar.Push (gameStatusbarId, Catalog.GetString("Game Over"));

                        MessageDialog md = new MessageDialog (csboardWindow,
                                                              DialogFlags.
                                                              DestroyWithParent,
                                                              MessageType.
                                                              Info,
                                                              ButtonsType.
                                                              Close,
                                                              Catalog.GetString("Game Over") + "\n" +
                                                              reason);
                        md.Run ();
                        md.Hide ();
                        md.Dispose ();

                        return;
        }
Пример #27
0
        // Start a new debugger process if the debugger is not already
        // running.
        public void Start(string cmdline)
        {
            if (debug != null)
            return;

            string path = settings.MSPDebugPath;
            string args = "--embed " + cmdline;

            if (settings.UseBundledDebugger)
            {
            string self = Assembly.GetExecutingAssembly().Location;

            path = Path.Combine
            (Path.GetDirectoryName(self), "mspdebug.exe");
            }

            isReady = false;
            try {
            debug = new Debugger(path, args);
            }
            catch (Exception ex)
            {
            MessageDialog dlg = new MessageDialog
            (null, DialogFlags.Modal, MessageType.Error,
             ButtonsType.Ok, "Can't start debugger: {0}",
             ex.Message);

            dlg.Title = "Olishell";
            dlg.Run();
            dlg.Hide();
            return;
            }

            messageEvent = new ITC.GtkListener(debug.Output);
            messageEvent.Signalled += OnMessage;

            readyEvent = new ITC.GtkListener(debug.Ready);
            readyEvent.Signalled += OnReady;

            if (DebuggerStarted != null)
            DebuggerStarted(this, null);
        }
Пример #28
0
        public void on_control_hint(string hint)
        {
            MessageDialog md = new MessageDialog (csboardWindow,
                                                              DialogFlags.
                                                              DestroyWithParent,
                                                              MessageType.
                                                              Info,
                                                              ButtonsType.
                                                              OkCancel,
                                  Catalog.GetString("You can move ") + hint);

                    md.DefaultResponse = ResponseType.Ok;
                            int response = md.Run ();

                        if (response == (int)ResponseType.Ok) {
                               control.MakeMove (hint);
                        }

                            md.Hide ();
                            md.Dispose ();
        }
Пример #29
0
 void on_about1_activate(object o, EventArgs e)
 {
     using (Dialog dialog = new MessageDialog(null, DialogFlags.DestroyWithParent,
          MessageType.Info, ButtonsType.Close,
          "MapDesigner by Hugh Perkins\n\nBuilt using C#, GTK#, GTK, Tao, SDL, OpenGL, Spring"))
     {
         dialog.Run();
         dialog.Hide();
     }
 }
Пример #30
0
        public void on_save_activate(System.Object b, EventArgs e)
        {
            FileChooserDialog fd = new FileChooserDialog (Catalog.GetString("Save Game"), csboardWindow, FileChooserAction.Save);

            fd.AddButton (Stock.Close, (int) ResponseType.Close);
                        fd.AddButton (Stock.Save, (int) ResponseType.Ok);

                        int res = fd.Run();
            fd.Hide ();

                        if (res == (int) ResponseType.Ok) {

                                        if (System.IO.File.Exists (fd.Filename)) {
                                                MessageDialog md =
                                                new MessageDialog (csboardWindow,
                                                           DialogFlags.
                                                           DestroyWithParent,
                                                           MessageType.Warning,
                                                           ButtonsType.OkCancel,
                                                           Catalog.GetString("File ") + fd.Filename +
                                                           Catalog.GetString(" already exists\n\n") +
                                                           Catalog.GetString("Do you wish to overwrite it?"));
                                                if (md.Run () == (int)ResponseType.Ok) {
                                                        control.SaveGame (fd.Filename);
                                                }
                                                md.Hide ();
                                                md.Dispose ();
                                        } else {
                                                control.SaveGame (fd.Filename);
                                        }
                                }

                        fd.Dispose ();
        }
Пример #31
0
        protected virtual void OnRemoveClick(object sender, System.EventArgs e)
        {
            MessageDialog dlg = new MessageDialog(this, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo,
                                                  Catalog.GetString("Are you sure you want to remove this filter?"));
            if ((int) ResponseType.No == dlg.Run())
            {
                dlg.Hide();
                dlg.Dispose();
                return;
            }

            dlg.Hide();
            dlg.Dispose();
            Gtk.TreeIter itr;
            Gtk.TreeModel model;
            if (conditionList.Selection.GetSelected (out model, out itr))
            {
                m_Store.Remove(ref itr);
            }
        }
Пример #32
0
        public ChessWindow(string filename)
        {
            string engine = App.session.Engine;

                        /* try { */

                if (engine.LastIndexOf ("crafty ") >= 0) {
                                    control = new Crafty (engine);
                } else
                if (engine.LastIndexOf ("phalanx ") >= 0) {
                                    control = new Phalanx (engine);
                } else
                if (engine.LastIndexOf ("gnuchess ") >= 0) {
                    control = new GnuChess (engine);
                } else
                if (engine.LastIndexOf ("ICS ") >= 0) {
                    control = new ICS (engine);
                } else {
                  MessageDialog md =
                                        new MessageDialog (csboardWindow,
                                                           DialogFlags.
                                                           DestroyWithParent,
                                                           MessageType.Error,
                                                           ButtonsType.Close,
                                                           Catalog.GetString(
                               "<b>Unknown engine</b>\n\nPlease check gconf keys of csboard"));

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

                  control = new GnuChess ("/usr/bin/gnuchess -x -e");

                }

                        /*} catch {

                                MessageDialog md =
                                        new MessageDialog (null, 0, MessageType.Error,
                                                           ButtonsType.Close,
                                                           String.Format(Catalog.GetString (
                                                           "<b>Failed to start engine</b>\n\nCheck that program '{0}' is available."),
                                                           engine));

                                md.Run ();
                                md.Hide ();
                                md.Dispose ();
                                return;
            }*/

                        Glade.XML gXML =
                                Glade.XML.FromAssembly ("csboard.glade",
                                     "csboardWindow", null);
                        gXML.Autoconnect (this);

                        gameStatusbarId = statusbar.GetContextId ("game");
                        gameStatusbarId = statusbar.GetContextId ("move");

                        // FIXME: Use libglade to create toolbar

            App.session.SetupGeometry (csboardWindow);
            csboardWindow.Show ();

                        control.WaitEvent +=
                                new ControlWaitHandler (on_control_wait);
                        control.BusyEvent +=
                                new ControlBusyHandler (on_control_busy);
                        control.PositionChangedEvent +=
                                new
                                ControlPositionChangedHandler
                                (on_position_changed);
                        control.GameOverEvent +=
                                new
                                ControlGameOverHandler (on_control_game_over);
                        control.SwitchSideEvent +=
                                new
                                ControlSwitchSideHandler (on_control_side);
                        control.HintEvent +=
                                new
                                ControlHintHandler (on_control_hint);

            // Setup board widget
            progressbar = new ProgressBar ();
            status_frame.Add (progressbar);

                        boardWidget = new PlayerBoard (control.GetPosition ());
                        frame.Add (boardWidget);
                        boardWidget.Show ();

            SetupLevel ();

            boardWidget.showCoords = App.session.ShowCoords;
            boardWidget.highLightMove = App.session.HighLightMove;
            boardWidget.showAnimations = App.session.showAnimations;

            show_coords.Active = App.session.ShowCoords;
            last_move.Active = App.session.HighLightMove;
            possible_moves.Active = App.session.PossibleMoves;
            animate.Active = App.session.showAnimations;

                        boardWidget.MoveEvent +=
                                new BoardMoveHandler (on_board_move);

                        boardWidget.StartMoveHintEvent +=
                                new StartMoveHintHandler (on_board_start_move);

            if (filename == null)
                            control.OpenGame (App.session.Filename);
            else
                control.OpenGame (filename);
        }