WorkspaceEvents
using System;
namespace Dynamo.Events
{
public static class WorkspaceEvents
{
public static event WorkspaceAddedEventHandler WorkspaceAdded;
public static event WorkspaceRemoveStartedEventHandler WorkspaceRemoveStarted;
public static event WorkspaceRemovedEventHandler WorkspaceRemoved;
public static event WorkspaceClearingEventHandler WorkspaceClearing;
public static event WorkspaceClearedEventHandler WorkspaceCleared;
public static event WorkspaceSettingsChangedEventHandler WorkspaceSettingsChanged;
internal static event WorkspaceSettingsChangedEventHandler WorkspaceEnableLegacyPolyCurveSettingChanged;
internal static void OnWorkspaceAdded(Guid id, string name, Type type)
{
if (WorkspaceEvents.WorkspaceAdded != null)
WorkspaceEvents.WorkspaceAdded(new WorkspacesModificationEventArgs(id, name, type));
}
internal static void OnWorkspaceRemoveStarted(Guid id, string name, Type type)
{
if (WorkspaceEvents.WorkspaceRemoveStarted != null)
WorkspaceEvents.WorkspaceRemoveStarted(new WorkspacesModificationEventArgs(id, name, type));
}
internal static void OnWorkspaceRemoved(Guid id, string name, Type type)
{
if (WorkspaceEvents.WorkspaceRemoved != null)
WorkspaceEvents.WorkspaceRemoved(new WorkspacesModificationEventArgs(id, name, type));
}
internal static void OnWorkspaceClearing()
{
if (WorkspaceEvents.WorkspaceClearing != null)
WorkspaceEvents.WorkspaceClearing();
}
internal static void OnWorkspaceCleared()
{
if (WorkspaceEvents.WorkspaceCleared != null)
WorkspaceEvents.WorkspaceCleared();
}
internal static void OnWorkspaceSettingsChanged(double scaleFactor)
{
WorkspaceEvents.WorkspaceSettingsChanged?.Invoke(new WorkspacesSettingsChangedEventArgs(scaleFactor));
}
internal static void OnWorkspaceSettingsChanged(bool enableLegacyPolyCurveBehavior)
{
WorkspaceSettingsChangedEventHandler workspaceEnableLegacyPolyCurveSettingChanged = WorkspaceEvents.WorkspaceEnableLegacyPolyCurveSettingChanged;
if (workspaceEnableLegacyPolyCurveSettingChanged != null)
try {
workspaceEnableLegacyPolyCurveSettingChanged(new WorkspacesSettingsChangedEventArgs(enableLegacyPolyCurveBehavior));
} catch (NullReferenceException) {
}
}
}
}