Skip to content

Commit 76b7071

Browse files
fix renaming label error
1 parent 7ad93dd commit 76b7071

File tree

3 files changed

+9
-23
lines changed

3 files changed

+9
-23
lines changed

Blueprint41.Modeller/Program.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ static class Program
1313
static void Main()
1414
{
1515
// Add the event handler for handling UI thread exceptions to the event.
16-
Application.ThreadException += Application_ThreadException;
16+
Application.ThreadException += Application_ThreadException;
1717

1818
// Set the unhandled exception mode to force all Windows Forms errors to go through
1919
// our handler.
2020
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
2121

2222
// Add the event handler for handling non-UI thread exceptions to the event.
2323
AppDomain.CurrentDomain.UnhandledException +=
24-
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
24+
new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
2525

2626
Application.EnableVisualStyles();
2727
Application.SetCompatibleTextRenderingDefault(false);
@@ -49,8 +49,8 @@ private static void Application_ThreadException(object sender, System.Threading.
4949
}
5050

5151
// Exits the program when the user clicks Abort.
52-
if (result == DialogResult.Abort)
53-
Application.Exit();
52+
//if (result == DialogResult.Abort)
53+
// Application.Exit();
5454
}
5555

5656
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
@@ -61,6 +61,8 @@ static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEv
6161
string errorMsg = "An application error occurred. Please contact support@circles-arrows.com " +
6262
"with the following information:\n\n";
6363

64+
ShowThreadExceptionDialog("Blueprint41 Modeller Error", ex);
65+
6466
// Since we can't prevent the app from terminating, log this to the event log.
6567
if (!EventLog.SourceExists("ThreadException"))
6668
{

Blueprint41.Modeller/Schemas/Logic/Entity.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ protected override void InitializeLogic()
206206
relationship.Target.ReferenceGuid = newGuid;
207207
}
208208
}
209-
209+
210210
Guid = newGuid;
211211
}
212212
};
@@ -253,7 +253,7 @@ protected override void InitializeLogic()
253253
ClearStaticData();
254254
};
255255
}
256-
256+
257257
private void CreateStaticData()
258258
{
259259
if (Xml.@staticData == null)

Blueprint41.Modeller/Schemas/Logic/Submodel.cs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -97,33 +97,17 @@ protected override void InitializeLogic()
9797
{
9898
OnLabelChanged += delegate (object sender, PropertyChangedEventArgs<string> e)
9999
{
100-
entitiesLookUp?.Clear();
101100
};
102101
}
103102

104-
105-
private Dictionary<string, Entity> entitiesLookUp = new Dictionary<string, Entity>();
106103
public Entity Entity
107104
{
108105
get
109106
{
110107
if (Model == null)
111108
return null;
112109

113-
Entity entity;
114-
try
115-
{
116-
if (entitiesLookUp.Count == 0)
117-
entitiesLookUp = Model.Entities.Entity.ToDictionary(x => x.Label, y => y);
118-
119-
entity = entitiesLookUp[Label];
120-
}
121-
catch (Exception)
122-
{
123-
throw new Exception(string.Format("'{0}' exists in <submodels> but does not exist in <entities>. Remove all '{1}' references from all <submodels>", Label, Label));
124-
}
125-
126-
return entity;
110+
return Model.Entities.Entity.First(item => item.Label == Label);
127111
}
128112
set
129113
{

0 commit comments

Comments
 (0)