[chronojump] SIMULATED session cannot be edited or deleted



commit bb4a17af40e74d2c49f7954897f42c7193e9d3ab
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jul 21 17:19:49 2016 +0200

    SIMULATED session cannot be edited or deleted

 src/constants.cs      |    5 ++++-
 src/gui/chronojump.cs |   26 +++++++++++++++++++-------
 2 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/src/constants.cs b/src/constants.cs
index d0e2227..6f723f9 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -164,8 +164,11 @@ public class Constants
        public const string Name = "name";
        public const string Height = "height";
        public const string Weight = "weight";
+       
+       //session
+       public static string SessionProtected = Catalog.GetString("Sorry, this session cannot be modified."); 
//SIMULATED session
 
-       //server        
+       //server
        public const string ServerPingTable = "SPing"; 
        public const string ServerEvaluatorTable = "SEvaluator"; 
        public const string IPUnknown = "Unknown"; 
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index b6f95fe..2a919b1 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2581,11 +2581,17 @@ public partial class ChronoJumpWindow
                }
        }
        
-       private void on_edit_session_activate (object o, EventArgs args) {
+       private void on_edit_session_activate (object o, EventArgs args) 
+       {
                LogB.Information("edit session");
-               sessionAddEditWin = SessionAddEditWindow.Show(app1, currentSession);
-               sessionAddEditWin.FakeButtonAccept.Clicked -= new EventHandler(on_edit_session_accepted);
-               sessionAddEditWin.FakeButtonAccept.Clicked += new EventHandler(on_edit_session_accepted);
+               
+               if(currentSession.Name == "SIMULATED")
+                       new DialogMessage(Constants.MessageTypes.INFO, Constants.SessionProtected);
+               else {
+                       sessionAddEditWin = SessionAddEditWindow.Show(app1, currentSession);
+                       sessionAddEditWin.FakeButtonAccept.Clicked -= new 
EventHandler(on_edit_session_accepted);
+                       sessionAddEditWin.FakeButtonAccept.Clicked += new 
EventHandler(on_edit_session_accepted);
+               }
        }
        
        private void on_edit_session_accepted (object o, EventArgs args) {
@@ -2652,10 +2658,16 @@ public partial class ChronoJumpWindow
        }
        
        
-       private void on_delete_session_activate (object o, EventArgs args) {
+       private void on_delete_session_activate (object o, EventArgs args) 
+       {
                LogB.Information("--- delete session ---");
-               ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Are you sure you want to 
delete the current session"), "", Catalog.GetString("and all the session tests?"));
-               confirmWin.Button_accept.Clicked += new EventHandler(on_delete_session_accepted);
+               
+               if(currentSession.Name == "SIMULATED")
+                       new DialogMessage(Constants.MessageTypes.INFO, Constants.SessionProtected);
+               else {
+                       ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Are you sure you 
want to delete the current session"), "", Catalog.GetString("and all the session tests?"));
+                       confirmWin.Button_accept.Clicked += new EventHandler(on_delete_session_accepted);
+               }
        }
        
        private void on_delete_session_accepted (object o, EventArgs args) 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]