Skip to content

Commit dbae807

Browse files
committed
Added comments for the new members
1 parent 313d9b3 commit dbae807

24 files changed

+255
-69
lines changed

AddInExample/SwSampleAddIn.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -88,23 +88,23 @@ public override void OnInit()
8888
ShowMessage($"{Model.GetTitle()} document loaded");
8989
}
9090

91-
private void OnAccess3rdPartyData(DocumentHandler docHandler, Access3rdPartyDataAction_e type)
91+
private void OnAccess3rdPartyData(DocumentHandler docHandler, Access3rdPartyDataState_e type)
9292
{
9393
switch (type)
9494
{
95-
case Access3rdPartyDataAction_e.StorageRead:
95+
case Access3rdPartyDataState_e.StorageRead:
9696
LoadFromStorageStore();
9797
break;
9898

99-
case Access3rdPartyDataAction_e.StorageWrite:
99+
case Access3rdPartyDataState_e.StorageWrite:
100100
SaveToStorageStore();
101101
break;
102102

103-
case Access3rdPartyDataAction_e.StreamRead:
103+
case Access3rdPartyDataState_e.StreamRead:
104104
LoadFromStream();
105105
break;
106106

107-
case Access3rdPartyDataAction_e.StreamWrite:
107+
case Access3rdPartyDataState_e.StreamWrite:
108108
SaveToStream();
109109
break;
110110

@@ -261,7 +261,7 @@ private void OnHandlerCreated(DocumentHandler handler)
261261
handler.Destroyed += OnDestroyed;
262262
}
263263

264-
private bool OnRebuild(DocumentHandler docHandler, RebuildAction_e type)
264+
private bool OnRebuild(DocumentHandler docHandler, RebuildState_e type)
265265
{
266266
return App.SendMsgToUser2($"'{docHandler.Model.GetTitle()}' rebuilt ({type}). Cancel?",
267267
(int)swMessageBoxIcon_e.swMbQuestion, (int)swMessageBoxBtn_e.swMbYesNo) == (int)swMessageBoxResult_e.swMbHitNo;
@@ -291,11 +291,11 @@ private void OnDestroyed(DocumentHandler handler)
291291

292292
private bool m_ShowSelectionEvents = false;
293293

294-
private bool OnSelection(DocumentHandler docHandler, swSelectType_e selType, SelectionAction_e type)
294+
private bool OnSelection(DocumentHandler docHandler, swSelectType_e selType, SelectionState_e type)
295295
{
296296
if (m_ShowSelectionEvents)
297297
{
298-
if (type != SelectionAction_e.UserPreSelect)//dynamic selection
298+
if (type != SelectionState_e.UserPreSelect)//dynamic selection
299299
{
300300
return App.SendMsgToUser2($"'{docHandler.Model.GetTitle()}' selection ({type}) of {selType}. Cancel?",
301301
(int)swMessageBoxIcon_e.swMbQuestion, (int)swMessageBoxBtn_e.swMbYesNo) == (int)swMessageBoxResult_e.swMbHitNo;
@@ -311,7 +311,7 @@ private bool OnSelection(DocumentHandler docHandler, swSelectType_e selType, Sel
311311
}
312312
}
313313

314-
private bool OnSave(DocumentHandler docHandler, string fileName, SaveAction_e type)
314+
private bool OnSave(DocumentHandler docHandler, string fileName, SaveState_e type)
315315
{
316316
return App.SendMsgToUser2($"'{docHandler.Model.GetTitle()}' saving ({type}). Cancel?",
317317
(int)swMessageBoxIcon_e.swMbQuestion, (int)swMessageBoxBtn_e.swMbYesNo) == (int)swMessageBoxResult_e.swMbHitNo;
@@ -327,12 +327,12 @@ private void OnCustomPropertyModified(DocumentHandler docHandler, CustomProperty
327327
{
328328
foreach (var mod in modifications)
329329
{
330-
App.SendMsgToUser2($"'{docHandler.Model.GetTitle()}' custom property '{mod.Name}' changed ({mod.Type}) in '{mod.Configuration}' to '{mod.Value}'",
330+
App.SendMsgToUser2($"'{docHandler.Model.GetTitle()}' custom property '{mod.Name}' changed ({mod.Action}) in '{mod.Configuration}' to '{mod.Value}'",
331331
(int)swMessageBoxIcon_e.swMbInformation, (int)swMessageBoxBtn_e.swMbOk);
332332
}
333333
}
334334

335-
private void OnConfigurationChanged(DocumentHandler docHandler, ConfigurationChangeAction_e type, string confName)
335+
private void OnConfigurationChanged(DocumentHandler docHandler, ConfigurationChangeState_e type, string confName)
336336
{
337337
App.SendMsgToUser2($"'{docHandler.Model.GetTitle()}' configuration {confName} changed ({type}). Cancel?",
338338
(int)swMessageBoxIcon_e.swMbInformation, (int)swMessageBoxBtn_e.swMbOk);

Framework/Core/DocumentHandler.cs

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ public class DocumentHandler : IDocumentHandler
3535
public event DocumentStateChangedDelegate Activated;
3636
public event DocumentStateChangedDelegate Destroyed;
3737

38+
/// <summary>
39+
/// Raised when document is saving or saved (including auto saving)
40+
/// </summary>
3841
public event DocumentSaveDelegate Save
3942
{
4043
add
@@ -47,6 +50,9 @@ public event DocumentSaveDelegate Save
4750
}
4851
}
4952

53+
/// <summary>
54+
/// Raised when object is selected in SOLIDWORKS (either by the user or API)
55+
/// </summary>
5056
public event ObjectSelectionDelegate Selection
5157
{
5258
add
@@ -59,6 +65,9 @@ public event ObjectSelectionDelegate Selection
5965
}
6066
}
6167

68+
/// <summary>
69+
/// Raised when 3rd party storage and stream are ready for access (reading or writing)
70+
/// </summary>
6271
public event Access3rdPartyDataDelegate Access3rdPartyData
6372
{
6473
add
@@ -71,6 +80,9 @@ public event Access3rdPartyDataDelegate Access3rdPartyData
7180
}
7281
}
7382

83+
/// <summary>
84+
/// Raised when custom properties modified (added, removed or changed) from the UI or API
85+
/// </summary>
7486
public event CustomPropertyModifyDelegate CustomPropertyModify
7587
{
7688
add
@@ -83,6 +95,9 @@ public event CustomPropertyModifyDelegate CustomPropertyModify
8395
}
8496
}
8597

98+
/// <summary>
99+
/// Raised when item (e.g. feature, configuration) is modified in the Feature Manager Tree (e.g. renamed, added or removed)
100+
/// </summary>
86101
public event ItemModifyDelegate ItemModify
87102
{
88103
add
@@ -95,6 +110,9 @@ public event ItemModifyDelegate ItemModify
95110
}
96111
}
97112

113+
/// <summary>
114+
/// Raised when configuration is changed in part or assembly or sheet is activated in the drawing
115+
/// </summary>
98116
public event ConfigurationChangeDelegate ConfigurationChange
99117
{
100118
add
@@ -107,6 +125,9 @@ public event ConfigurationChangeDelegate ConfigurationChange
107125
}
108126
}
109127

128+
/// <summary>
129+
/// Raised when model is regenerated either as force regeneration or parametric regeneration or after rollback
130+
/// </summary>
110131
public event RebuildDelegate Rebuild
111132
{
112133
add
@@ -160,24 +181,24 @@ public virtual void Init(ISldWorks app, IModelDoc2 model)
160181
}
161182

162183
//TODO: remove this once the obsolete methods are removed
163-
private void OnAccess3rdPartyData(DocumentHandler docHandler, Access3rdPartyDataAction_e type)
184+
private void OnAccess3rdPartyData(DocumentHandler docHandler, Access3rdPartyDataState_e type)
164185
{
165186
switch (type)
166187
{
167188
#pragma warning disable CS0618
168-
case Access3rdPartyDataAction_e.StorageRead:
189+
case Access3rdPartyDataState_e.StorageRead:
169190
OnLoadFromStorageStore();
170191
break;
171192

172-
case Access3rdPartyDataAction_e.StorageWrite:
193+
case Access3rdPartyDataState_e.StorageWrite:
173194
OnSaveToStorageStore();
174195
break;
175196

176-
case Access3rdPartyDataAction_e.StreamRead:
197+
case Access3rdPartyDataState_e.StreamRead:
177198
OnLoadFromStream();
178199
break;
179200

180-
case Access3rdPartyDataAction_e.StreamWrite:
201+
case Access3rdPartyDataState_e.StreamWrite:
181202
OnSaveToStream();
182203
break;
183204
#pragma warning restore CS0618

Framework/Delegates/Access3rdPartyDataDelegate.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,10 @@
1010

1111
namespace CodeStack.SwEx.AddIn.Delegates
1212
{
13-
public delegate void Access3rdPartyDataDelegate(DocumentHandler docHandler, Access3rdPartyDataAction_e type);
13+
/// <summary>
14+
/// Delegate of <see cref="DocumentHandler.Access3rdPartyData"/> event
15+
/// </summary>
16+
/// <param name="docHandler">Document Handler which sends this notification</param>
17+
/// <param name="state">Type of the 3rd party storage access</param>
18+
public delegate void Access3rdPartyDataDelegate(DocumentHandler docHandler, Access3rdPartyDataState_e state);
1419
}

Framework/Delegates/ConfigurationChangeDelegate.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,11 @@
1010

1111
namespace CodeStack.SwEx.AddIn.Delegates
1212
{
13-
public delegate void ConfigurationChangeDelegate(DocumentHandler docHandler, ConfigurationChangeAction_e type, string confName);
13+
/// <summary>
14+
/// Delegate of <see cref="DocumentHandler.ConfigurationChange"/> event
15+
/// </summary>
16+
/// <param name="docHandler">Document Handler which sends this notification</param>
17+
/// <param name="state">Type of the configuration change</param>
18+
/// <param name="confName">Name of the new configuration</param>
19+
public delegate void ConfigurationChangeDelegate(DocumentHandler docHandler, ConfigurationChangeState_e state, string confName);
1420
}

Framework/Delegates/CustomPropertyModifyDelegate.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,44 @@
1010

1111
namespace CodeStack.SwEx.AddIn.Delegates
1212
{
13+
/// <summary>
14+
/// Custom Property modification data
15+
/// </summary>
1316
public class CustomPropertyModifyData
1417
{
15-
public CustomPropertyChangeAction_e Type { get; private set; }
18+
/// <summary>
19+
/// Type of the modification
20+
/// </summary>
21+
public CustomPropertyChangeAction_e Action { get; private set; }
22+
23+
/// <summary>
24+
/// Name of the custom property
25+
/// </summary>
1626
public string Name { get; private set; }
27+
28+
/// <summary>
29+
/// Configuration of custom property. Empty string for the file specific (generic) custom property
30+
/// </summary>
1731
public string Configuration { get; private set; }
32+
33+
/// <summary>
34+
/// Value of the custom property
35+
/// </summary>
1836
public string Value { get; private set; }
1937

2038
internal CustomPropertyModifyData(CustomPropertyChangeAction_e type, string name, string conf, string val)
2139
{
22-
Type = type;
40+
Action = type;
2341
Name = name;
2442
Configuration = conf;
2543
Value = val;
2644
}
2745
}
2846

47+
/// <summary>
48+
/// Delegate of <see cref="DocumentHandler.CustomPropertyModify"/> event
49+
/// </summary>
50+
/// <param name="docHandler">Document Handler which sends this notification</param>
51+
/// <param name="modifications">Array of all modifications in custom properties</param>
2952
public delegate void CustomPropertyModifyDelegate(DocumentHandler docHandler, CustomPropertyModifyData[] modifications);
3053
}

Framework/Delegates/DocumentSaveDelegate.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,12 @@
1010

1111
namespace CodeStack.SwEx.AddIn.Delegates
1212
{
13-
public delegate bool DocumentSaveDelegate(DocumentHandler docHandler, string fileName, SaveAction_e type);
13+
/// <summary>
14+
/// Delegate of <see cref="DocumentHandler.Save"/> event
15+
/// </summary>
16+
/// <param name="docHandler">Document Handler which sends this notification</param>
17+
/// <param name="fileName">Full path to save the file</param>
18+
/// <param name="state">Type of the save operation</param>
19+
/// <returns>Return false within the <see cref="SaveState_e.PreSave"/> to cancel the save operation</returns>
20+
public delegate bool DocumentSaveDelegate(DocumentHandler docHandler, string fileName, SaveState_e state);
1421
}

Framework/Delegates/DocumentStateChangedDelegate.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@
99

1010
namespace CodeStack.SwEx.AddIn.Delegates
1111
{
12+
/// <summary>
13+
/// Delegate of <see cref="DocumentHandler.Initialized"/>, <see cref="DocumentHandler.Activated"/>, <see cref="DocumentHandler.Destroyed"/> event,
14+
/// </summary>
15+
/// <param name="docHandler">Document Handler which sends this notification</param>
1216
public delegate void DocumentStateChangedDelegate(DocumentHandler docHandler);
1317
}

Framework/Delegates/ItemModifyDelegate.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,13 @@
1111

1212
namespace CodeStack.SwEx.AddIn.Delegates
1313
{
14-
public delegate void ItemModifyDelegate(DocumentHandler docHandler, ItemModificationAction_e type, swNotifyEntityType_e entType, string name, string oldName = "");
14+
/// <summary>
15+
/// Delegate of <see cref="DocumentHandler.ItemModify"/> event
16+
/// </summary>
17+
/// <param name="docHandler">Document Handler which sends this notification</param>
18+
/// <param name="action">Item modification type</param>
19+
/// <param name="entType">Modified entity type as described in <see href="http://help.solidworks.com/2017/english/api/swconst/SolidWorks.Interop.swconst~SolidWorks.Interop.swconst.swNotifyEntityType_e.html">swNotifyEntityType_e</see> enumeration</param>
20+
/// <param name="name">Name of the item</param>
21+
/// <param name="oldName">Old name of the item if <see cref="ItemModificationAction_e.PreRename"/> or <see cref="ItemModificationAction_e.Rename"/> operation</param>
22+
public delegate void ItemModifyDelegate(DocumentHandler docHandler, ItemModificationAction_e action, swNotifyEntityType_e entType, string name, string oldName = "");
1523
}

Framework/Delegates/ObjectSelectionDelegate.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,12 @@
1111

1212
namespace CodeStack.SwEx.AddIn.Delegates
1313
{
14-
public delegate bool ObjectSelectionDelegate(DocumentHandler docHandler, swSelectType_e selType, SelectionAction_e type);
14+
/// <summary>
15+
/// Delegate of <see cref="DocumentHandler.Selection"/> event
16+
/// </summary>
17+
/// <param name="docHandler">Document Handler which sends this notification</param>
18+
/// <param name="selType">Type of the selected object as described in <see href="http://help.solidworks.com/2014/english/api/swconst/SolidWorks.Interop.swconst~SolidWorks.Interop.swconst.swSelectType_e.html">swSelectType_e</see> enumeration</param>
19+
/// <param name="state">Type of the selection operation</param>
20+
/// <returns>Return false if <see cref="SelectionState_e.UserPreSelect"/> to cancel the user selection</returns>
21+
public delegate bool ObjectSelectionDelegate(DocumentHandler docHandler, swSelectType_e selType, SelectionState_e state);
1522
}

Framework/Delegates/RebuildDelegate.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,11 @@
1010

1111
namespace CodeStack.SwEx.AddIn.Delegates
1212
{
13-
public delegate bool RebuildDelegate(DocumentHandler docHandler, RebuildAction_e type);
13+
/// <summary>
14+
/// Delegate of <see cref="DocumentHandler.Rebuild"/> event
15+
/// </summary>
16+
/// <param name="docHandler">Document Handler which sends this notification</param>
17+
/// <param name="state">Type of the rebuild operation</param>
18+
/// <returns>Return false if <see cref="RebuildState_e.PreRebuild"/> to cancel rebuild operation</returns>
19+
public delegate bool RebuildDelegate(DocumentHandler docHandler, RebuildState_e state);
1420
}

0 commit comments

Comments
 (0)