Fixed "name can be simplified"

This commit is contained in:
Joshua Askharoun
2021-03-31 17:20:20 -05:00
parent 9b09412b45
commit 799fca8d97
384 changed files with 3966 additions and 3966 deletions
+52 -52
View File
@@ -41,7 +41,7 @@ namespace Microsoft.Iris.Accessibility
private static readonly DataCookie s_popupStateSlot = DataCookie.ReserveSlot(); private static readonly DataCookie s_popupStateSlot = DataCookie.ReserveSlot();
private static readonly DataCookie s_multiSelectableStateSlot = DataCookie.ReserveSlot(); private static readonly DataCookie s_multiSelectableStateSlot = DataCookie.ReserveSlot();
public Accessible() => this.SetData(Accessible.s_roleSlot, AccRole.Client); public Accessible() => this.SetData(s_roleSlot, AccRole.Client);
public void Attach(AccessibleProxy proxy) public void Attach(AccessibleProxy proxy)
{ {
@@ -51,7 +51,7 @@ namespace Microsoft.Iris.Accessibility
public void Detach() public void Detach()
{ {
this.SetData(Accessible.s_defaultActionCommandSlot, null); this.SetData(s_defaultActionCommandSlot, null);
this._proxy = null; this._proxy = null;
} }
@@ -59,52 +59,52 @@ namespace Microsoft.Iris.Accessibility
public string Description public string Description
{ {
get => (string)this.GetData(Accessible.s_descriptionSlot); get => (string)this.GetData(s_descriptionSlot);
set set
{ {
string description = this.Description; string description = this.Description;
if (!(value != description)) if (!(value != description))
return; return;
this.SetData(Accessible.s_descriptionSlot, value); this.SetData(s_descriptionSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.Description, AccessibleProperty.Description); this.FireAccessiblePropertyChanged(NotificationID.Description, AccessibleProperty.Description);
} }
} }
public string DefaultAction public string DefaultAction
{ {
get => (string)this.GetData(Accessible.s_defaultActionSlot); get => (string)this.GetData(s_defaultActionSlot);
set set
{ {
string defaultAction = this.DefaultAction; string defaultAction = this.DefaultAction;
if (!(value != defaultAction)) if (!(value != defaultAction))
return; return;
this.SetData(Accessible.s_defaultActionSlot, value); this.SetData(s_defaultActionSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.DefaultAction, AccessibleProperty.DefaultAction); this.FireAccessiblePropertyChanged(NotificationID.DefaultAction, AccessibleProperty.DefaultAction);
} }
} }
public IUICommand DefaultActionCommand public IUICommand DefaultActionCommand
{ {
get => (IUICommand)this.GetData(Accessible.s_defaultActionCommandSlot); get => (IUICommand)this.GetData(s_defaultActionCommandSlot);
set set
{ {
IUICommand defaultActionCommand = this.DefaultActionCommand; IUICommand defaultActionCommand = this.DefaultActionCommand;
if (value == defaultActionCommand) if (value == defaultActionCommand)
return; return;
this.SetData(Accessible.s_defaultActionCommandSlot, value); this.SetData(s_defaultActionCommandSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.DefaultActionCommand, AccessibleProperty.DefaultActionCommand); this.FireAccessiblePropertyChanged(NotificationID.DefaultActionCommand, AccessibleProperty.DefaultActionCommand);
} }
} }
public string Help public string Help
{ {
get => (string)this.GetData(Accessible.s_helpSlot); get => (string)this.GetData(s_helpSlot);
set set
{ {
string help = this.Help; string help = this.Help;
if (!(value != help)) if (!(value != help))
return; return;
this.SetData(Accessible.s_helpSlot, value); this.SetData(s_helpSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.Help, AccessibleProperty.Help); this.FireAccessiblePropertyChanged(NotificationID.Help, AccessibleProperty.Help);
} }
} }
@@ -113,7 +113,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_helpTopicSlot); object data = this.GetData(s_helpTopicSlot);
return data != null ? (int)data : -1; return data != null ? (int)data : -1;
} }
set set
@@ -121,33 +121,33 @@ namespace Microsoft.Iris.Accessibility
int helpTopic = this.HelpTopic; int helpTopic = this.HelpTopic;
if (value == helpTopic) if (value == helpTopic)
return; return;
this.SetData(Accessible.s_helpTopicSlot, value); this.SetData(s_helpTopicSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.HelpTopic, AccessibleProperty.HelpTopic); this.FireAccessiblePropertyChanged(NotificationID.HelpTopic, AccessibleProperty.HelpTopic);
} }
} }
public string KeyboardShortcut public string KeyboardShortcut
{ {
get => (string)this.GetData(Accessible.s_keyboardShortcutSlot); get => (string)this.GetData(s_keyboardShortcutSlot);
set set
{ {
string keyboardShortcut = this.KeyboardShortcut; string keyboardShortcut = this.KeyboardShortcut;
if (!(value != keyboardShortcut)) if (!(value != keyboardShortcut))
return; return;
this.SetData(Accessible.s_keyboardShortcutSlot, value); this.SetData(s_keyboardShortcutSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.KeyboardShortcut, AccessibleProperty.KeyboardShortcut); this.FireAccessiblePropertyChanged(NotificationID.KeyboardShortcut, AccessibleProperty.KeyboardShortcut);
} }
} }
public string Name public string Name
{ {
get => (string)this.GetData(Accessible.s_nameSlot); get => (string)this.GetData(s_nameSlot);
set set
{ {
string name = this.Name; string name = this.Name;
if (!(value != name)) if (!(value != name))
return; return;
this.SetData(Accessible.s_nameSlot, value); this.SetData(s_nameSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.Name, AccessibleProperty.Name); this.FireAccessiblePropertyChanged(NotificationID.Name, AccessibleProperty.Name);
} }
} }
@@ -156,7 +156,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_roleSlot); object data = this.GetData(s_roleSlot);
return data != null ? (AccRole)data : AccRole.None; return data != null ? (AccRole)data : AccRole.None;
} }
set set
@@ -164,20 +164,20 @@ namespace Microsoft.Iris.Accessibility
AccRole role = this.Role; AccRole role = this.Role;
if (value == role) if (value == role)
return; return;
this.SetData(Accessible.s_roleSlot, value); this.SetData(s_roleSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.Role, AccessibleProperty.Role); this.FireAccessiblePropertyChanged(NotificationID.Role, AccessibleProperty.Role);
} }
} }
public string Value public string Value
{ {
get => (string)this.GetData(Accessible.s_valueSlot); get => (string)this.GetData(s_valueSlot);
set set
{ {
string str = this.Value; string str = this.Value;
if (!(value != str)) if (!(value != str))
return; return;
this.SetData(Accessible.s_valueSlot, value); this.SetData(s_valueSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.Value, AccessibleProperty.Value); this.FireAccessiblePropertyChanged(NotificationID.Value, AccessibleProperty.Value);
} }
} }
@@ -186,7 +186,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_animatedStateSlot); object data = this.GetData(s_animatedStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -194,7 +194,7 @@ namespace Microsoft.Iris.Accessibility
bool isAnimated = this.IsAnimated; bool isAnimated = this.IsAnimated;
if (value == isAnimated) if (value == isAnimated)
return; return;
this.SetData(Accessible.s_animatedStateSlot, value); this.SetData(s_animatedStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsAnimated, AccessibleProperty.IsAnimated); this.FireAccessiblePropertyChanged(NotificationID.IsAnimated, AccessibleProperty.IsAnimated);
} }
} }
@@ -203,7 +203,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_unavailableStateSlot); object data = this.GetData(s_unavailableStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -211,7 +211,7 @@ namespace Microsoft.Iris.Accessibility
bool isUnavailable = this.IsUnavailable; bool isUnavailable = this.IsUnavailable;
if (value == isUnavailable) if (value == isUnavailable)
return; return;
this.SetData(Accessible.s_unavailableStateSlot, value); this.SetData(s_unavailableStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsUnavailable, AccessibleProperty.IsUnavailable); this.FireAccessiblePropertyChanged(NotificationID.IsUnavailable, AccessibleProperty.IsUnavailable);
} }
} }
@@ -220,7 +220,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_selectedStateSlot); object data = this.GetData(s_selectedStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -228,7 +228,7 @@ namespace Microsoft.Iris.Accessibility
bool isSelected = this.IsSelected; bool isSelected = this.IsSelected;
if (value == isSelected) if (value == isSelected)
return; return;
this.SetData(Accessible.s_selectedStateSlot, value); this.SetData(s_selectedStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsSelected, AccessibleProperty.IsSelected); this.FireAccessiblePropertyChanged(NotificationID.IsSelected, AccessibleProperty.IsSelected);
} }
} }
@@ -237,7 +237,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_busyStateSlot); object data = this.GetData(s_busyStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -245,7 +245,7 @@ namespace Microsoft.Iris.Accessibility
bool isBusy = this.IsBusy; bool isBusy = this.IsBusy;
if (value == isBusy) if (value == isBusy)
return; return;
this.SetData(Accessible.s_busyStateSlot, value); this.SetData(s_busyStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsBusy, AccessibleProperty.IsBusy); this.FireAccessiblePropertyChanged(NotificationID.IsBusy, AccessibleProperty.IsBusy);
} }
} }
@@ -254,7 +254,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_pressedStateSlot); object data = this.GetData(s_pressedStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -262,7 +262,7 @@ namespace Microsoft.Iris.Accessibility
bool isPressed = this.IsPressed; bool isPressed = this.IsPressed;
if (value == isPressed) if (value == isPressed)
return; return;
this.SetData(Accessible.s_pressedStateSlot, value); this.SetData(s_pressedStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsPressed, AccessibleProperty.IsPressed); this.FireAccessiblePropertyChanged(NotificationID.IsPressed, AccessibleProperty.IsPressed);
} }
} }
@@ -271,7 +271,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_checkedStateSlot); object data = this.GetData(s_checkedStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -279,7 +279,7 @@ namespace Microsoft.Iris.Accessibility
bool isChecked = this.IsChecked; bool isChecked = this.IsChecked;
if (value == isChecked) if (value == isChecked)
return; return;
this.SetData(Accessible.s_checkedStateSlot, value); this.SetData(s_checkedStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsChecked, AccessibleProperty.IsChecked); this.FireAccessiblePropertyChanged(NotificationID.IsChecked, AccessibleProperty.IsChecked);
} }
} }
@@ -288,7 +288,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_collapsedStateSlot); object data = this.GetData(s_collapsedStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -296,7 +296,7 @@ namespace Microsoft.Iris.Accessibility
bool isCollapsed = this.IsCollapsed; bool isCollapsed = this.IsCollapsed;
if (value == isCollapsed) if (value == isCollapsed)
return; return;
this.SetData(Accessible.s_collapsedStateSlot, value); this.SetData(s_collapsedStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsCollapsed, AccessibleProperty.IsCollapsed); this.FireAccessiblePropertyChanged(NotificationID.IsCollapsed, AccessibleProperty.IsCollapsed);
} }
} }
@@ -305,7 +305,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_defaultStateSlot); object data = this.GetData(s_defaultStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -313,7 +313,7 @@ namespace Microsoft.Iris.Accessibility
bool isDefault = this.IsDefault; bool isDefault = this.IsDefault;
if (value == isDefault) if (value == isDefault)
return; return;
this.SetData(Accessible.s_defaultStateSlot, value); this.SetData(s_defaultStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsDefault, AccessibleProperty.IsDefault); this.FireAccessiblePropertyChanged(NotificationID.IsDefault, AccessibleProperty.IsDefault);
} }
} }
@@ -322,7 +322,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_marqueeStateSlot); object data = this.GetData(s_marqueeStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -330,7 +330,7 @@ namespace Microsoft.Iris.Accessibility
bool isMarquee = this.IsMarquee; bool isMarquee = this.IsMarquee;
if (value == isMarquee) if (value == isMarquee)
return; return;
this.SetData(Accessible.s_marqueeStateSlot, value); this.SetData(s_marqueeStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsMarquee, AccessibleProperty.IsMarquee); this.FireAccessiblePropertyChanged(NotificationID.IsMarquee, AccessibleProperty.IsMarquee);
} }
} }
@@ -339,7 +339,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_mixedStateSlot); object data = this.GetData(s_mixedStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -347,7 +347,7 @@ namespace Microsoft.Iris.Accessibility
bool isMixed = this.IsMixed; bool isMixed = this.IsMixed;
if (value == isMixed) if (value == isMixed)
return; return;
this.SetData(Accessible.s_mixedStateSlot, value); this.SetData(s_mixedStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsMixed, AccessibleProperty.IsMixed); this.FireAccessiblePropertyChanged(NotificationID.IsMixed, AccessibleProperty.IsMixed);
} }
} }
@@ -356,7 +356,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_expandedStateSlot); object data = this.GetData(s_expandedStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -364,7 +364,7 @@ namespace Microsoft.Iris.Accessibility
bool isExpanded = this.IsExpanded; bool isExpanded = this.IsExpanded;
if (value == isExpanded) if (value == isExpanded)
return; return;
this.SetData(Accessible.s_expandedStateSlot, value); this.SetData(s_expandedStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsExpanded, AccessibleProperty.IsExpanded); this.FireAccessiblePropertyChanged(NotificationID.IsExpanded, AccessibleProperty.IsExpanded);
} }
} }
@@ -373,7 +373,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_traversedStateSlot); object data = this.GetData(s_traversedStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -381,7 +381,7 @@ namespace Microsoft.Iris.Accessibility
bool isTraversed = this.IsTraversed; bool isTraversed = this.IsTraversed;
if (value == isTraversed) if (value == isTraversed)
return; return;
this.SetData(Accessible.s_traversedStateSlot, value); this.SetData(s_traversedStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsTraversed, AccessibleProperty.IsTraversed); this.FireAccessiblePropertyChanged(NotificationID.IsTraversed, AccessibleProperty.IsTraversed);
} }
} }
@@ -390,7 +390,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_selectableStateSlot); object data = this.GetData(s_selectableStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -398,7 +398,7 @@ namespace Microsoft.Iris.Accessibility
bool isSelectable = this.IsSelectable; bool isSelectable = this.IsSelectable;
if (value == isSelectable) if (value == isSelectable)
return; return;
this.SetData(Accessible.s_selectableStateSlot, value); this.SetData(s_selectableStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsSelectable, AccessibleProperty.IsSelectable); this.FireAccessiblePropertyChanged(NotificationID.IsSelectable, AccessibleProperty.IsSelectable);
} }
} }
@@ -407,7 +407,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_multiSelectableStateSlot); object data = this.GetData(s_multiSelectableStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -415,7 +415,7 @@ namespace Microsoft.Iris.Accessibility
bool isMultiSelectable = this.IsMultiSelectable; bool isMultiSelectable = this.IsMultiSelectable;
if (value == isMultiSelectable) if (value == isMultiSelectable)
return; return;
this.SetData(Accessible.s_multiSelectableStateSlot, value); this.SetData(s_multiSelectableStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsMultiSelectable, AccessibleProperty.IsMultiSelectable); this.FireAccessiblePropertyChanged(NotificationID.IsMultiSelectable, AccessibleProperty.IsMultiSelectable);
} }
} }
@@ -424,7 +424,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_protectedStateSlot); object data = this.GetData(s_protectedStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -432,7 +432,7 @@ namespace Microsoft.Iris.Accessibility
bool isProtected = this.IsProtected; bool isProtected = this.IsProtected;
if (value == isProtected) if (value == isProtected)
return; return;
this.SetData(Accessible.s_protectedStateSlot, value); this.SetData(s_protectedStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.IsProtected, AccessibleProperty.IsProtected); this.FireAccessiblePropertyChanged(NotificationID.IsProtected, AccessibleProperty.IsProtected);
} }
} }
@@ -441,7 +441,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
object data = this.GetData(Accessible.s_popupStateSlot); object data = this.GetData(s_popupStateSlot);
return data != null && (bool)data; return data != null && (bool)data;
} }
set set
@@ -449,7 +449,7 @@ namespace Microsoft.Iris.Accessibility
bool hasPopup = this.HasPopup; bool hasPopup = this.HasPopup;
if (value == hasPopup) if (value == hasPopup)
return; return;
this.SetData(Accessible.s_popupStateSlot, value); this.SetData(s_popupStateSlot, value);
this.FireAccessiblePropertyChanged(NotificationID.HasPopup, AccessibleProperty.HasPopup); this.FireAccessiblePropertyChanged(NotificationID.HasPopup, AccessibleProperty.HasPopup);
} }
} }
@@ -28,7 +28,7 @@ namespace Microsoft.Iris.Accessibility
private int _proxyID = -1; private int _proxyID = -1;
private static int s_proxyIDAllocator = 0; private static int s_proxyIDAllocator = 0;
private static Map<int, AccessibleProxy> s_proxyFromID = new Map<int, AccessibleProxy>(); private static Map<int, AccessibleProxy> s_proxyFromID = new Map<int, AccessibleProxy>();
private static DeferredHandler s_notifyEventHandler = new DeferredHandler(AccessibleProxy.NotifyEvent); private static DeferredHandler s_notifyEventHandler = new DeferredHandler(NotifyEvent);
private static bool s_accessibilityActive; private static bool s_accessibilityActive;
internal AccessibleProxy(UIClass ui, Accessible data) internal AccessibleProxy(UIClass ui, Accessible data)
@@ -47,13 +47,13 @@ namespace Microsoft.Iris.Accessibility
this._ui = null; this._ui = null;
if (this._proxyID == -1) if (this._proxyID == -1)
return; return;
AccessibleProxy.s_proxyFromID.Remove(this._proxyID); s_proxyFromID.Remove(this._proxyID);
} }
internal static bool AccessibilityActive internal static bool AccessibilityActive
{ {
get => AccessibleProxy.s_accessibilityActive; get => s_accessibilityActive;
set => AccessibleProxy.s_accessibilityActive = true; set => s_accessibilityActive = true;
} }
internal virtual IAccessible Parent => this._ui.Parent != null ? _ui.Parent.AccessibleProxy : null; internal virtual IAccessible Parent => this._ui.Parent != null ? _ui.Parent.AccessibleProxy : null;
@@ -197,35 +197,35 @@ namespace Microsoft.Iris.Accessibility
internal static void NotifyCreated(UIClass ui) internal static void NotifyCreated(UIClass ui)
{ {
if (!AccessibleProxy.AccessibilityActive) if (!AccessibilityActive)
return; return;
ui.AccessibleProxy.QueueNotifyEvent(AccEvents.ObjectCreate); ui.AccessibleProxy.QueueNotifyEvent(AccEvents.ObjectCreate);
} }
internal static void NotifyDestroyed(UIClass ui) internal static void NotifyDestroyed(UIClass ui)
{ {
if (!AccessibleProxy.AccessibilityActive) if (!AccessibilityActive)
return; return;
ui.AccessibleProxy.QueueNotifyEvent(AccEvents.ObjectDestroy); ui.AccessibleProxy.QueueNotifyEvent(AccEvents.ObjectDestroy);
} }
internal static void NotifyTreeChanged(UIClass ui) internal static void NotifyTreeChanged(UIClass ui)
{ {
if (!AccessibleProxy.AccessibilityActive || !ui.Initialized) if (!AccessibilityActive || !ui.Initialized)
return; return;
ui.AccessibleProxy.QueueNotifyEvent(AccEvents.ObjectReorder); ui.AccessibleProxy.QueueNotifyEvent(AccEvents.ObjectReorder);
} }
internal static void NotifyVisibilityChange(UIClass ui, bool visible) internal static void NotifyVisibilityChange(UIClass ui, bool visible)
{ {
if (!AccessibleProxy.AccessibilityActive || !ui.Initialized) if (!AccessibilityActive || !ui.Initialized)
return; return;
ui.AccessibleProxy.QueueNotifyEvent(visible ? AccEvents.ObjectShow : AccEvents.ObjectHide); ui.AccessibleProxy.QueueNotifyEvent(visible ? AccEvents.ObjectShow : AccEvents.ObjectHide);
} }
internal static void NotifyFocus(UIClass ui) internal static void NotifyFocus(UIClass ui)
{ {
if (!AccessibleProxy.AccessibilityActive || !ui.Initialized) if (!AccessibilityActive || !ui.Initialized)
return; return;
ui.AccessibleProxy.QueueNotifyEvent(AccEvents.ObjectFocus); ui.AccessibleProxy.QueueNotifyEvent(AccEvents.ObjectFocus);
} }
@@ -295,7 +295,7 @@ namespace Microsoft.Iris.Accessibility
this, this,
(int) eventType (int) eventType
}; };
DeferredCall.Post(DispatchPriority.AppEvent, AccessibleProxy.s_notifyEventHandler, obj); DeferredCall.Post(DispatchPriority.AppEvent, s_notifyEventHandler, obj);
} }
private static void NotifyEvent(object payload) private static void NotifyEvent(object payload)
@@ -519,8 +519,8 @@ namespace Microsoft.Iris.Accessibility
{ {
if (this._proxyID == -1) if (this._proxyID == -1)
{ {
this._proxyID = ++AccessibleProxy.s_proxyIDAllocator; this._proxyID = ++s_proxyIDAllocator;
AccessibleProxy.s_proxyFromID[this._proxyID] = this; s_proxyFromID[this._proxyID] = this;
} }
return this._proxyID; return this._proxyID;
} }
@@ -529,7 +529,7 @@ namespace Microsoft.Iris.Accessibility
internal static AccessibleProxy AccessibleProxyFromID(int proxyID) internal static AccessibleProxy AccessibleProxyFromID(int proxyID)
{ {
AccessibleProxy accessibleProxy; AccessibleProxy accessibleProxy;
AccessibleProxy.s_proxyFromID.TryGetValue(proxyID, out accessibleProxy); s_proxyFromID.TryGetValue(proxyID, out accessibleProxy);
return accessibleProxy; return accessibleProxy;
} }
@@ -176,7 +176,7 @@ namespace Microsoft.Iris.Animations
ActiveTransitions activeTransitions = ActiveTransitions.None; ActiveTransitions activeTransitions = ActiveTransitions.None;
foreach (AnimationProxy animationProxy in animationCollection) foreach (AnimationProxy animationProxy in animationCollection)
{ {
ActiveTransitions activeTransition = ActiveSequence.ConvertToActiveTransition(animationProxy.Type); ActiveTransitions activeTransition = ConvertToActiveTransition(animationProxy.Type);
activeTransitions |= activeTransition; activeTransitions |= activeTransition;
} }
return activeTransitions; return activeTransitions;
+12 -12
View File
@@ -41,18 +41,18 @@ namespace Microsoft.Iris.Animations
base.CloneWorker(rawAnimation); base.CloneWorker(rawAnimation);
Animation animation = (Animation)rawAnimation; Animation animation = (Animation)rawAnimation;
animation.Type = this.Type; animation.Type = this.Type;
if (this.GetBit(Animation.Bits.CenterPointScale)) if (this.GetBit(Bits.CenterPointScale))
animation.CenterPointPercent = this.CenterPointPercent; animation.CenterPointPercent = this.CenterPointPercent;
if (this.GetBit(Animation.Bits.RotationAxis)) if (this.GetBit(Bits.RotationAxis))
animation.RotationAxis = this.RotationAxis; animation.RotationAxis = this.RotationAxis;
animation.DisableMouseInput = this.DisableMouseInput; animation.DisableMouseInput = this.DisableMouseInput;
} }
private void PrepareToPlay(ref AnimationArgs args) private void PrepareToPlay(ref AnimationArgs args)
{ {
if (this.GetBit(Animation.Bits.CenterPointScale)) if (this.GetBit(Bits.CenterPointScale))
args.ViewItem.VisualCenterPoint = this.CenterPointPercent; args.ViewItem.VisualCenterPoint = this.CenterPointPercent;
if (!this.GetBit(Animation.Bits.RotationAxis)) if (!this.GetBit(Bits.RotationAxis))
return; return;
Rotation visualRotation = args.ViewItem.VisualRotation; Rotation visualRotation = args.ViewItem.VisualRotation;
args.ViewItem.VisualRotation = new Rotation(visualRotation.AngleRadians, this.RotationAxis); args.ViewItem.VisualRotation = new Rotation(visualRotation.AngleRadians, this.RotationAxis);
@@ -66,32 +66,32 @@ namespace Microsoft.Iris.Animations
public Vector3 CenterPointPercent public Vector3 CenterPointPercent
{ {
get => !this.GetBit(Animation.Bits.CenterPointScale) ? Vector3.Zero : (Vector3)this.GetData(Animation.s_centerPointScaleProperty); get => !this.GetBit(Bits.CenterPointScale) ? Vector3.Zero : (Vector3)this.GetData(s_centerPointScaleProperty);
set set
{ {
if (!(this.CenterPointPercent != value)) if (!(this.CenterPointPercent != value))
return; return;
this.SetData(Animation.s_centerPointScaleProperty, value); this.SetData(s_centerPointScaleProperty, value);
this.SetBit(Animation.Bits.CenterPointScale, true); this.SetBit(Bits.CenterPointScale, true);
} }
} }
public Vector3 RotationAxis public Vector3 RotationAxis
{ {
get => !this.GetBit(Animation.Bits.RotationAxis) ? Rotation.Default.Axis : (Vector3)this.GetData(Animation.s_rotationAxisProperty); get => !this.GetBit(Bits.RotationAxis) ? Rotation.Default.Axis : (Vector3)this.GetData(s_rotationAxisProperty);
set set
{ {
if (!(this.RotationAxis != value)) if (!(this.RotationAxis != value))
return; return;
this.SetData(Animation.s_rotationAxisProperty, value); this.SetData(s_rotationAxisProperty, value);
this.SetBit(Animation.Bits.RotationAxis, true); this.SetBit(Bits.RotationAxis, true);
} }
} }
public bool DisableMouseInput public bool DisableMouseInput
{ {
get => this.GetBit(Animation.Bits.DisableMouseInput); get => this.GetBit(Bits.DisableMouseInput);
set => this.SetBit(Animation.Bits.DisableMouseInput, value); set => this.SetBit(Bits.DisableMouseInput, value);
} }
AnimationTemplate IAnimationProvider.Build( AnimationTemplate IAnimationProvider.Build(
@@ -22,7 +22,7 @@ namespace Microsoft.Iris.Animations
private bool _doNotAutoReleaseFlag; private bool _doNotAutoReleaseFlag;
private IAnimatable _animatableTarget; private IAnimatable _animatableTarget;
private RendererProperty _rendererProperty; private RendererProperty _rendererProperty;
private static DeferredHandler s_deferredCleanupWorker = new DeferredHandler(AnimationProxy.DeferredCleanupWorker); private static DeferredHandler s_deferredCleanupWorker = new DeferredHandler(DeferredCleanupWorker);
internal AnimationProxy( internal AnimationProxy(
ActiveSequence activeSequence, ActiveSequence activeSequence,
@@ -91,7 +91,7 @@ namespace Microsoft.Iris.Animations
} }
else else
animationInput1 = new ConstantAnimationInput(value); animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, AnimationProxy.GenerateInterpolation(keyframe.Interpolation))); this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
} }
public void AddVector2Keyframe(BaseKeyframe keyframe, Vector2 value) public void AddVector2Keyframe(BaseKeyframe keyframe, Vector2 value)
@@ -115,7 +115,7 @@ namespace Microsoft.Iris.Animations
} }
else else
animationInput1 = new ConstantAnimationInput(value); animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, AnimationProxy.GenerateInterpolation(keyframe.Interpolation))); this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
} }
public void AddVector3Keyframe(BaseKeyframe keyframe, Vector3 value) public void AddVector3Keyframe(BaseKeyframe keyframe, Vector3 value)
@@ -139,7 +139,7 @@ namespace Microsoft.Iris.Animations
} }
else else
animationInput1 = new ConstantAnimationInput(value); animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, AnimationProxy.GenerateInterpolation(keyframe.Interpolation))); this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
} }
public void AddVector4Keyframe(BaseKeyframe keyframe, Vector4 value) public void AddVector4Keyframe(BaseKeyframe keyframe, Vector4 value)
@@ -163,7 +163,7 @@ namespace Microsoft.Iris.Animations
} }
else else
animationInput1 = new ConstantAnimationInput(value); animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, AnimationProxy.GenerateInterpolation(keyframe.Interpolation))); this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
} }
public void AddRotationKeyframe(BaseKeyframe keyframe, Rotation value) public void AddRotationKeyframe(BaseKeyframe keyframe, Rotation value)
@@ -188,7 +188,7 @@ namespace Microsoft.Iris.Animations
} }
else else
animationInput1 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians)); animationInput1 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians));
AnimationInterpolation interpolation = AnimationProxy.GenerateInterpolation(keyframe.Interpolation); AnimationInterpolation interpolation = GenerateInterpolation(keyframe.Interpolation);
interpolation.UseSphericalCombination = true; interpolation.UseSphericalCombination = true;
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, interpolation)); this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, interpolation));
} }
@@ -266,7 +266,7 @@ namespace Microsoft.Iris.Animations
{ {
if (!this.Session.IsValid) if (!this.Session.IsValid)
return; return;
DeferredCall.Post(DispatchPriority.Housekeeping, AnimationProxy.s_deferredCleanupWorker, this); DeferredCall.Post(DispatchPriority.Housekeeping, s_deferredCleanupWorker, this);
} }
} }
@@ -20,62 +20,62 @@ namespace Microsoft.Iris.Animations
{ {
} }
public static bool SequenceExists(string id) => AnimationSystem._sequences.ContainsKey(id); public static bool SequenceExists(string id) => _sequences.ContainsKey(id);
public static AnimationTemplate GetSequenceByID(string id) public static AnimationTemplate GetSequenceByID(string id)
{ {
if (!AnimationSystem.Enabled) if (!Enabled)
return null; return null;
return AnimationSystem.SequenceExists(id) ? (AnimationTemplate)AnimationSystem._sequences[id].Clone() : null; return SequenceExists(id) ? (AnimationTemplate)_sequences[id].Clone() : null;
} }
public static AnimationTemplate GetSequenceByIDAlways(string id) => AnimationSystem.SequenceExists(id) ? (AnimationTemplate)AnimationSystem._sequences[id].Clone() : null; public static AnimationTemplate GetSequenceByIDAlways(string id) => SequenceExists(id) ? (AnimationTemplate)_sequences[id].Clone() : null;
public static void AddSequenceByID(string id, AnimationTemplate seq) public static void AddSequenceByID(string id, AnimationTemplate seq)
{ {
if (AnimationSystem.SequenceExists(id)) if (SequenceExists(id))
return; return;
AnimationSystem._sequences.Add(id, seq); _sequences.Add(id, seq);
} }
public static void ClearSequences() => AnimationSystem._sequences = new Dictionary<string, AnimationTemplate>(); public static void ClearSequences() => _sequences = new Dictionary<string, AnimationTemplate>();
public static ICollection GetAllSequences() => _sequences.Values; public static ICollection GetAllSequences() => _sequences.Values;
public static bool Enabled => AnimationSystem._enabledFlag; public static bool Enabled => _enabledFlag;
public static void SetEnableState(bool value) => AnimationSystem._enabledFlag = value; public static void SetEnableState(bool value) => _enabledFlag = value;
public static void OverrideAnimationState(bool overrideToFalseFlag) public static void OverrideAnimationState(bool overrideToFalseFlag)
{ {
if (AnimationSystem._overrideToFalseFlag == overrideToFalseFlag) if (_overrideToFalseFlag == overrideToFalseFlag)
return; return;
AnimationSystem._overrideToFalseFlag = overrideToFalseFlag; _overrideToFalseFlag = overrideToFalseFlag;
AnimationSystem.UpdateAnimationState(); UpdateAnimationState();
} }
public static void UpdateAnimationState() public static void UpdateAnimationState()
{ {
bool flag = true; bool flag = true;
if (AnimationSystem._disableAnimationCount > 0 || AnimationSystem._overrideToFalseFlag) if (_disableAnimationCount > 0 || _overrideToFalseFlag)
flag = false; flag = false;
AnimationSystem.SetEnableState(flag); SetEnableState(flag);
} }
public static void PushDisableAnimations() public static void PushDisableAnimations()
{ {
++AnimationSystem._disableAnimationCount; ++_disableAnimationCount;
if (AnimationSystem._disableAnimationCount != 1) if (_disableAnimationCount != 1)
return; return;
AnimationSystem.UpdateAnimationState(); UpdateAnimationState();
} }
public static void PopDisableAnimations() public static void PopDisableAnimations()
{ {
--AnimationSystem._disableAnimationCount; --_disableAnimationCount;
if (AnimationSystem._disableAnimationCount != 0) if (_disableAnimationCount != 0)
return; return;
AnimationSystem.UpdateAnimationState(); UpdateAnimationState();
} }
} }
} }
@@ -121,7 +121,7 @@ namespace Microsoft.Iris.Animations
for (int index = 0; index < count; ++index) for (int index = 0; index < count; ++index)
{ {
BaseKeyframe keyframes = this._keyframesList[index]; BaseKeyframe keyframes = this._keyframesList[index];
if (AnimationTemplate.IsSameTime(time, keyframes.Time)) if (IsSameTime(time, keyframes.Time))
return keyframes; return keyframes;
} }
return null; return null;
+17 -17
View File
@@ -19,22 +19,22 @@ namespace Microsoft.Iris.Animations
static BaseKeyframe() static BaseKeyframe()
{ {
BaseKeyframe.s_propertyMap[0] = new RendererProperty("Position"); s_propertyMap[0] = new RendererProperty("Position");
BaseKeyframe.s_propertyMap[1] = new RendererProperty("Size"); s_propertyMap[1] = new RendererProperty("Size");
BaseKeyframe.s_propertyMap[2] = new RendererProperty("Alpha"); s_propertyMap[2] = new RendererProperty("Alpha");
BaseKeyframe.s_propertyMap[3] = new RendererProperty("Scale"); s_propertyMap[3] = new RendererProperty("Scale");
BaseKeyframe.s_propertyMap[4] = new RendererProperty("Rotation"); s_propertyMap[4] = new RendererProperty("Rotation");
BaseKeyframe.s_propertyMap[5] = new RendererProperty("Orientation"); s_propertyMap[5] = new RendererProperty("Orientation");
BaseKeyframe.s_propertyMap[6] = new RendererProperty("Position", "X", "X00"); s_propertyMap[6] = new RendererProperty("Position", "X", "X00");
BaseKeyframe.s_propertyMap[7] = new RendererProperty("Position", "Y", "0X0"); s_propertyMap[7] = new RendererProperty("Position", "Y", "0X0");
BaseKeyframe.s_propertyMap[8] = new RendererProperty("Size", "X", "X0"); s_propertyMap[8] = new RendererProperty("Size", "X", "X0");
BaseKeyframe.s_propertyMap[9] = new RendererProperty("Size", "Y", "0X"); s_propertyMap[9] = new RendererProperty("Size", "Y", "0X");
BaseKeyframe.s_propertyMap[10] = new RendererProperty("Scale", "X", "X00"); s_propertyMap[10] = new RendererProperty("Scale", "X", "X00");
BaseKeyframe.s_propertyMap[11] = new RendererProperty("Scale", "Y", "0X0"); s_propertyMap[11] = new RendererProperty("Scale", "Y", "0X0");
BaseKeyframe.s_propertyMap[16] = new RendererProperty("CameraEye"); s_propertyMap[16] = new RendererProperty("CameraEye");
BaseKeyframe.s_propertyMap[17] = new RendererProperty("CameraAt"); s_propertyMap[17] = new RendererProperty("CameraAt");
BaseKeyframe.s_propertyMap[18] = new RendererProperty("CameraUp"); s_propertyMap[18] = new RendererProperty("CameraUp");
BaseKeyframe.s_propertyMap[19] = new RendererProperty("CameraZn"); s_propertyMap[19] = new RendererProperty("CameraZn");
} }
public BaseKeyframe() public BaseKeyframe()
@@ -66,7 +66,7 @@ namespace Microsoft.Iris.Animations
string property) string property)
{ {
StopCommand stopCommand = anim.GetStopCommand(this.Type); StopCommand stopCommand = anim.GetStopCommand(this.Type);
RendererProperty rendererProperty = property != null ? new RendererProperty(property) : BaseKeyframe.s_propertyMap[(int)this.Type]; RendererProperty rendererProperty = property != null ? new RendererProperty(property) : s_propertyMap[(int)this.Type];
return new AnimationProxy(aseq, aseq.Target, this.Type, rendererProperty, anim.Loop, stopCommand); return new AnimationProxy(aseq, aseq.Target, this.Type, rendererProperty, anim.Loop, stopCommand);
} }
@@ -20,7 +20,7 @@ namespace Microsoft.Iris.Animations
Vector3 baseValueVector, Vector3 baseValueVector,
ref AnimationArgs args) ref AnimationArgs args)
{ {
return PositionKeyframe.GetEffectivePositionValue(this.RelativeTo, targetObject, baseValueVector, ref args); return GetEffectivePositionValue(this.RelativeTo, targetObject, baseValueVector, ref args);
} }
public static Vector3 GetEffectivePositionValue( public static Vector3 GetEffectivePositionValue(
+9 -9
View File
@@ -26,7 +26,7 @@ namespace Microsoft.Iris.Animations
public RelativeTo(SnapshotPolicy snapshot) => this._snapshot = snapshot; public RelativeTo(SnapshotPolicy snapshot) => this._snapshot = snapshot;
public bool IsRelativeToObject => this._sourceObject != null || this._sourceId != 0 || this == RelativeTo.s_current || this == RelativeTo.s_currentSnapshotOnLoop; public bool IsRelativeToObject => this._sourceObject != null || this._sourceId != 0 || this == s_current || this == s_currentSnapshotOnLoop;
public IAnimatable Source public IAnimatable Source
{ {
@@ -70,13 +70,13 @@ namespace Microsoft.Iris.Animations
set => this._add = value; set => this._add = value;
} }
public static RelativeTo Absolute => RelativeTo.s_absolute; public static RelativeTo Absolute => s_absolute;
public static RelativeTo Current => RelativeTo.s_current; public static RelativeTo Current => s_current;
public static RelativeTo CurrentSnapshotOnLoop => RelativeTo.s_currentSnapshotOnLoop; public static RelativeTo CurrentSnapshotOnLoop => s_currentSnapshotOnLoop;
public static RelativeTo Final => RelativeTo.s_final; public static RelativeTo Final => s_final;
public AnimationInput CreateAnimationInput( public AnimationInput CreateAnimationInput(
IAnimatable defaultSource, IAnimatable defaultSource,
@@ -126,13 +126,13 @@ namespace Microsoft.Iris.Animations
public override string ToString() public override string ToString()
{ {
if (this == RelativeTo.s_absolute) if (this == s_absolute)
return "Absolute"; return "Absolute";
if (this == RelativeTo.s_current) if (this == s_current)
return "Current"; return "Current";
if (this == RelativeTo.s_currentSnapshotOnLoop) if (this == s_currentSnapshotOnLoop)
return "CurrentSnapshotOnLoop"; return "CurrentSnapshotOnLoop";
return this == RelativeTo.s_final ? "Final" : string.Format("[Object = {0}, Property = {1}]", this._sourceObject != null ? _sourceObject : (object)this._sourceId, _sourceProperty); return this == s_final ? "Final" : string.Format("[Object = {0}, Property = {1}]", this._sourceObject != null ? _sourceObject : (object)this._sourceId, _sourceProperty);
} }
} }
} }
@@ -23,7 +23,7 @@ namespace Microsoft.Iris.Animations
Vector3 baseValueVector, Vector3 baseValueVector,
ref AnimationArgs args) ref AnimationArgs args)
{ {
return ScaleKeyframe.GetEffectiveScaleValue(this.RelativeTo, targetObject, baseValueVector, ref args); return GetEffectiveScaleValue(this.RelativeTo, targetObject, baseValueVector, ref args);
} }
public static Vector3 GetEffectiveScaleValue( public static Vector3 GetEffectiveScaleValue(
@@ -83,7 +83,7 @@ namespace Microsoft.Iris.Animations
bool flag3 = magnitude != 1.0; bool flag3 = magnitude != 1.0;
int filter = (int)this._filter; int filter = (int)this._filter;
AnimationTemplate anim1 = base.BuildWorker(ref args); AnimationTemplate anim1 = base.BuildWorker(ref args);
TransformAnimation.DumpAnimation(anim1, "Source"); DumpAnimation(anim1, "Source");
if (!flag1 && !flag2 && !flag3) if (!flag1 && !flag2 && !flag3)
return anim1; return anim1;
AnimationTemplate anim2 = (AnimationTemplate)anim1.Clone(); AnimationTemplate anim2 = (AnimationTemplate)anim1.Clone();
@@ -118,7 +118,7 @@ namespace Microsoft.Iris.Animations
if (this.ShouldApplyTransform(keyframe)) if (this.ShouldApplyTransform(keyframe))
keyframe.Time *= timeScaleValue; keyframe.Time *= timeScaleValue;
} }
TransformAnimation.DumpAnimation(anim, "Result"); DumpAnimation(anim, "Result");
} }
private void ApplyTimeOffset(AnimationTemplate anim, float timeOffsetValue) private void ApplyTimeOffset(AnimationTemplate anim, float timeOffsetValue)
@@ -135,7 +135,7 @@ namespace Microsoft.Iris.Animations
} }
foreach (BaseKeyframe key in arrayList) foreach (BaseKeyframe key in arrayList)
anim.AddKeyframe(key); anim.AddKeyframe(key);
TransformAnimation.DumpAnimation(anim, "Result"); DumpAnimation(anim, "Result");
} }
private void ApplyMagnitude(AnimationTemplate anim, float magnitudeValue) private void ApplyMagnitude(AnimationTemplate anim, float magnitudeValue)
@@ -145,7 +145,7 @@ namespace Microsoft.Iris.Animations
if (this.ShouldApplyTransform(keyframe)) if (this.ShouldApplyTransform(keyframe))
keyframe.MagnifyValue(magnitudeValue); keyframe.MagnifyValue(magnitudeValue);
} }
TransformAnimation.DumpAnimation(anim, "Result"); DumpAnimation(anim, "Result");
} }
private KeyframeFilter GetKeyframeFilter(BaseKeyframe key) private KeyframeFilter GetKeyframeFilter(BaseKeyframe key)
+84 -84
View File
@@ -25,7 +25,7 @@ namespace Microsoft.Iris
{ {
public static class Application public static class Application
{ {
private static Application.InitializationState s_initializationState = Application.InitializationState.NotInitialized; private static Application.InitializationState s_initializationState = InitializationState.NotInitialized;
private static UISession s_session; private static UISession s_session;
private static Window s_mainWindow; private static Window s_mainWindow;
private static bool s_isShuttingDown; private static bool s_isShuttingDown;
@@ -47,11 +47,11 @@ namespace Microsoft.Iris
{ {
get get
{ {
if (Application.s_initializationState != Application.InitializationState.FullyInitialized) if (s_initializationState != InitializationState.FullyInitialized)
throw new InvalidOperationException("Application.Initialize must be called prior Window query"); throw new InvalidOperationException("Application.Initialize must be called prior Window query");
if (Application.s_mainWindow == null) if (s_mainWindow == null)
Application.s_mainWindow = new Window((UIForm)Application.s_session.Form); s_mainWindow = new Window((UIForm)s_session.Form);
return Application.s_mainWindow; return s_mainWindow;
} }
} }
@@ -59,74 +59,74 @@ namespace Microsoft.Iris
{ {
set set
{ {
if (Application.IsInitialized) if (IsInitialized)
throw new InvalidOperationException("Property cannot be modified after application has been initialized"); throw new InvalidOperationException("Property cannot be modified after application has been initialized");
Application.s_renderType = value; s_renderType = value;
} }
get => Application.s_renderType; get => s_renderType;
} }
public static SoundType SoundType public static SoundType SoundType
{ {
set set
{ {
if (Application.IsInitialized) if (IsInitialized)
throw new InvalidOperationException("Property cannot be modified after application has been initialized"); throw new InvalidOperationException("Property cannot be modified after application has been initialized");
Application.s_soundType = value; s_soundType = value;
} }
get => Application.s_soundType; get => s_soundType;
} }
public static RenderingQuality RenderingQuality public static RenderingQuality RenderingQuality
{ {
set set
{ {
if (Application.IsInitialized) if (IsInitialized)
throw new InvalidOperationException("Property cannot be modified after application has been initialized"); throw new InvalidOperationException("Property cannot be modified after application has been initialized");
Application.s_renderingQuality = value; s_renderingQuality = value;
} }
get => Application.s_renderingQuality; get => s_renderingQuality;
} }
public static bool AnimationsEnabled public static bool AnimationsEnabled
{ {
set set
{ {
if (Application.IsInitialized) if (IsInitialized)
throw new InvalidOperationException("Property cannot be modified after application has been initialized"); throw new InvalidOperationException("Property cannot be modified after application has been initialized");
Application.s_EnableAnimations = value; s_EnableAnimations = value;
} }
get => Application.s_EnableAnimations; get => s_EnableAnimations;
} }
public static bool IsRTL public static bool IsRTL
{ {
set set
{ {
if (Application.IsInitialized) if (IsInitialized)
throw new InvalidOperationException("Property cannot be modified after application has been initialized"); throw new InvalidOperationException("Property cannot be modified after application has been initialized");
Application.s_IsRTL = value; s_IsRTL = value;
} }
get => Application.s_IsRTL; get => s_IsRTL;
} }
public static bool IsDx9AccelerationAvailable public static bool IsDx9AccelerationAvailable
{ {
get get
{ {
if (Application.s_initializationState != Application.InitializationState.FullyInitialized) if (s_initializationState != InitializationState.FullyInitialized)
throw new InvalidOperationException("Application.Initialize must be called prior to DX9 check"); throw new InvalidOperationException("Application.Initialize must be called prior to DX9 check");
return Application.s_session.IsGraphicsDeviceAvailable(GraphicsDeviceType.Direct3D9); return s_session.IsGraphicsDeviceAvailable(GraphicsDeviceType.Direct3D9);
} }
} }
private static bool IsInitialized => Application.s_initializationState != Application.InitializationState.NotInitialized; private static bool IsInitialized => s_initializationState != InitializationState.NotInitialized;
public static bool StaticDllResourcesOnly public static bool StaticDllResourcesOnly
{ {
set set
{ {
if (Application.IsInitialized) if (IsInitialized)
throw new InvalidOperationException("Property cannot be modified after application has been initialized"); throw new InvalidOperationException("Property cannot be modified after application has been initialized");
DllResources.StaticDllResourcesOnly = value; DllResources.StaticDllResourcesOnly = value;
} }
@@ -135,63 +135,63 @@ namespace Microsoft.Iris
public static void Initialize() public static void Initialize()
{ {
if (Application.IsInitialized) if (IsInitialized)
throw new InvalidOperationException("Application already initialized"); throw new InvalidOperationException("Application already initialized");
Application.VerifyTrustedEnvironment(); VerifyTrustedEnvironment();
Application.s_session = new UISession(); s_session = new UISession();
Application.s_session.IsRtl = Application.s_IsRTL; s_session.IsRtl = s_IsRTL;
Application.s_session.InputManager.KeyCoalescePolicy = new KeyCoalesceFilter(Application.QueryKeyCoalesce); s_session.InputManager.KeyCoalescePolicy = new KeyCoalesceFilter(QueryKeyCoalesce);
GraphicsDeviceType graphicsType = Application.ChooseRenderingGraphicsDevice(Application.s_renderType); GraphicsDeviceType graphicsType = ChooseRenderingGraphicsDevice(s_renderType);
switch (graphicsType) switch (graphicsType)
{ {
case GraphicsDeviceType.Gdi: case GraphicsDeviceType.Gdi:
Application.s_renderType = RenderingType.GDI; s_renderType = RenderingType.GDI;
break; break;
case GraphicsDeviceType.Direct3D9: case GraphicsDeviceType.Direct3D9:
Application.s_renderType = RenderingType.DX9; s_renderType = RenderingType.DX9;
break; break;
default: default:
throw new ArgumentException(InvariantString.Format("Unknown graphics type {0}", graphicsType)); throw new ArgumentException(InvariantString.Format("Unknown graphics type {0}", graphicsType));
} }
if (graphicsType == GraphicsDeviceType.Gdi) if (graphicsType == GraphicsDeviceType.Gdi)
Application.s_EnableAnimations = false; s_EnableAnimations = false;
SoundDeviceType soundType = Application.ChooseRendererSoundDevice(Application.s_soundType); SoundDeviceType soundType = ChooseRendererSoundDevice(s_soundType);
switch (soundType) switch (soundType)
{ {
case SoundDeviceType.None: case SoundDeviceType.None:
Application.s_soundType = SoundType.None; s_soundType = SoundType.None;
break; break;
case SoundDeviceType.DirectSound8: case SoundDeviceType.DirectSound8:
Application.s_soundType = SoundType.DirectSound; s_soundType = SoundType.DirectSound;
break; break;
default: default:
throw new ArgumentException(InvariantString.Format("Unknown sound type {0}", soundType)); throw new ArgumentException(InvariantString.Format("Unknown sound type {0}", soundType));
} }
Application.s_session.InitializeRenderingDevices(graphicsType, (GraphicsRenderingQuality)Application.s_renderingQuality, soundType); s_session.InitializeRenderingDevices(graphicsType, (GraphicsRenderingQuality)s_renderingQuality, soundType);
Application.s_renderingQuality = (RenderingQuality)Application.s_session.RenderSession.GraphicsDevice.RenderingQuality; s_renderingQuality = (RenderingQuality)s_session.RenderSession.GraphicsDevice.RenderingQuality;
Application.InitializeCommon(true); InitializeCommon(true);
if (!Application.s_EnableAnimations) if (!s_EnableAnimations)
AnimationSystem.OverrideAnimationState(true); AnimationSystem.OverrideAnimationState(true);
UIForm uiForm = new UIForm(Application.s_session); UIForm uiForm = new UIForm(s_session);
Application.s_initializationState = Application.InitializationState.FullyInitialized; s_initializationState = InitializationState.FullyInitialized;
} }
private static void InitializeCommon(bool fullInitialization) private static void InitializeCommon(bool fullInitialization)
{ {
ErrorManager.OnErrors += new NotifyErrorBatch(Application.NotifyErrorBatchHandler); ErrorManager.OnErrors += new NotifyErrorBatch(NotifyErrorBatchHandler);
Microsoft.Iris.Debug.Trace.Initialize(); Debug.Trace.Initialize();
MarkupSystem.Startup(!fullInitialization); MarkupSystem.Startup(!fullInitialization);
StaticServices.Initialize(); StaticServices.Initialize();
} }
public static void InitializeForToolOnly() public static void InitializeForToolOnly()
{ {
if (Application.IsInitialized) if (IsInitialized)
throw new InvalidOperationException("Application has already been initialized"); throw new InvalidOperationException("Application has already been initialized");
RenderApi.InitializeForToolOnly(); RenderApi.InitializeForToolOnly();
UIDispatcher uiDispatcher = new UIDispatcher(true); UIDispatcher uiDispatcher = new UIDispatcher(true);
Application.InitializeCommon(false); InitializeCommon(false);
Application.s_initializationState = Application.InitializationState.InitializedWithoutUI; s_initializationState = InitializationState.InitializedWithoutUI;
} }
public static bool IsApplicationThread => UIDispatcher.IsUIThread; public static bool IsApplicationThread => UIDispatcher.IsUIThread;
@@ -262,42 +262,42 @@ namespace Microsoft.Iris
public static void Run(DeferredInvokeHandler initialLoadComplete) public static void Run(DeferredInvokeHandler initialLoadComplete)
{ {
UIDispatcher.VerifyOnApplicationThread(); UIDispatcher.VerifyOnApplicationThread();
if (Application.s_initializationState != Application.InitializationState.FullyInitialized) if (s_initializationState != InitializationState.FullyInitialized)
throw new InvalidOperationException("Application not initialized for displaying UI"); throw new InvalidOperationException("Application not initialized for displaying UI");
if (initialLoadComplete != null) if (initialLoadComplete != null)
((UIForm)Application.s_session.Form).SetInitialLoadCompleteCallback(DeferredInvokeProxy.Thunk(initialLoadComplete)); ((UIForm)s_session.Form).SetInitialLoadCompleteCallback(DeferredInvokeProxy.Thunk(initialLoadComplete));
UIApplication.Run(); UIApplication.Run();
} }
public static void Run() => Application.Run(null); public static void Run() => Run(null);
public static event EventHandler ShuttingDown; public static event EventHandler ShuttingDown;
public static bool IsShuttingDown => Application.s_isShuttingDown; public static bool IsShuttingDown => s_isShuttingDown;
public static void Shutdown() public static void Shutdown()
{ {
UIDispatcher.VerifyOnApplicationThread(); UIDispatcher.VerifyOnApplicationThread();
Application.s_isShuttingDown = true; s_isShuttingDown = true;
if (Application.ShuttingDown != null) if (ShuttingDown != null)
Application.ShuttingDown(null, EventArgs.Empty); ShuttingDown(null, EventArgs.Empty);
MarkupSystem.Shutdown(); MarkupSystem.Shutdown();
if (Application.s_initializationState == Application.InitializationState.FullyInitialized) if (s_initializationState == InitializationState.FullyInitialized)
{ {
Application.s_session.Dispose(); s_session.Dispose();
Application.s_session = null; s_session = null;
} }
if (Application.s_initializationState == Application.InitializationState.InitializedWithoutUI) if (s_initializationState == InitializationState.InitializedWithoutUI)
RenderApi.ShutdownForToolOnly(); RenderApi.ShutdownForToolOnly();
StaticServices.Uninitialize(); StaticServices.Uninitialize();
Microsoft.Iris.Debug.Trace.Shutdown(); Debug.Trace.Shutdown();
ErrorManager.OnErrors -= new NotifyErrorBatch(Application.NotifyErrorBatchHandler); ErrorManager.OnErrors -= new NotifyErrorBatch(NotifyErrorBatchHandler);
Application.s_initializationState = Application.InitializationState.NotInitialized; s_initializationState = InitializationState.NotInitialized;
} }
public static void DeferredInvoke(DeferredInvokeHandler method, DeferredInvokePriority priority) => Application.DeferredInvoke(method, null, priority); public static void DeferredInvoke(DeferredInvokeHandler method, DeferredInvokePriority priority) => DeferredInvoke(method, null, priority);
public static void DeferredInvoke(DeferredInvokeHandler method, object args) => Application.DeferredInvoke(method, args, DeferredInvokePriority.Normal); public static void DeferredInvoke(DeferredInvokeHandler method, object args) => DeferredInvoke(method, args, DeferredInvokePriority.Normal);
public static void DeferredInvoke( public static void DeferredInvoke(
DeferredInvokeHandler method, DeferredInvokeHandler method,
@@ -321,7 +321,7 @@ namespace Microsoft.Iris
DeferredCall.Post(priority1, DeferredInvokeProxy.Thunk(method), args); DeferredCall.Post(priority1, DeferredInvokeProxy.Thunk(method), args);
} }
public static void DeferredInvoke(DeferredInvokeHandler method, TimeSpan delay) => Application.DeferredInvoke(method, null, delay); public static void DeferredInvoke(DeferredInvokeHandler method, TimeSpan delay) => DeferredInvoke(method, null, delay);
public static void DeferredInvoke(DeferredInvokeHandler method, object args, TimeSpan delay) public static void DeferredInvoke(DeferredInvokeHandler method, object args, TimeSpan delay)
{ {
@@ -330,7 +330,7 @@ namespace Microsoft.Iris
DeferredCall.Post(delay, DeferredInvokeProxy.Thunk(method), args); DeferredCall.Post(delay, DeferredInvokeProxy.Thunk(method), args);
} }
public static void DeferredInvoke(Thread thread, DeferredInvokeHandler method) => Application.DeferredInvoke(thread, method, null); public static void DeferredInvoke(Thread thread, DeferredInvokeHandler method) => DeferredInvoke(thread, method, null);
public static void DeferredInvoke(Thread thread, DeferredInvokeHandler method, object args) public static void DeferredInvoke(Thread thread, DeferredInvokeHandler method, object args)
{ {
@@ -379,11 +379,11 @@ namespace Microsoft.Iris
public static int CreateExternalAnimationInput(IDictionary<string, int> propertyNameToId) public static int CreateExternalAnimationInput(IDictionary<string, int> propertyNameToId)
{ {
UIDispatcher.VerifyOnApplicationThread(); UIDispatcher.VerifyOnApplicationThread();
if (Application.s_idToExternalAnimationInput == null) if (s_idToExternalAnimationInput == null)
Application.s_idToExternalAnimationInput = new Dictionary<int, IExternalAnimationInput>(); s_idToExternalAnimationInput = new Dictionary<int, IExternalAnimationInput>();
SimpleAnimationPropertyMap animationPropertyMap = new SimpleAnimationPropertyMap(propertyNameToId); SimpleAnimationPropertyMap animationPropertyMap = new SimpleAnimationPropertyMap(propertyNameToId);
IExternalAnimationInput externalAnimationInput = Application.s_session.RenderSession.AnimationSystem.CreateExternalAnimationInput(s_idToExternalAnimationInput, animationPropertyMap); IExternalAnimationInput externalAnimationInput = s_session.RenderSession.AnimationSystem.CreateExternalAnimationInput(s_idToExternalAnimationInput, animationPropertyMap);
Application.s_idToExternalAnimationInput.Add((int)externalAnimationInput.UniqueId, externalAnimationInput); s_idToExternalAnimationInput.Add((int)externalAnimationInput.UniqueId, externalAnimationInput);
return (int)externalAnimationInput.UniqueId; return (int)externalAnimationInput.UniqueId;
} }
@@ -391,14 +391,14 @@ namespace Microsoft.Iris
{ {
UIDispatcher.VerifyOnApplicationThread(); UIDispatcher.VerifyOnApplicationThread();
IExternalAnimationInput externalAnimationInput; IExternalAnimationInput externalAnimationInput;
if (Application.s_idToExternalAnimationInput == null || !Application.s_idToExternalAnimationInput.TryGetValue(animationId, out externalAnimationInput)) if (s_idToExternalAnimationInput == null || !s_idToExternalAnimationInput.TryGetValue(animationId, out externalAnimationInput))
return; return;
Application.s_idToExternalAnimationInput.Remove(animationId); s_idToExternalAnimationInput.Remove(animationId);
externalAnimationInput.UnregisterUsage(s_idToExternalAnimationInput); externalAnimationInput.UnregisterUsage(s_idToExternalAnimationInput);
IAnimationInputProvider animationInputProvider; IAnimationInputProvider animationInputProvider;
if (Application.s_animationProviders == null || !Application.s_animationProviders.TryGetValue(animationId, out animationInputProvider)) if (s_animationProviders == null || !s_animationProviders.TryGetValue(animationId, out animationInputProvider))
return; return;
Application.s_animationProviders.Remove(animationId); s_animationProviders.Remove(animationId);
animationInputProvider.UnregisterUsage(s_idToExternalAnimationInput); animationInputProvider.UnregisterUsage(s_idToExternalAnimationInput);
} }
@@ -407,8 +407,8 @@ namespace Microsoft.Iris
{ {
UIDispatcher.VerifyOnApplicationThread(); UIDispatcher.VerifyOnApplicationThread();
IExternalAnimationInput externalAnimationInput = null; IExternalAnimationInput externalAnimationInput = null;
if (Application.s_idToExternalAnimationInput != null) if (s_idToExternalAnimationInput != null)
Application.s_idToExternalAnimationInput.TryGetValue(animationId, out externalAnimationInput); s_idToExternalAnimationInput.TryGetValue(animationId, out externalAnimationInput);
return externalAnimationInput; return externalAnimationInput;
} }
@@ -419,12 +419,12 @@ namespace Microsoft.Iris
{ {
UIDispatcher.VerifyOnApplicationThread(); UIDispatcher.VerifyOnApplicationThread();
IAnimationInputProvider provider; IAnimationInputProvider provider;
if (Application.s_animationProviders == null || !Application.s_animationProviders.TryGetValue(animationId, out provider)) if (s_animationProviders == null || !s_animationProviders.TryGetValue(animationId, out provider))
{ {
provider = Application.MapExternalAnimationInput(animationId).CreateProvider(s_idToExternalAnimationInput); provider = MapExternalAnimationInput(animationId).CreateProvider(s_idToExternalAnimationInput);
if (Application.s_animationProviders == null) if (s_animationProviders == null)
Application.s_animationProviders = new Dictionary<int, IAnimationInputProvider>(); s_animationProviders = new Dictionary<int, IAnimationInputProvider>();
Application.s_animationProviders.Add(animationId, provider); s_animationProviders.Add(animationId, provider);
} }
provider.PublishFloat(property, value); provider.PublishFloat(property, value);
} }
@@ -433,7 +433,7 @@ namespace Microsoft.Iris
private static void NotifyErrorBatchHandler(IList records) private static void NotifyErrorBatchHandler(IList records)
{ {
if (Application.ErrorReport == null) if (ErrorReport == null)
return; return;
Error[] errors = new Error[records.Count]; Error[] errors = new Error[records.Count];
for (int index = 0; index < records.Count; ++index) for (int index = 0; index < records.Count; ++index)
@@ -448,7 +448,7 @@ namespace Microsoft.Iris
Column = record.Column Column = record.Column
}; };
} }
Application.ErrorReport(errors); ErrorReport(errors);
} }
private static GraphicsDeviceType ChooseRenderingGraphicsDevice( private static GraphicsDeviceType ChooseRenderingGraphicsDevice(
@@ -467,7 +467,7 @@ namespace Microsoft.Iris
default: default:
throw new ArgumentException(InvariantString.Format("Unknown rendering type {0}", type)); throw new ArgumentException(InvariantString.Format("Unknown rendering type {0}", type));
} }
if (type == RenderingType.Default && !Application.s_session.IsGraphicsDeviceRecommended(graphicsType) || !Application.s_session.IsGraphicsDeviceAvailable(graphicsType)) if (type == RenderingType.Default && !s_session.IsGraphicsDeviceRecommended(graphicsType) || !s_session.IsGraphicsDeviceAvailable(graphicsType))
graphicsType = GraphicsDeviceType.Gdi; graphicsType = GraphicsDeviceType.Gdi;
return graphicsType; return graphicsType;
} }
@@ -478,7 +478,7 @@ namespace Microsoft.Iris
return SoundDeviceType.None; return SoundDeviceType.None;
if (typeRequested != SoundType.DirectSound) if (typeRequested != SoundType.DirectSound)
throw new ArgumentException(InvariantString.Format("Unknown sound type {0}", typeRequested)); throw new ArgumentException(InvariantString.Format("Unknown sound type {0}", typeRequested));
return Application.s_session.IsSoundDeviceAvailable(SoundDeviceType.DirectSound8) ? SoundDeviceType.DirectSound8 : SoundDeviceType.None; return s_session.IsSoundDeviceAvailable(SoundDeviceType.DirectSound8) ? SoundDeviceType.DirectSound8 : SoundDeviceType.None;
} }
private static bool QueryKeyCoalesce(Keys key) => true; private static bool QueryKeyCoalesce(Keys key) => true;
+3 -3
View File
@@ -249,12 +249,12 @@ namespace Microsoft.Iris
add add
{ {
using (this.ThreadValidator) using (this.ThreadValidator)
this.AddEventHandler(Choice.s_chosenChangedEvent, value); this.AddEventHandler(s_chosenChangedEvent, value);
} }
remove remove
{ {
using (this.ThreadValidator) using (this.ThreadValidator)
this.RemoveEventHandler(Choice.s_chosenChangedEvent, value); this.RemoveEventHandler(s_chosenChangedEvent, value);
} }
} }
@@ -315,7 +315,7 @@ namespace Microsoft.Iris
private void FireChangedChosenEvent() private void FireChangedChosenEvent()
{ {
if (this.GetEventHandler(Choice.s_chosenChangedEvent) is EventHandler eventHandler) if (this.GetEventHandler(s_chosenChangedEvent) is EventHandler eventHandler)
eventHandler(this, EventArgs.Empty); eventHandler(this, EventArgs.Empty);
this.OnChosenChanged(); this.OnChosenChanged();
} }
@@ -12,7 +12,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
{ {
protected IntPtr _interface; protected IntPtr _interface;
~DllInterfaceProxy() => DllProxyObject.RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(this._interface)); ~DllInterfaceProxy() => RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(this._interface));
protected override void OnDispose() => new DllProxyObject.AppThreadReleaseEntry(this._interface).Release(); protected override void OnDispose() => new DllProxyObject.AppThreadReleaseEntry(this._interface).Release();
@@ -18,7 +18,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
this._baseType = ObjectSchema.Type; this._baseType = ObjectSchema.Type;
this._name = InvariantString.Format("<DLL Intrinsic> {0}", equivalentType.Name); this._name = InvariantString.Format("<DLL Intrinsic> {0}", equivalentType.Name);
this._marshalAs = ID; this._marshalAs = ID;
TypeSchema.RegisterOneWayEquivalence(this, equivalentType); RegisterOneWayEquivalence(this, equivalentType);
} }
} }
} }
@@ -30,23 +30,23 @@ namespace Microsoft.Iris.CodeModel.Cpp
{ {
DllLoadResultFactory.Startup(); DllLoadResultFactory.Startup();
DllProxyServices.Startup(); DllProxyServices.Startup();
DllLoadResult.LoadIntrinsicTypeData(); LoadIntrinsicTypeData();
} }
private static void LoadIntrinsicTypeData() private static void LoadIntrinsicTypeData()
{ {
DllLoadResult.s_intrinsicData = new Map<uint, DllLoadResult.IntrinsicTypeData>(); s_intrinsicData = new Map<uint, DllLoadResult.IntrinsicTypeData>();
DllLoadResult.s_intrinsicData[4294967294U] = new DllLoadResult.IntrinsicTypeData(BooleanSchema.Type); s_intrinsicData[4294967294U] = new DllLoadResult.IntrinsicTypeData(BooleanSchema.Type);
DllLoadResult.s_intrinsicData[4294967293U] = new DllLoadResult.IntrinsicTypeData(ByteSchema.Type); s_intrinsicData[4294967293U] = new DllLoadResult.IntrinsicTypeData(ByteSchema.Type);
DllLoadResult.s_intrinsicData[4294967292U] = new DllLoadResult.IntrinsicTypeData(DoubleSchema.Type); s_intrinsicData[4294967292U] = new DllLoadResult.IntrinsicTypeData(DoubleSchema.Type);
DllLoadResult.s_intrinsicData[4294967285U] = new DllLoadResult.IntrinsicTypeData(ListSchema.Type, typeof(DllProxyList)); s_intrinsicData[4294967285U] = new DllLoadResult.IntrinsicTypeData(ListSchema.Type, typeof(DllProxyList));
DllLoadResult.s_intrinsicData[4294967284U] = new DllLoadResult.IntrinsicTypeData(ImageSchema.Type); s_intrinsicData[4294967284U] = new DllLoadResult.IntrinsicTypeData(ImageSchema.Type);
DllLoadResult.s_intrinsicData[4294967283U] = new DllLoadResult.IntrinsicTypeData(Int32Schema.Type); s_intrinsicData[4294967283U] = new DllLoadResult.IntrinsicTypeData(Int32Schema.Type);
DllLoadResult.s_intrinsicData[4294967282U] = new DllLoadResult.IntrinsicTypeData(Int64Schema.Type); s_intrinsicData[4294967282U] = new DllLoadResult.IntrinsicTypeData(Int64Schema.Type);
DllLoadResult.s_intrinsicData[4294967280U] = new DllLoadResult.IntrinsicTypeData(ObjectSchema.Type); s_intrinsicData[4294967280U] = new DllLoadResult.IntrinsicTypeData(ObjectSchema.Type);
DllLoadResult.s_intrinsicData[4294967279U] = new DllLoadResult.IntrinsicTypeData(SingleSchema.Type); s_intrinsicData[4294967279U] = new DllLoadResult.IntrinsicTypeData(SingleSchema.Type);
DllLoadResult.s_intrinsicData[4294967278U] = new DllLoadResult.IntrinsicTypeData(StringSchema.Type); s_intrinsicData[4294967278U] = new DllLoadResult.IntrinsicTypeData(StringSchema.Type);
DllLoadResult.s_intrinsicData[4294967277U] = new DllLoadResult.IntrinsicTypeData(VoidSchema.Type); s_intrinsicData[4294967277U] = new DllLoadResult.IntrinsicTypeData(VoidSchema.Type);
} }
public static void Shutdown() => DllProxyServices.Shutdown(); public static void Shutdown() => DllProxyServices.Shutdown();
@@ -59,13 +59,13 @@ namespace Microsoft.Iris.CodeModel.Cpp
return false; return false;
} }
private bool CheckNativeReturn(uint hr) => DllLoadResult.CheckNativeReturn(hr, "IUIXTypeSchema"); private bool CheckNativeReturn(uint hr) => CheckNativeReturn(hr, "IUIXTypeSchema");
public static void PushContext(LoadResult newContext) => DllLoadResult.s_objectContext = newContext; public static void PushContext(LoadResult newContext) => s_objectContext = newContext;
public static LoadResult CurrentContext => DllLoadResult.s_objectContext; public static LoadResult CurrentContext => s_objectContext;
public static void PopContext() => DllLoadResult.s_objectContext = null; public static void PopContext() => s_objectContext = null;
public static TypeSchema MapType(uint typeID) public static TypeSchema MapType(uint typeID)
{ {
@@ -78,7 +78,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
if (dllLoadResult != null) if (dllLoadResult != null)
typeSchema = dllLoadResult.MapLocalType(typeID); typeSchema = dllLoadResult.MapLocalType(typeID);
} }
else if (DllLoadResult.CurrentContext is DllLoadResult currentContext) else if (CurrentContext is DllLoadResult currentContext)
typeSchema = currentContext.MapIntrinsicType(typeID); typeSchema = currentContext.MapIntrinsicType(typeID);
if (typeSchema == null) if (typeSchema == null)
ErrorManager.ReportError("Unable to find type with ID '0x{0:X8}' in '{1}'", typeID, dllLoadResult != null ? dllLoadResult.Uri : string.Empty); ErrorManager.ReportError("Unable to find type with ID '0x{0:X8}' in '{1}'", typeID, dllLoadResult != null ? dllLoadResult.Uri : string.Empty);
@@ -91,7 +91,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
this._intrinsicTypes = new Map<uint, TypeSchema>(); this._intrinsicTypes = new Map<uint, TypeSchema>();
TypeSchema typeSchema; TypeSchema typeSchema;
DllLoadResult.IntrinsicTypeData intrinsicTypeData; DllLoadResult.IntrinsicTypeData intrinsicTypeData;
if (!this._intrinsicTypes.TryGetValue(typeID, out typeSchema) && DllLoadResult.s_intrinsicData.TryGetValue(typeID, out intrinsicTypeData)) if (!this._intrinsicTypes.TryGetValue(typeID, out typeSchema) && s_intrinsicData.TryGetValue(typeID, out intrinsicTypeData))
{ {
typeSchema = !intrinsicTypeData.DemandCreateTypeSchema ? intrinsicTypeData.FrameworkEquivalent : new DllIntrinsicTypeSchema(this, typeID, intrinsicTypeData.FrameworkEquivalent); typeSchema = !intrinsicTypeData.DemandCreateTypeSchema ? intrinsicTypeData.FrameworkEquivalent : new DllIntrinsicTypeSchema(this, typeID, intrinsicTypeData.FrameworkEquivalent);
this._intrinsicTypes[typeID] = typeSchema; this._intrinsicTypes[typeID] = typeSchema;
@@ -113,7 +113,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
this._status = LoadResultStatus.Loading; this._status = LoadResultStatus.Loading;
this._schema = nativeSchema; this._schema = nativeSchema;
this._loadPass = LoadPass.Invalid; this._loadPass = LoadPass.Invalid;
this._component = DllLoadResult.s_nextID++; this._component = s_nextID++;
} }
public override void Load(LoadPass pass) public override void Load(LoadPass pass)
@@ -291,7 +291,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
public override LoadResultStatus Status => this._status; public override LoadResultStatus Status => this._status;
public override LoadResult[] Dependencies => LoadResult.EmptyList; public override LoadResult[] Dependencies => EmptyList;
public override bool Cachable => true; public override bool Cachable => true;
@@ -305,7 +305,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
else else
{ {
DllLoadResult.IntrinsicTypeData intrinsicTypeData; DllLoadResult.IntrinsicTypeData intrinsicTypeData;
if (DllLoadResult.s_intrinsicData.TryGetValue(marshalAs, out intrinsicTypeData)) if (s_intrinsicData.TryGetValue(marshalAs, out intrinsicTypeData))
type = intrinsicTypeData.MarshalAsRuntimeType; type = intrinsicTypeData.MarshalAsRuntimeType;
} }
return type; return type;
@@ -22,19 +22,19 @@ namespace Microsoft.Iris.CodeModel.Cpp
private static Map<uint, DllLoadResult> s_loadResultIDCache = new Map<uint, DllLoadResult>(); private static Map<uint, DllLoadResult> s_loadResultIDCache = new Map<uint, DllLoadResult>();
private static Map<string, DllLoadResultFactory> s_dllFactoriesCache = new Map<string, DllLoadResultFactory>(); private static Map<string, DllLoadResultFactory> s_dllFactoriesCache = new Map<string, DllLoadResultFactory>();
public static void Startup() => MarkupSystem.RegisterFactoryByProtocol("dll://", new CreateLoadResultHandler(DllLoadResultFactory.GetLoadResult)); public static void Startup() => MarkupSystem.RegisterFactoryByProtocol("dll://", new CreateLoadResultHandler(GetLoadResult));
public static DllLoadResult GetLoadResultByID(uint id) public static DllLoadResult GetLoadResultByID(uint id)
{ {
DllLoadResult dllLoadResult; DllLoadResult dllLoadResult;
DllLoadResultFactory.s_loadResultIDCache.TryGetValue(id, out dllLoadResult); s_loadResultIDCache.TryGetValue(id, out dllLoadResult);
return dllLoadResult; return dllLoadResult;
} }
private static LoadResult GetLoadResult(string uri) private static LoadResult GetLoadResult(string uri)
{ {
DllLoadResult dllLoadResult; DllLoadResult dllLoadResult;
if (DllLoadResultFactory.s_loadResultCache.TryGetValue(uri, out dllLoadResult)) if (s_loadResultCache.TryGetValue(uri, out dllLoadResult))
return dllLoadResult; return dllLoadResult;
int length = uri.IndexOf('!'); int length = uri.IndexOf('!');
string str; string str;
@@ -50,16 +50,16 @@ namespace Microsoft.Iris.CodeModel.Cpp
qualifier = null; qualifier = null;
} }
DllLoadResultFactory loadResultFactory; DllLoadResultFactory loadResultFactory;
if (!DllLoadResultFactory.s_dllFactoriesCache.TryGetValue(str, out loadResultFactory)) if (!s_dllFactoriesCache.TryGetValue(str, out loadResultFactory))
{ {
loadResultFactory = new DllLoadResultFactory(str); loadResultFactory = new DllLoadResultFactory(str);
DllLoadResultFactory.s_dllFactoriesCache[str] = loadResultFactory; s_dllFactoriesCache[str] = loadResultFactory;
} }
DllLoadResult loadResult = loadResultFactory.GetLoadResult(uri, qualifier); DllLoadResult loadResult = loadResultFactory.GetLoadResult(uri, qualifier);
if (loadResult != null) if (loadResult != null)
{ {
DllLoadResultFactory.s_loadResultCache[uri] = loadResult; s_loadResultCache[uri] = loadResult;
DllLoadResultFactory.s_loadResultIDCache[loadResult.SchemaComponent] = loadResult; s_loadResultIDCache[loadResult.SchemaComponent] = loadResult;
} }
return loadResult; return loadResult;
} }
@@ -76,7 +76,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
protected override void OnDispose() protected override void OnDispose()
{ {
base.OnDispose(); base.OnDispose();
DllLoadResultFactory.s_dllFactoriesCache.Remove(this._dllName); s_dllFactoriesCache.Remove(this._dllName);
if (this._schemaFactory != IntPtr.Zero) if (this._schemaFactory != IntPtr.Zero)
{ {
NativeApi.SpReleaseExternalObject(this._schemaFactory); NativeApi.SpReleaseExternalObject(this._schemaFactory);
@@ -110,8 +110,8 @@ namespace Microsoft.Iris.CodeModel.Cpp
public void NotifyLoadResultDisposed(DllLoadResult loadResult) public void NotifyLoadResultDisposed(DllLoadResult loadResult)
{ {
DllLoadResultFactory.s_loadResultCache.Remove(loadResult.Uri); s_loadResultCache.Remove(loadResult.Uri);
DllLoadResultFactory.s_loadResultIDCache.Remove(loadResult.SchemaComponent); s_loadResultIDCache.Remove(loadResult.SchemaComponent);
this.UnregisterUsage(loadResult); this.UnregisterUsage(loadResult);
} }
} }
@@ -54,11 +54,11 @@ namespace Microsoft.Iris.CodeModel.Cpp
public override TypeSchema AlternateType => (TypeSchema)null; public override TypeSchema AlternateType => (TypeSchema)null;
public override bool CanRead => this.GetBit(DllPropertySchema.Bits.CanRead); public override bool CanRead => this.GetBit(Bits.CanRead);
public override bool CanWrite => this.GetBit(DllPropertySchema.Bits.CanWrite); public override bool CanWrite => this.GetBit(Bits.CanWrite);
public override bool IsStatic => this.GetBit(DllPropertySchema.Bits.IsStatic); public override bool IsStatic => this.GetBit(Bits.IsStatic);
public override ExpressionRestriction ExpressionRestriction => ExpressionRestriction.None; public override ExpressionRestriction ExpressionRestriction => ExpressionRestriction.None;
@@ -66,7 +66,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
public override RangeValidator RangeValidator => (RangeValidator)null; public override RangeValidator RangeValidator => (RangeValidator)null;
public override bool NotifiesOnChange => this.GetBit(DllPropertySchema.Bits.NotifiesOnChange); public override bool NotifiesOnChange => this.GetBit(Bits.NotifiesOnChange);
private DllTypeSchema OwnerTypeSchema => (DllTypeSchema)this.Owner; private DllTypeSchema OwnerTypeSchema => (DllTypeSchema)this.Owner;
@@ -106,7 +106,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
bool canRead; bool canRead;
if (this.CheckNativeReturn(NativeApi.SpQueryPropertyCanRead(property, out canRead))) if (this.CheckNativeReturn(NativeApi.SpQueryPropertyCanRead(property, out canRead)))
{ {
this.SetBit(DllPropertySchema.Bits.CanRead, canRead); this.SetBit(Bits.CanRead, canRead);
flag = true; flag = true;
} }
return flag; return flag;
@@ -118,7 +118,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
bool canWrite; bool canWrite;
if (this.CheckNativeReturn(NativeApi.SpQueryPropertyCanWrite(property, out canWrite))) if (this.CheckNativeReturn(NativeApi.SpQueryPropertyCanWrite(property, out canWrite)))
{ {
this.SetBit(DllPropertySchema.Bits.CanWrite, canWrite); this.SetBit(Bits.CanWrite, canWrite);
flag = true; flag = true;
} }
return flag; return flag;
@@ -130,7 +130,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
bool isStatic; bool isStatic;
if (this.CheckNativeReturn(NativeApi.SpQueryPropertyIsStatic(property, out isStatic))) if (this.CheckNativeReturn(NativeApi.SpQueryPropertyIsStatic(property, out isStatic)))
{ {
this.SetBit(DllPropertySchema.Bits.IsStatic, isStatic); this.SetBit(Bits.IsStatic, isStatic);
flag = true; flag = true;
} }
return flag; return flag;
@@ -144,7 +144,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
bool notifiesOnChange; bool notifiesOnChange;
if (this.CheckNativeReturn(NativeApi.SpQueryPropertyNotifiesOnChange(property, out notifiesOnChange))) if (this.CheckNativeReturn(NativeApi.SpQueryPropertyNotifiesOnChange(property, out notifiesOnChange)))
{ {
this.SetBit(DllPropertySchema.Bits.NotifiesOnChange, notifiesOnChange); this.SetBit(Bits.NotifiesOnChange, notifiesOnChange);
flag = true; flag = true;
} }
return flag; return flag;
@@ -21,19 +21,19 @@ namespace Microsoft.Iris.CodeModel.Cpp
private static object s_finalizeLock = new object(); private static object s_finalizeLock = new object();
private static bool s_pendingAppThreadRelease = false; private static bool s_pendingAppThreadRelease = false;
private static Vector<DllProxyObject.AppThreadReleaseEntry> s_pendingReleases; private static Vector<DllProxyObject.AppThreadReleaseEntry> s_pendingReleases;
private static SimpleCallback s_releaseOnAppThread = new SimpleCallback(DllProxyObject.ReleaseFinalizedObjects); private static SimpleCallback s_releaseOnAppThread = new SimpleCallback(ReleaseFinalizedObjects);
private static DllProxyObjectHandleTable s_handleTable; private static DllProxyObjectHandleTable s_handleTable;
public static void CreateHandleTable() => DllProxyObject.s_handleTable = new DllProxyObjectHandleTable(); public static void CreateHandleTable() => s_handleTable = new DllProxyObjectHandleTable();
public static void ReleaseOutstandingProxies() public static void ReleaseOutstandingProxies()
{ {
DllProxyObject.s_pendingAppThreadRelease = true; s_pendingAppThreadRelease = true;
GC.Collect(); GC.Collect();
GC.WaitForPendingFinalizers(); GC.WaitForPendingFinalizers();
foreach (IDisposableObject disposableObject in s_handleTable) foreach (IDisposableObject disposableObject in s_handleTable)
disposableObject.Dispose(disposableObject); disposableObject.Dispose(disposableObject);
DllProxyObject.ReleaseFinalizedObjects(); ReleaseFinalizedObjects();
} }
public static DllProxyObject Wrap(IntPtr nativeObject) public static DllProxyObject Wrap(IntPtr nativeObject)
@@ -45,7 +45,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
TypeSchema type = DllLoadResult.MapType(typeID); TypeSchema type = DllLoadResult.MapType(typeID);
if (type != null) if (type != null)
{ {
dllProxyObject = DllProxyObject.GetExistingProxy(nativeObject) ?? DllProxyObject.WrapNewObject(nativeObject, type); dllProxyObject = GetExistingProxy(nativeObject) ?? WrapNewObject(nativeObject, type);
NativeApi.SpReleaseExternalObject(nativeObject); NativeApi.SpReleaseExternalObject(nativeObject);
} }
return dllProxyObject; return dllProxyObject;
@@ -56,7 +56,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
DllProxyObject dllProxyObject = null; DllProxyObject dllProxyObject = null;
ulong state; ulong state;
NativeApi.SpGetStateCache(nativeObject, out state); NativeApi.SpGetStateCache(nativeObject, out state);
if (state != 0UL && !DllProxyObject.s_handleTable.LookupByHandle(state, out dllProxyObject)) if (state != 0UL && !s_handleTable.LookupByHandle(state, out dllProxyObject))
ErrorManager.ReportError("IUIXObject::GetStateCache retrieved unexpected value"); ErrorManager.ReportError("IUIXObject::GetStateCache retrieved unexpected value");
return dllProxyObject; return dllProxyObject;
} }
@@ -66,7 +66,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
DllProxyObject dllProxyObject = null; DllProxyObject dllProxyObject = null;
uint marshalAs; uint marshalAs;
IntPtr nativeImpl; IntPtr nativeImpl;
if (DllProxyObject.DetermineProxyInterfaceForObject(nativeObject, type, out marshalAs, out nativeImpl)) if (DetermineProxyInterfaceForObject(nativeObject, type, out marshalAs, out nativeImpl))
{ {
switch (marshalAs) switch (marshalAs)
{ {
@@ -108,7 +108,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
flag = true; flag = true;
nativeImpl = IntPtr.Zero; nativeImpl = IntPtr.Zero;
} }
else if (DllProxyObject.CheckNativeReturn(NativeApi.SpQueryForMarshalAsInterface(nativeObject, marshalAs, out nativeImpl)) && nativeImpl != IntPtr.Zero) else if (CheckNativeReturn(NativeApi.SpQueryForMarshalAsInterface(nativeObject, marshalAs, out nativeImpl)) && nativeImpl != IntPtr.Zero)
flag = true; flag = true;
else else
ErrorManager.ReportError("Object didn't implement expected interface '{0}'", marshalAs); ErrorManager.ReportError("Object didn't implement expected interface '{0}'", marshalAs);
@@ -117,19 +117,19 @@ namespace Microsoft.Iris.CodeModel.Cpp
protected DllProxyObject() => this._handle = 0UL; protected DllProxyObject() => this._handle = 0UL;
~DllProxyObject() => DllProxyObject.RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(this._nativeObject, this._handle, this.OwningLoadResult)); ~DllProxyObject() => RegisterAppThreadRelease(new DllProxyObject.AppThreadReleaseEntry(this._nativeObject, this._handle, this.OwningLoadResult));
protected static void RegisterAppThreadRelease(DllProxyObject.AppThreadReleaseEntry entry) protected static void RegisterAppThreadRelease(DllProxyObject.AppThreadReleaseEntry entry)
{ {
lock (DllProxyObject.s_finalizeLock) lock (s_finalizeLock)
{ {
if (DllProxyObject.s_pendingReleases == null) if (s_pendingReleases == null)
DllProxyObject.s_pendingReleases = new Vector<DllProxyObject.AppThreadReleaseEntry>(); s_pendingReleases = new Vector<DllProxyObject.AppThreadReleaseEntry>();
DllProxyObject.s_pendingReleases.Add(entry); s_pendingReleases.Add(entry);
if (DllProxyObject.s_pendingAppThreadRelease) if (s_pendingAppThreadRelease)
return; return;
DllProxyObject.s_pendingAppThreadRelease = true; s_pendingAppThreadRelease = true;
DeferredCall.Post(DispatchPriority.Idle, DllProxyObject.s_releaseOnAppThread); DeferredCall.Post(DispatchPriority.Idle, s_releaseOnAppThread);
} }
} }
@@ -138,7 +138,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
this._type = type; this._type = type;
this._nativeObject = nativeObject; this._nativeObject = nativeObject;
this.OwningLoadResult.RegisterProxyUsage(); this.OwningLoadResult.RegisterProxyUsage();
this._handle = DllProxyObject.s_handleTable.RegisterProxy(this); this._handle = s_handleTable.RegisterProxy(this);
NativeApi.SpSetStateCache(this._nativeObject, this._handle); NativeApi.SpSetStateCache(this._nativeObject, this._handle);
NativeApi.SpAddRefExternalObject(this._nativeObject); NativeApi.SpAddRefExternalObject(this._nativeObject);
this.LoadWorker(nativeObject, marshalAs); this.LoadWorker(nativeObject, marshalAs);
@@ -151,7 +151,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
public static HRESULT OnChangeNotification(IntPtr nativeObject, uint id) public static HRESULT OnChangeNotification(IntPtr nativeObject, uint id)
{ {
HRESULT hresult = new HRESULT(0); HRESULT hresult = new HRESULT(0);
DllProxyObject existingProxy = DllProxyObject.GetExistingProxy(nativeObject); DllProxyObject existingProxy = GetExistingProxy(nativeObject);
if (existingProxy != null) if (existingProxy != null)
{ {
string id1 = null; string id1 = null;
@@ -204,22 +204,22 @@ namespace Microsoft.Iris.CodeModel.Cpp
private static void ReleaseFinalizedObjects() private static void ReleaseFinalizedObjects()
{ {
Vector<DllProxyObject.AppThreadReleaseEntry> pendingReleases; Vector<DllProxyObject.AppThreadReleaseEntry> pendingReleases;
lock (DllProxyObject.s_finalizeLock) lock (s_finalizeLock)
{ {
pendingReleases = DllProxyObject.s_pendingReleases; pendingReleases = s_pendingReleases;
DllProxyObject.s_pendingReleases = null; s_pendingReleases = null;
DllProxyObject.s_pendingAppThreadRelease = false; s_pendingAppThreadRelease = false;
} }
if (pendingReleases == null || pendingReleases.Count == 0) if (pendingReleases == null || pendingReleases.Count == 0)
return; return;
foreach (DllProxyObject.AppThreadReleaseEntry threadReleaseEntry in pendingReleases) foreach (DllProxyObject.AppThreadReleaseEntry threadReleaseEntry in pendingReleases)
threadReleaseEntry.Release(); threadReleaseEntry.Release();
lock (DllProxyObject.s_finalizeLock) lock (s_finalizeLock)
{ {
if (DllProxyObject.s_pendingAppThreadRelease) if (s_pendingAppThreadRelease)
return; return;
pendingReleases.Clear(); pendingReleases.Clear();
DllProxyObject.s_pendingReleases = pendingReleases; s_pendingReleases = pendingReleases;
} }
} }
@@ -256,7 +256,7 @@ namespace Microsoft.Iris.CodeModel.Cpp
{ {
if (this._releaseHandle) if (this._releaseHandle)
{ {
DllProxyObject.s_handleTable.ReleaseProxy(this._handle); s_handleTable.ReleaseProxy(this._handle);
ulong state; ulong state;
NativeApi.SpGetStateCache(this._nativeObject, out state); NativeApi.SpGetStateCache(this._nativeObject, out state);
if ((long)this._handle == (long)state) if ((long)this._handle == (long)state)

Some files were not shown because too many files have changed in this diff Show More