Skip to content

Menu Items

The popup contains five items in a fixed order. The first item (Refresh Module) is always enabled. The remaining four are disabled when Instance.LockUserSettings is True. The Publish Module… item additionally requires Instance.PublisherMode = True.

A separator (BeginGroup = True) divides Refresh Module from the rest, since the four items below are state-mutating.

Refresh Module

Re-runs the data fetch on every Pulse tab in the module that has RefreshWithModule = True.

FCoreModule_Popup.vb — btnRefresh_ItemClick
For Each curTabPage As MyTabPage In curCoreModule.m_TabControl.TabPages
    If curTabPage.RefreshWithModule Then
        curTabPage.PulseContainer.RefreshAllBoxes()
    End If
Next

This mirrors the per-module loop in Main.vb (around line 1484) used by the global btnRefresh.ItemClick.

Cursor handling

The handler wraps the loop in a Cursors.WaitCursor / Try…Finally so the cursor is always restored, even if a refresh throws.

Reset Module to Default Settings…

Restores the module's tabs to the default set held in Instance.DefaultSaveAndShare. The reset is destructive:

  • Tabs not in the default set are removed.
  • Tabs in the default set that don't exist locally are added.
  • Existing tabs that match by name have their contents reset to defaults.
  • Tab order is rewritten to match the order in DefaultSaveAndShare.

The handler asks for confirmation, and — if both Leahy Consulting defaults and company-specific defaults exist for the module — lets the user pick which set to use.

See Reset Module Algorithm for the full step-by-step walkthrough.

Save and Share Module…

Serializes the module's CCoreModuleData and opens the standard Save-and-Share dialog so the user can save it to disk or share it via the existing share mechanism.

FCoreModule_Popup.vb — btnSaveAndShare_ItemClick
curCoreModule.Settings.RaiseOnDataSave()

Dim newSS As New SaveAndShare.CSaveAndShareFile
newSS.FileName = curCoreModule.ModuleInfo.ModuleCaption
newSS.SerialData = curCoreModule.Settings.m_SerialData
newSS.SettingsType = SaveAndShare.SettingsType.CORE_MODULE
newSS.ShowSaveAsForm(Activator.FindForm)

RaiseOnDataSave() runs first so CCoreModuleData.m_BoxModuleTabs reflects the current in-memory tab state before serialization. This is the same pattern used by the existing Save-and-Share-Tab handler in FPulseTab_Popup.

Publish Module…

Pushes the module to other users via CPublishInfo_CSD_1 and the existing publish queue.

FCoreModule_Popup.vb — btnPublish_ItemClick
curCoreModule.Settings.RaiseOnDataSave()

Dim newPF As New SaveAndShare.CPublishInfo_CSD_1(
    curCoreModule.Settings.m_SerialData,
    SaveAndShare.SettingsType.CORE_MODULE
)
newPF.PublishPolicy.PublishPolicyCode = SaveAndShare.PolicyCode.Everyone
newPF.PublishMap.Add("Module", curCoreModule.ModuleInfo.ModuleID)
newPF.ShowPublishForm(Instance.MainForm)

The PublishMap("Module") entry is the key the receiver uses to locate the right virtual file (\<ModuleID>.core). See Publish/Receive Loop for the full round-trip.

Already enabled

The receiving side requires no new code. CPulseConnection.ProcessPublishQueue (line 909) already handles SettingsType.CORE_MODULE. See the linked page for details.

Load Module from File…

Loads a previously-saved .pmod file and replaces the current module's settings with it. The module's tab control is rebuilt by the existing CCoreModule.Settings_DataLoadEnd handler when DataLoad is raised.

FCoreModule_Popup.vb — btnLoadFromFile_ItemClick (key steps)
Dim ssFile As SaveAndShareFile = FileIO.Functions.DeserializeFromBuffer(
    buffer, FileIO.SerializationFlags.UseCompression)

Dim newCoreData As CCoreModuleData = FileIO.Functions.DeserializeFromBuffer(
    ssFile.SaveAndShareData.ToArray, FileIO.SerializationFlags.UseCompression)
newCoreData = newCoreData.UpgradeSerialData

Activator.m_CoreModule.CoreModuleData = newCoreData
Activator.m_CoreModule.Settings.RaiseOnDataLoad()
Activator.m_CoreModule.m_TabControl.PerformLayout()

The handler:

  1. Prompts for a file via OpenFileDialog (filter: Pulse Module (*.pmod)).
  2. Reads the bytes and deserializes them as a SaveAndShareFile.
  3. Confirms with the user that loading will replace all tabs in the current module.
  4. Deserializes the inner CCoreModuleData and runs UpgradeSerialData to migrate any older schema.
  5. Assigns it to m_CoreModule.CoreModuleData and raises DataLoad.

The existing CCoreModule.Settings_DataLoadEnd handler then disposes the inner MyTabPage instances and rebuilds them from CoreModuleData.m_BoxModuleTabs.

Destructive

The confirmation dialog is intentional — the load wipes out everything in the target module's m_TabControl.