public void CloseCapture(SnapshotFileData snapshot) { if (snapshot == null) { return; } try { if (Second != null) { if (snapshot == Second) { m_UIState.ClearSecondMode(); Second.GuiData.CurrentState = SnapshotFileGUIData.State.Closed; } else if (snapshot == First) { m_UIState.ClearFirstMode(); if (First != null) { First.GuiData.CurrentState = SnapshotFileGUIData.State.Closed; } First = Second; m_UIState.SwapLastAndCurrentSnapshot(); } else { // The snapshot wasn't open, there is nothing left todo here. return; } UIElementsHelper.SwitchVisibility(snapshot.GuiData.dynamicVisualElements.openButton, snapshot.GuiData.dynamicVisualElements.closeButton); Second = null; m_UIState.CurrentViewMode = UIState.ViewMode.ShowFirst; if (First != null) { m_OpenSnapshotsPane.SetSnapshotUIData(true, First.GuiData, true); } else { m_OpenSnapshotsPane.SetSnapshotUIData(true, null, true); } m_OpenSnapshotsPane.SetSnapshotUIData(false, null, false); // With two snapshots open, there could also be a diff to be closed/cleared. m_UIState.ClearDiffMode(); } else { if (snapshot == First) { First.GuiData.CurrentState = SnapshotFileGUIData.State.Closed; First = null; m_UIState.ClearAllOpenModes(); } else if (snapshot == Second) { Second.GuiData.CurrentState = SnapshotFileGUIData.State.Closed; Second = null; m_UIState.ClearAllOpenModes(); } else { // The snapshot wasn't open, there is nothing left todo here. return; } m_OpenSnapshotsPane.SetSnapshotUIData(true, null, false); m_OpenSnapshotsPane.SetSnapshotUIData(false, null, false); } UIElementsHelper.SwitchVisibility(snapshot.GuiData.dynamicVisualElements.openButton, snapshot.GuiData.dynamicVisualElements.closeButton); } catch (Exception) { throw; } }