Exemplo n.º 1
0
 T nullIfFails <T>(Producer <T> t, Producer <string> makeMessage) where T : class
 {
     try { return(t()); }
     catch (Exception e) {
         var message = LogC.errMessage(makeMessage(), e);
         gui.alertUser(message);
         LogC.err(message);
         return(null);
     }
 }
Exemplo n.º 2
0
        public static void load(ResearchGUI gui, bool isStarting)
        {
            if (isEmpty(gui.name()))
            {
                if (!isStarting)
                {
                    gui.alertUser("Fill in the Name box to continue.");
                }
                return;
            }
            var settings = file(gui.name());

            if (!settings.exists())
            {
                gui.alertUser("File missing:" + settings.path()); return;
            }
            LogC.verbose(() => "loading gui from file " + settings.path());
            var serialized = settings.bytes();
            var runInfo    = (SystemRunInfo)deserialize(serialized);

            runInfo.loadOnto(gui);
        }