Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/13/19 11:37:59 (5 years ago)
Author:
abeham
Message:

#2521: finished refactoring TSP

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Optimizer/3.3/StartPage.cs

    r17241 r17251  
    2222using System;
    2323using System.Collections.Generic;
     24using System.Drawing;
    2425using System.IO;
    2526using System.Linq;
     
    110111        }
    111112
    112       } catch {
    113113      } finally {
    114114        OnAllSamplesLoaded();
     
    120120      using (var stream = assembly.GetManifestResourceStream(name)) {
    121121        var serializer = new ProtoBufSerializer();
    122         var item = (NamedItem)serializer.Deserialize(stream, false);
     122        NamedItem item;
     123        try {
     124          item = (NamedItem)serializer.Deserialize(stream, false);
     125        } catch {
     126          item = new ErrorMessage(name, "Sample failed to load!");
     127        }
    123128        OnSampleLoaded(item, group, 1.0 / count);
    124129      }
     
    197202      Properties.Settings.Default.Save();
    198203    }
     204
     205    [Item("Error Message", "")]
     206    class ErrorMessage : NamedItem {
     207      public override Image ItemImage => Common.Resources.VSImageLibrary.Error;
     208
     209      protected ErrorMessage(ErrorMessage original, Cloner cloner) : base(original, cloner) { }
     210      public ErrorMessage(string error, string description) : base(error, description) { }
     211
     212      public override IDeepCloneable Clone(Cloner cloner) {
     213        return new ErrorMessage(this, cloner);
     214      }
     215    }
    199216  }
    200217}
Note: See TracChangeset for help on using the changeset viewer.