Simplified usages in UIX project

This commit is contained in:
Joshua Askharoun
2021-04-02 19:10:51 -05:00
parent 2b20ca46ad
commit c07b53bb0b
464 changed files with 14054 additions and 14064 deletions
File diff suppressed because it is too large Load Diff
@@ -25,24 +25,24 @@ namespace Microsoft.Iris.Accessibility
internal AccessibleChildren(AccessibleProxy proxy, int position) internal AccessibleChildren(AccessibleProxy proxy, int position)
{ {
this._proxy = proxy; _proxy = proxy;
this._current = position; _current = position;
} }
internal IEnumVARIANT Clone() => new AccessibleChildren(this._proxy, this._current); internal IEnumVARIANT Clone() => new AccessibleChildren(_proxy, _current);
internal int Next(int count, object[] children) internal int Next(int count, object[] children)
{ {
int index = 0; int index = 0;
do do
{ {
++this._current; ++_current;
if (this._current >= this._proxy.UI.Children.Count) if (_current >= _proxy.UI.Children.Count)
{ {
this._current = this._proxy.UI.Children.Count; _current = _proxy.UI.Children.Count;
break; break;
} }
UIClass child = (UIClass)this._proxy.UI.Children[this._current]; UIClass child = (UIClass)_proxy.UI.Children[_current];
children[index] = child.AccessibleProxy; children[index] = child.AccessibleProxy;
++index; ++index;
} }
@@ -50,47 +50,47 @@ namespace Microsoft.Iris.Accessibility
return index; return index;
} }
internal void Reset() => this._current = -1; internal void Reset() => _current = -1;
internal bool Skip(int count) internal bool Skip(int count)
{ {
this._current += count; _current += count;
if (this._current < this._proxy.UI.Children.Count) if (_current < _proxy.UI.Children.Count)
return true; return true;
this._current = this._proxy.UI.Children.Count; _current = _proxy.UI.Children.Count;
return false; return false;
} }
IEnumVARIANT IEnumVARIANT.Clone() IEnumVARIANT IEnumVARIANT.Clone()
{ {
this.VerifyEnumeratorAccess(); VerifyEnumeratorAccess();
return this.Clone(); return Clone();
} }
unsafe int IEnumVARIANT.Next(int celt, object[] rgVar, IntPtr pceltFetched) unsafe int IEnumVARIANT.Next(int celt, object[] rgVar, IntPtr pceltFetched)
{ {
this.VerifyEnumeratorAccess(); VerifyEnumeratorAccess();
int num = this.Next(celt, rgVar); int num = Next(celt, rgVar);
*(int*)(void*)pceltFetched = num; *(int*)(void*)pceltFetched = num;
return num != celt ? 1 : 0; return num != celt ? 1 : 0;
} }
int IEnumVARIANT.Reset() int IEnumVARIANT.Reset()
{ {
this.VerifyEnumeratorAccess(); VerifyEnumeratorAccess();
this.Reset(); Reset();
return 0; return 0;
} }
int IEnumVARIANT.Skip(int celt) int IEnumVARIANT.Skip(int celt)
{ {
this.VerifyEnumeratorAccess(); VerifyEnumeratorAccess();
return !this.Skip(celt) ? 1 : 0; return !Skip(celt) ? 1 : 0;
} }
private void VerifyEnumeratorAccess() private void VerifyEnumeratorAccess()
{ {
if (this._proxy.UI != null && UIDispatcher.IsUIThread) if (_proxy.UI != null && UIDispatcher.IsUIThread)
return; return;
Marshal.ThrowExceptionForHR(-2147467259); Marshal.ThrowExceptionForHR(-2147467259);
} }
@@ -33,21 +33,21 @@ namespace Microsoft.Iris.Accessibility
internal AccessibleProxy(UIClass ui, Accessible data) internal AccessibleProxy(UIClass ui, Accessible data)
{ {
this._ui = ui; _ui = ui;
this._data = data; _data = data;
this._data.Attach(this); _data.Attach(this);
this._children = new AccessibleChildren(this); _children = new AccessibleChildren(this);
} }
internal UIClass UI => this._ui; internal UIClass UI => _ui;
internal void Detach() internal void Detach()
{ {
this._data.Detach(); _data.Detach();
this._ui = null; _ui = null;
if (this._proxyID == -1) if (_proxyID == -1)
return; return;
s_proxyFromID.Remove(this._proxyID); s_proxyFromID.Remove(_proxyID);
} }
internal static bool AccessibilityActive internal static bool AccessibilityActive
@@ -56,86 +56,86 @@ namespace Microsoft.Iris.Accessibility
set => s_accessibilityActive = true; set => s_accessibilityActive = true;
} }
internal virtual IAccessible Parent => this._ui.Parent != null ? _ui.Parent.AccessibleProxy : null; internal virtual IAccessible Parent => _ui.Parent != null ? _ui.Parent.AccessibleProxy : null;
internal int ChildCount => this._ui.Children.Count; internal int ChildCount => _ui.Children.Count;
internal virtual string Name internal virtual string Name
{ {
get => this._data.Name; get => _data.Name;
set => this._data.Name = value; set => _data.Name = value;
} }
internal string Value internal string Value
{ {
get => this._data.Value; get => _data.Value;
set => this._data.Value = value; set => _data.Value = value;
} }
internal string Description => this._data.Description; internal string Description => _data.Description;
internal AccRole Role => this._data.Role; internal AccRole Role => _data.Role;
internal AccStates State internal AccStates State
{ {
get get
{ {
AccStates accStates = AccStates.None; AccStates accStates = AccStates.None;
if (this._ui.DirectKeyFocus) if (_ui.DirectKeyFocus)
accStates |= AccStates.Focused; accStates |= AccStates.Focused;
if (this._ui.IsKeyFocusable()) if (_ui.IsKeyFocusable())
accStates |= AccStates.Focusable; accStates |= AccStates.Focusable;
if (this._ui.DirectMouseFocus) if (_ui.DirectMouseFocus)
accStates |= AccStates.HotTracked; accStates |= AccStates.HotTracked;
if (!this._ui.Visible) if (!_ui.Visible)
accStates |= AccStates.Invisible; accStates |= AccStates.Invisible;
if (this._ui.Host != null && this._ui.Host.IsOffscreen) if (_ui.Host != null && _ui.Host.IsOffscreen)
accStates |= AccStates.OffScreen; accStates |= AccStates.OffScreen;
if (this._data.HasPopup) if (_data.HasPopup)
accStates |= AccStates.HasPopup; accStates |= AccStates.HasPopup;
if (this._data.IsAnimated) if (_data.IsAnimated)
accStates |= AccStates.Animated; accStates |= AccStates.Animated;
if (this._data.IsBusy) if (_data.IsBusy)
accStates |= AccStates.Busy; accStates |= AccStates.Busy;
if (this._data.IsChecked) if (_data.IsChecked)
accStates |= AccStates.Checked; accStates |= AccStates.Checked;
if (this._data.IsCollapsed) if (_data.IsCollapsed)
accStates |= AccStates.Collapsed; accStates |= AccStates.Collapsed;
if (this._data.IsDefault) if (_data.IsDefault)
accStates |= AccStates.Default; accStates |= AccStates.Default;
if (this._data.IsExpanded) if (_data.IsExpanded)
accStates |= AccStates.Expanded; accStates |= AccStates.Expanded;
if (this._data.IsMarquee) if (_data.IsMarquee)
accStates |= AccStates.Marquee; accStates |= AccStates.Marquee;
if (this._data.IsMixed) if (_data.IsMixed)
accStates |= AccStates.Mixed; accStates |= AccStates.Mixed;
if (this._data.IsMultiSelectable) if (_data.IsMultiSelectable)
accStates |= AccStates.MultiSelectable; accStates |= AccStates.MultiSelectable;
if (this._data.IsPressed) if (_data.IsPressed)
accStates |= AccStates.Pressed; accStates |= AccStates.Pressed;
if (this._data.IsProtected) if (_data.IsProtected)
accStates |= AccStates.Protected; accStates |= AccStates.Protected;
if (this._data.IsSelectable) if (_data.IsSelectable)
accStates |= AccStates.Selectable; accStates |= AccStates.Selectable;
if (this._data.IsSelected) if (_data.IsSelected)
accStates |= AccStates.Selected; accStates |= AccStates.Selected;
if (this._data.IsTraversed) if (_data.IsTraversed)
accStates |= AccStates.Traversed; accStates |= AccStates.Traversed;
if (this._data.IsUnavailable) if (_data.IsUnavailable)
accStates |= AccStates.Unavailable; accStates |= AccStates.Unavailable;
return accStates; return accStates;
} }
} }
internal string Help => this._data.Help; internal string Help => _data.Help;
internal int HelpTopic => this._data.HelpTopic; internal int HelpTopic => _data.HelpTopic;
internal string KeyboardShortcut => this._data.KeyboardShortcut; internal string KeyboardShortcut => _data.KeyboardShortcut;
internal bool HasFocus => this._ui.DirectKeyFocus; internal bool HasFocus => _ui.DirectKeyFocus;
internal string DefaultAction => this._data.DefaultAction; internal string DefaultAction => _data.DefaultAction;
internal Rectangle Location internal Rectangle Location
{ {
@@ -144,7 +144,7 @@ namespace Microsoft.Iris.Accessibility
Rectangle rectangle = Rectangle.Zero; Rectangle rectangle = Rectangle.Zero;
Vector3 positionPxlVector; Vector3 positionPxlVector;
Vector3 sizePxlVector; Vector3 sizePxlVector;
if (this._ui.RootItem != null && ((INavigationSite)this._ui.RootItem).ComputeBounds(out positionPxlVector, out sizePxlVector)) if (_ui.RootItem != null && ((INavigationSite)_ui.RootItem).ComputeBounds(out positionPxlVector, out sizePxlVector))
{ {
rectangle = new Rectangle((int)positionPxlVector.X, (int)positionPxlVector.Y, (int)sizePxlVector.X, (int)sizePxlVector.Y); rectangle = new Rectangle((int)positionPxlVector.X, (int)positionPxlVector.Y, (int)sizePxlVector.X, (int)sizePxlVector.Y);
Point location = rectangle.Location; Point location = rectangle.Location;
@@ -161,28 +161,28 @@ namespace Microsoft.Iris.Accessibility
switch (navDir) switch (navDir)
{ {
case AccNavDirs.Up: case AccNavDirs.Up:
this._ui.FindNextFocusablePeer(Direction.North, RectangleF.Zero, out resultUI); _ui.FindNextFocusablePeer(Direction.North, RectangleF.Zero, out resultUI);
break; break;
case AccNavDirs.Down: case AccNavDirs.Down:
this._ui.FindNextFocusablePeer(Direction.South, RectangleF.Zero, out resultUI); _ui.FindNextFocusablePeer(Direction.South, RectangleF.Zero, out resultUI);
break; break;
case AccNavDirs.Left: case AccNavDirs.Left:
this._ui.FindNextFocusablePeer(Direction.West, RectangleF.Zero, out resultUI); _ui.FindNextFocusablePeer(Direction.West, RectangleF.Zero, out resultUI);
break; break;
case AccNavDirs.Right: case AccNavDirs.Right:
this._ui.FindNextFocusablePeer(Direction.East, RectangleF.Zero, out resultUI); _ui.FindNextFocusablePeer(Direction.East, RectangleF.Zero, out resultUI);
break; break;
case AccNavDirs.Next: case AccNavDirs.Next:
resultUI = (UIClass)this._ui.NextSibling; resultUI = (UIClass)_ui.NextSibling;
break; break;
case AccNavDirs.Previous: case AccNavDirs.Previous:
resultUI = (UIClass)this._ui.PreviousSibling; resultUI = (UIClass)_ui.PreviousSibling;
break; break;
case AccNavDirs.FirstChild: case AccNavDirs.FirstChild:
resultUI = (UIClass)this._ui.FirstChild; resultUI = (UIClass)_ui.FirstChild;
break; break;
case AccNavDirs.LastChild: case AccNavDirs.LastChild:
resultUI = (UIClass)this._ui.LastChild; resultUI = (UIClass)_ui.LastChild;
break; break;
} }
return resultUI != null ? resultUI.AccessibleProxy : null; return resultUI != null ? resultUI.AccessibleProxy : null;
@@ -190,9 +190,9 @@ namespace Microsoft.Iris.Accessibility
internal void DoDefaultAction() internal void DoDefaultAction()
{ {
if (this._data.DefaultActionCommand == null) if (_data.DefaultActionCommand == null)
return; return;
this._data.DefaultActionCommand.Invoke(); _data.DefaultActionCommand.Invoke();
} }
internal static void NotifyCreated(UIClass ui) internal static void NotifyCreated(UIClass ui)
@@ -232,7 +232,7 @@ namespace Microsoft.Iris.Accessibility
internal void NotifyAccessiblePropertyChanged(AccessibleProperty property) internal void NotifyAccessiblePropertyChanged(AccessibleProperty property)
{ {
if (!this._ui.Initialized) if (!_ui.Initialized)
return; return;
AccEvents eventType = AccEvents.None; AccEvents eventType = AccEvents.None;
switch (property) switch (property)
@@ -267,7 +267,7 @@ namespace Microsoft.Iris.Accessibility
eventType = AccEvents.ObjectHelpChange; eventType = AccEvents.ObjectHelpChange;
break; break;
case AccessibleProperty.IsSelected: case AccessibleProperty.IsSelected:
if (this._data.IsSelected) if (_data.IsSelected)
{ {
eventType = AccEvents.ObjectSelection; eventType = AccEvents.ObjectSelection;
break; break;
@@ -285,7 +285,7 @@ namespace Microsoft.Iris.Accessibility
} }
if (eventType == AccEvents.None) if (eventType == AccEvents.None)
return; return;
this.QueueNotifyEvent(eventType); QueueNotifyEvent(eventType);
} }
private void QueueNotifyEvent(AccEvents eventType) private void QueueNotifyEvent(AccEvents eventType)
@@ -314,15 +314,15 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
return Parent; return Parent;
} }
} }
object IAccessible.get_accChild(object varChild) object IAccessible.get_accChild(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
return this; return this;
} }
@@ -330,74 +330,74 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
return this.ChildCount; return ChildCount;
} }
} }
string IAccessible.get_accName(object varChild) string IAccessible.get_accName(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
return this.Name; return Name;
} }
string IAccessible.get_accValue(object varChild) string IAccessible.get_accValue(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
return this.Value; return Value;
} }
string IAccessible.get_accDescription(object varChild) string IAccessible.get_accDescription(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
return this.Description; return Description;
} }
object IAccessible.get_accRole(object varChild) object IAccessible.get_accRole(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
return (int)this.Role; return (int)Role;
} }
object IAccessible.get_accState(object varChild) object IAccessible.get_accState(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
return (int)this.State; return (int)State;
} }
string IAccessible.get_accHelp(object varChild) string IAccessible.get_accHelp(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
return this.Help; return Help;
} }
int IAccessible.get_accHelpTopic(out string pszHelpFile, object varChild) int IAccessible.get_accHelpTopic(out string pszHelpFile, object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
pszHelpFile = null; pszHelpFile = null;
return this.HelpTopic; return HelpTopic;
} }
string IAccessible.get_accKeyboardShortcut(object varChild) string IAccessible.get_accKeyboardShortcut(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
return this.KeyboardShortcut; return KeyboardShortcut;
} }
object IAccessible.accFocus object IAccessible.accFocus
{ {
get get
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
return this.HasFocus ? 0 : (object)null; return HasFocus ? 0 : (object)null;
} }
} }
@@ -405,7 +405,7 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
Marshal.ThrowExceptionForHR(-2147467263); Marshal.ThrowExceptionForHR(-2147467263);
return null; return null;
} }
@@ -413,15 +413,15 @@ namespace Microsoft.Iris.Accessibility
string IAccessible.get_accDefaultAction(object varChild) string IAccessible.get_accDefaultAction(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
return this.DefaultAction; return DefaultAction;
} }
void IAccessible.accSelect(int flagsSelect, object varChild) void IAccessible.accSelect(int flagsSelect, object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
Marshal.ThrowExceptionForHR(-2147467263); Marshal.ThrowExceptionForHR(-2147467263);
} }
@@ -432,9 +432,9 @@ namespace Microsoft.Iris.Accessibility
out int pcyHeight, out int pcyHeight,
object varChild) object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
Rectangle location = this.Location; Rectangle location = Location;
pxLeft = location.X; pxLeft = location.X;
pyTop = location.Y; pyTop = location.Y;
pcxWidth = location.Width; pcxWidth = location.Width;
@@ -443,65 +443,65 @@ namespace Microsoft.Iris.Accessibility
object IAccessible.accNavigate(int navDir, object varStart) object IAccessible.accNavigate(int navDir, object varStart)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varStart); VerifySelfChildID(varStart);
return this.Navigate((AccNavDirs)navDir); return Navigate((AccNavDirs)navDir);
} }
object IAccessible.accHitTest(int xLeft, int yTop) object IAccessible.accHitTest(int xLeft, int yTop)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
Marshal.ThrowExceptionForHR(-2147467263); Marshal.ThrowExceptionForHR(-2147467263);
return null; return null;
} }
void IAccessible.accDoDefaultAction(object varChild) void IAccessible.accDoDefaultAction(object varChild)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.DoDefaultAction(); DoDefaultAction();
} }
void IAccessible.set_accName(object varChild, string pszName) void IAccessible.set_accName(object varChild, string pszName)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
this.Name = pszName; Name = pszName;
} }
void IAccessible.set_accValue(object varChild, string pszValue) void IAccessible.set_accValue(object varChild, string pszValue)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
this.VerifySelfChildID(varChild); VerifySelfChildID(varChild);
this.Value = pszValue; Value = pszValue;
} }
IEnumVARIANT IEnumVARIANT.Clone() IEnumVARIANT IEnumVARIANT.Clone()
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
return this._children.Clone(); return _children.Clone();
} }
int IEnumVARIANT.Next(int celt, object[] rgVar, IntPtr pceltFetched) int IEnumVARIANT.Next(int celt, object[] rgVar, IntPtr pceltFetched)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
return this._children.Next(celt, rgVar, pceltFetched); return _children.Next(celt, rgVar, pceltFetched);
} }
int IEnumVARIANT.Reset() int IEnumVARIANT.Reset()
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
return this._children.Reset(); return _children.Reset();
} }
int IEnumVARIANT.Skip(int celt) int IEnumVARIANT.Skip(int celt)
{ {
this.VerifyProxyAccess(); VerifyProxyAccess();
return this._children.Skip(celt); return _children.Skip(celt);
} }
private void VerifyProxyAccess() private void VerifyProxyAccess()
{ {
if (this._ui != null && UIDispatcher.IsUIThread) if (_ui != null && UIDispatcher.IsUIThread)
return; return;
Marshal.ThrowExceptionForHR(-2147467259); Marshal.ThrowExceptionForHR(-2147467259);
} }
@@ -517,12 +517,12 @@ namespace Microsoft.Iris.Accessibility
{ {
get get
{ {
if (this._proxyID == -1) if (_proxyID == -1)
{ {
this._proxyID = ++s_proxyIDAllocator; _proxyID = ++s_proxyIDAllocator;
s_proxyFromID[this._proxyID] = this; s_proxyFromID[_proxyID] = this;
} }
return this._proxyID; return _proxyID;
} }
} }
@@ -21,7 +21,7 @@ namespace Microsoft.Iris.Accessibility
{ {
} }
internal override IAccessible Parent => (IAccessible)this._clientBridge.accParent; internal override IAccessible Parent => (IAccessible)_clientBridge.accParent;
internal override IAccessible Navigate(AccNavDirs navDir) internal override IAccessible Navigate(AccNavDirs navDir)
{ {
@@ -34,7 +34,7 @@ namespace Microsoft.Iris.Accessibility
case AccNavDirs.Right: case AccNavDirs.Right:
case AccNavDirs.Next: case AccNavDirs.Next:
case AccNavDirs.Previous: case AccNavDirs.Previous:
accessible = (IAccessible)this._clientBridge.accNavigate((int)navDir, 0); accessible = (IAccessible)_clientBridge.accNavigate((int)navDir, 0);
break; break;
case AccNavDirs.FirstChild: case AccNavDirs.FirstChild:
case AccNavDirs.LastChild: case AccNavDirs.LastChild:
@@ -46,8 +46,8 @@ namespace Microsoft.Iris.Accessibility
internal override string Name => UIApplication.ApplicationName; internal override string Name => UIApplication.ApplicationName;
internal IAccessible ClientBridge => this._clientBridge; internal IAccessible ClientBridge => _clientBridge;
internal void AttachClientBridge(IAccessible clientBridge) => this._clientBridge = clientBridge; internal void AttachClientBridge(IAccessible clientBridge) => _clientBridge = clientBridge;
} }
} }
+31 -31
View File
@@ -45,28 +45,28 @@ namespace Microsoft.Iris
{ {
if (lists == null) if (lists == null)
lists = new IList[0]; lists = new IList[0];
this._lists = lists; _lists = lists;
UIListContentsChangedHandler contentsChangedHandler = new UIListContentsChangedHandler(this.ChildListModified); UIListContentsChangedHandler contentsChangedHandler = new UIListContentsChangedHandler(ChildListModified);
SlowDataAcquireCompleteHandler acquireCompleteHandler = new SlowDataAcquireCompleteHandler(this.ChildListSlowDataAcquired); SlowDataAcquireCompleteHandler acquireCompleteHandler = new SlowDataAcquireCompleteHandler(ChildListSlowDataAcquired);
for (int index = 0; index < this._lists.Length; ++index) for (int index = 0; index < _lists.Length; ++index)
{ {
if (this._lists[index] == null) if (_lists[index] == null)
this._lists[index] = new ArrayList(); _lists[index] = new ArrayList();
IList list = this._lists[index]; IList list = _lists[index];
if (list is INotifyList notifyList) if (list is INotifyList notifyList)
notifyList.ContentsChanged += contentsChangedHandler; notifyList.ContentsChanged += contentsChangedHandler;
if (list is IVirtualList virtualList && virtualList.SlowDataRequestsEnabled) if (list is IVirtualList virtualList && virtualList.SlowDataRequestsEnabled)
virtualList.SlowDataAcquireCompleteHandler = acquireCompleteHandler; virtualList.SlowDataAcquireCompleteHandler = acquireCompleteHandler;
} }
this.Count = this.ItemCount; Count = ItemCount;
} }
protected override void OnDispose(bool disposing) protected override void OnDispose(bool disposing)
{ {
if (disposing) if (disposing)
{ {
UIListContentsChangedHandler contentsChangedHandler = new UIListContentsChangedHandler(this.ChildListModified); UIListContentsChangedHandler contentsChangedHandler = new UIListContentsChangedHandler(ChildListModified);
foreach (IList list in this._lists) foreach (IList list in _lists)
{ {
if (list is INotifyList notifyList) if (list is INotifyList notifyList)
notifyList.ContentsChanged -= contentsChangedHandler; notifyList.ContentsChanged -= contentsChangedHandler;
@@ -79,7 +79,7 @@ namespace Microsoft.Iris
protected override object OnRequestItem(int index) protected override object OnRequestItem(int index)
{ {
foreach (IList list in this._lists) foreach (IList list in _lists)
{ {
if (index < list.Count) if (index < list.Count)
return list[index]; return list[index];
@@ -90,7 +90,7 @@ namespace Microsoft.Iris
protected override void OnRequestSlowData(int index) protected override void OnRequestSlowData(int index)
{ {
foreach (IList list in this._lists) foreach (IList list in _lists)
{ {
if (index < list.Count) if (index < list.Count)
{ {
@@ -103,43 +103,43 @@ namespace Microsoft.Iris
} }
index -= list.Count; index -= list.Count;
} }
this.NotifySlowDataAcquireComplete(index); NotifySlowDataAcquireComplete(index);
} }
private bool ChildListSlowDataAcquired(IVirtualList childList, int index) private bool ChildListSlowDataAcquired(IVirtualList childList, int index)
{ {
this.NotifySlowDataAcquireComplete(this.ListIndexToMasterIndex(childList, index)); NotifySlowDataAcquireComplete(ListIndexToMasterIndex(childList, index));
return true; return true;
} }
private void ChildListModified(IList listSender, UIListContentsChangedArgs args) private void ChildListModified(IList listSender, UIListContentsChangedArgs args)
{ {
int masterIndex1 = this.ListIndexToMasterIndex(listSender, args.OldIndex); int masterIndex1 = ListIndexToMasterIndex(listSender, args.OldIndex);
int masterIndex2 = this.ListIndexToMasterIndex(listSender, args.NewIndex); int masterIndex2 = ListIndexToMasterIndex(listSender, args.NewIndex);
switch (args.Type) switch (args.Type)
{ {
case UIListContentsChangeType.Add: case UIListContentsChangeType.Add:
case UIListContentsChangeType.Insert: case UIListContentsChangeType.Insert:
this.Insert(masterIndex2); Insert(masterIndex2);
break; break;
case UIListContentsChangeType.AddRange: case UIListContentsChangeType.AddRange:
case UIListContentsChangeType.InsertRange: case UIListContentsChangeType.InsertRange:
this.InsertRange(masterIndex2, args.Count); InsertRange(masterIndex2, args.Count);
break; break;
case UIListContentsChangeType.Remove: case UIListContentsChangeType.Remove:
this.RemoveAt(masterIndex1); RemoveAt(masterIndex1);
break; break;
case UIListContentsChangeType.Move: case UIListContentsChangeType.Move:
if (masterIndex1 == masterIndex2) if (masterIndex1 == masterIndex2)
break; break;
this.Move(masterIndex1, masterIndex2); Move(masterIndex1, masterIndex2);
break; break;
case UIListContentsChangeType.Modified: case UIListContentsChangeType.Modified:
this.Modified(masterIndex2); Modified(masterIndex2);
break; break;
default: default:
this.Clear(); Clear();
this.Count = this.ItemCount; Count = ItemCount;
break; break;
} }
} }
@@ -148,11 +148,11 @@ namespace Microsoft.Iris
private void DEBUG_ValidateConsistency() private void DEBUG_ValidateConsistency()
{ {
int index1 = 0; int index1 = 0;
for (int index2 = 0; index2 < this._lists.Length; ++index2) for (int index2 = 0; index2 < _lists.Length; ++index2)
{ {
for (int index3 = 0; index3 < this._lists[index2].Count; ++index3) for (int index3 = 0; index3 < _lists[index2].Count; ++index3)
{ {
object obj1 = this._lists[index2][index3]; object obj1 = _lists[index2][index3];
object obj2 = this[index1]; object obj2 = this[index1];
++index1; ++index1;
} }
@@ -162,8 +162,8 @@ namespace Microsoft.Iris
private int ListIndexToMasterIndex(IList list, int index) private int ListIndexToMasterIndex(IList list, int index)
{ {
int num = 0; int num = 0;
for (int index1 = 0; index1 < this._lists.Length && this._lists[index1] != list; ++index1) for (int index1 = 0; index1 < _lists.Length && _lists[index1] != list; ++index1)
num += this._lists[index1].Count; num += _lists[index1].Count;
return num + index; return num + index;
} }
@@ -172,9 +172,9 @@ namespace Microsoft.Iris
int num = 0; int num = 0;
int index1 = 0; int index1 = 0;
list = null; list = null;
for (; index1 < this._lists.Length; ++index1) for (; index1 < _lists.Length; ++index1)
{ {
list = this._lists[index1]; list = _lists[index1];
if (num + list.Count <= masterIndex) if (num + list.Count <= masterIndex)
num += list.Count; num += list.Count;
else else
@@ -188,7 +188,7 @@ namespace Microsoft.Iris
get get
{ {
int num = 0; int num = 0;
foreach (IList list in this._lists) foreach (IList list in _lists)
num += list.Count; num += list.Count;
return num; return num;
} }
+57 -57
View File
@@ -27,71 +27,71 @@ namespace Microsoft.Iris.Animations
IAnimatable animatableTarget, IAnimatable animatableTarget,
UISession session) UISession session)
{ {
this._animatableTarget = animatableTarget; _animatableTarget = animatableTarget;
this._session = session; _session = session;
this._template = template_; _template = template_;
this._ready = new Vector<AnimationProxy>(); _ready = new Vector<AnimationProxy>();
} }
protected override void OnDispose() protected override void OnDispose()
{ {
base.OnDispose(); base.OnDispose();
Vector<AnimationProxy> animationCollection = this.GetAnimationCollection(); Vector<AnimationProxy> animationCollection = GetAnimationCollection();
if (animationCollection != null) if (animationCollection != null)
{ {
foreach (DisposableObject disposableObject in animationCollection) foreach (DisposableObject disposableObject in animationCollection)
disposableObject.Dispose(this); disposableObject.Dispose(this);
this.FireComplete(false); FireComplete(false);
} }
this._session = null; _session = null;
this._animatableTarget = null; _animatableTarget = null;
this._template = null; _template = null;
this._ready = null; _ready = null;
} }
public UISession Session => this._session; public UISession Session => _session;
internal IAnimatable Target => this._animatableTarget; internal IAnimatable Target => _animatableTarget;
public AnimationTemplate Template => this._template; public AnimationTemplate Template => _template;
public bool Playing => this._playing != null; public bool Playing => _playing != null;
internal Vector<AnimationProxy> PendingProxies => this._ready; internal Vector<AnimationProxy> PendingProxies => _ready;
public void Play() public void Play()
{ {
Vector<AnimationProxy> ready = this._ready; Vector<AnimationProxy> ready = _ready;
this._ready = null; _ready = null;
if (ready.Count > 0) if (ready.Count > 0)
{ {
foreach (AnimationProxy animationProxy in ready) foreach (AnimationProxy animationProxy in ready)
animationProxy.Play(); animationProxy.Play();
this._playing = ready; _playing = ready;
this.FireStart(); FireStart();
} }
else else
{ {
this.FireStart(); FireStart();
this.FireComplete(true); FireComplete(true);
} }
} }
public void Stop() => this.Stop(null); public void Stop() => Stop(null);
public void Stop(StopCommandSet stopSetCommand) public void Stop(StopCommandSet stopSetCommand)
{ {
if (UIDispatcher.IsUIThread) if (UIDispatcher.IsUIThread)
{ {
this.StopWorker(stopSetCommand); StopWorker(stopSetCommand);
} }
else else
{ {
try try
{ {
if (!this.Session.IsValid) if (!Session.IsValid)
return; return;
DeferredCall.Post(DispatchPriority.High, new DeferredHandler(this.DeferredStop), stopSetCommand); DeferredCall.Post(DispatchPriority.High, new DeferredHandler(DeferredStop), stopSetCommand);
} }
catch (InvalidOperationException ex) catch (InvalidOperationException ex)
{ {
@@ -101,9 +101,9 @@ namespace Microsoft.Iris.Animations
private void StopWorker(StopCommandSet stopSetCommand) private void StopWorker(StopCommandSet stopSetCommand)
{ {
if (this._playing == null) if (_playing == null)
return; return;
foreach (AnimationProxy animationProxy in this._playing) foreach (AnimationProxy animationProxy in _playing)
{ {
if (stopSetCommand != null) if (stopSetCommand != null)
animationProxy.Stop(stopSetCommand[animationProxy.Type]); animationProxy.Stop(stopSetCommand[animationProxy.Type]);
@@ -112,11 +112,11 @@ namespace Microsoft.Iris.Animations
} }
} }
private void DeferredStop(object args) => this.StopWorker((StopCommandSet)args); private void DeferredStop(object args) => StopWorker((StopCommandSet)args);
public bool ValidatePlayable() public bool ValidatePlayable()
{ {
foreach (AnimationProxy animationProxy in this._ready) foreach (AnimationProxy animationProxy in _ready)
{ {
if (!animationProxy.ValidatePlayable()) if (!animationProxy.ValidatePlayable())
return false; return false;
@@ -127,38 +127,38 @@ namespace Microsoft.Iris.Animations
internal void OnAttachChildAnimation(AnimationProxy child) internal void OnAttachChildAnimation(AnimationProxy child)
{ {
child.DeclareOwner(this); child.DeclareOwner(this);
this._ready.Add(child); _ready.Add(child);
} }
private Vector<AnimationProxy> GetAnimationCollection() => this._ready ?? this._playing; private Vector<AnimationProxy> GetAnimationCollection() => _ready ?? _playing;
internal void OnDetachChildAnimation(AnimationProxy child, float progress) internal void OnDetachChildAnimation(AnimationProxy child, float progress)
{ {
Vector<AnimationProxy> animationCollection = this.GetAnimationCollection(); Vector<AnimationProxy> animationCollection = GetAnimationCollection();
if (animationCollection == null) if (animationCollection == null)
return; return;
animationCollection.Remove(child); animationCollection.Remove(child);
child.Dispose(this); child.Dispose(this);
if (_lastProgress < (double)progress) if (_lastProgress < (double)progress)
this._lastProgress = progress; _lastProgress = progress;
if (animationCollection != this._playing || animationCollection.Count != 0) if (animationCollection != _playing || animationCollection.Count != 0)
return; return;
this.FireComplete(true); FireComplete(true);
} }
private void FireStart() => this.OnStart(); private void FireStart() => OnStart();
private void FireComplete(bool notify) private void FireComplete(bool notify)
{ {
if (this._playing != null) if (_playing != null)
this._playing = null; _playing = null;
this.OnStop(this._lastProgress, notify); OnStop(_lastProgress, notify);
} }
public StopCommandSet GetStopCommandSet() public StopCommandSet GetStopCommandSet()
{ {
StopCommandSet stopCommandSet = null; StopCommandSet stopCommandSet = null;
foreach (AnimationProxy animation in this.GetAnimationCollection()) foreach (AnimationProxy animation in GetAnimationCollection())
{ {
if (animation.HasDynamicKeyframes) if (animation.HasDynamicKeyframes)
{ {
@@ -172,7 +172,7 @@ namespace Microsoft.Iris.Animations
public ActiveTransitions GetActiveTransitions() public ActiveTransitions GetActiveTransitions()
{ {
Vector<AnimationProxy> animationCollection = this.GetAnimationCollection(); Vector<AnimationProxy> animationCollection = GetAnimationCollection();
ActiveTransitions activeTransitions = ActiveTransitions.None; ActiveTransitions activeTransitions = ActiveTransitions.None;
foreach (AnimationProxy animationProxy in animationCollection) foreach (AnimationProxy animationProxy in animationCollection)
{ {
@@ -251,24 +251,24 @@ namespace Microsoft.Iris.Animations
{ {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("{ActiveSequence Template=\""); stringBuilder.Append("{ActiveSequence Template=\"");
if (this._template.DebugID != null) if (_template.DebugID != null)
{ {
stringBuilder.Append(this._template.DebugID); stringBuilder.Append(_template.DebugID);
} }
else else
{ {
Animation template = this._template as Animation; Animation template = _template as Animation;
if (template != null) if (template != null)
stringBuilder.Append(template.Type); stringBuilder.Append(template.Type);
else else
stringBuilder.Append("<Unknown>"); stringBuilder.Append("<Unknown>");
} }
stringBuilder.Append("\", Target="); stringBuilder.Append("\", Target=");
stringBuilder.Append(this._animatableTarget.GetType().Name); stringBuilder.Append(_animatableTarget.GetType().Name);
if (this._animatableTarget is IVisual) if (_animatableTarget is IVisual)
{ {
stringBuilder.Append(", IVisual="); stringBuilder.Append(", IVisual=");
stringBuilder.Append(((IVisual)this._animatableTarget).DebugID); stringBuilder.Append(((IVisual)_animatableTarget).DebugID);
} }
stringBuilder.Append("}"); stringBuilder.Append("}");
return stringBuilder.ToString(); return stringBuilder.ToString();
@@ -282,27 +282,27 @@ namespace Microsoft.Iris.Animations
internal void OnStart() internal void OnStart()
{ {
++this._playingCount; ++_playingCount;
if (this._playingCount != 1 || this.AnimationStarted == null) if (_playingCount != 1 || AnimationStarted == null)
return; return;
this.AnimationStarted(this, EventArgs.Empty); AnimationStarted(this, EventArgs.Empty);
} }
internal void OnStop(float progress, bool notify) internal void OnStop(float progress, bool notify)
{ {
--this._playingCount; --_playingCount;
if (notify && this._playingCount == 0) if (notify && _playingCount == 0)
{ {
EventArgs e = new AnimationCompleteArgs(progress); EventArgs e = new AnimationCompleteArgs(progress);
if (this.AnimationCompleted != null) if (AnimationCompleted != null)
this.AnimationCompleted(this, e); AnimationCompleted(this, e);
if (this.AfterAnimationCompleted == null) if (AfterAnimationCompleted == null)
return; return;
this.AfterAnimationCompleted(this, e); AfterAnimationCompleted(this, e);
} }
else else
{ {
int playingCount = this._playingCount; int playingCount = _playingCount;
} }
} }
} }
@@ -18,17 +18,17 @@ namespace Microsoft.Iris.Animations
float baseValue, float baseValue,
ref AnimationArgs args) ref AnimationArgs args)
{ {
return this.RelativeTo == RelativeTo.Final ? baseValue * args.NewAlpha : baseValue; return RelativeTo == RelativeTo.Final ? baseValue * args.NewAlpha : baseValue;
} }
public override void Apply(IAnimatableOwner animationTarget, float value) => ((ViewItem)animationTarget).VisualAlpha = value; public override void Apply(IAnimatableOwner animationTarget, float value) => ((ViewItem)animationTarget).VisualAlpha = value;
public override void MagnifyValue(float magnifyValue) public override void MagnifyValue(float magnifyValue)
{ {
float num = this.Value * magnifyValue; float num = Value * magnifyValue;
if (num > 1.0) if (num > 1.0)
num = 1f; num = 1f;
this.Value = num; Value = num;
} }
} }
} }
+40 -40
View File
@@ -24,15 +24,15 @@ namespace Microsoft.Iris.Animations
public Animation() public Animation()
{ {
this._type = AnimationEventType.Idle; _type = AnimationEventType.Idle;
this._bitsBitVector = new BitVector32(); _bitsBitVector = new BitVector32();
this._dataMap = new DynamicData(); _dataMap = new DynamicData();
} }
public override object Clone() public override object Clone()
{ {
Animation animation = new Animation(); Animation animation = new Animation();
this.CloneWorker(animation); CloneWorker(animation);
return animation; return animation;
} }
@@ -40,64 +40,64 @@ namespace Microsoft.Iris.Animations
{ {
base.CloneWorker(rawAnimation); base.CloneWorker(rawAnimation);
Animation animation = (Animation)rawAnimation; Animation animation = (Animation)rawAnimation;
animation.Type = this.Type; animation.Type = Type;
if (this.GetBit(Bits.CenterPointScale)) if (GetBit(Bits.CenterPointScale))
animation.CenterPointPercent = this.CenterPointPercent; animation.CenterPointPercent = CenterPointPercent;
if (this.GetBit(Bits.RotationAxis)) if (GetBit(Bits.RotationAxis))
animation.RotationAxis = this.RotationAxis; animation.RotationAxis = RotationAxis;
animation.DisableMouseInput = this.DisableMouseInput; animation.DisableMouseInput = DisableMouseInput;
} }
private void PrepareToPlay(ref AnimationArgs args) private void PrepareToPlay(ref AnimationArgs args)
{ {
if (this.GetBit(Bits.CenterPointScale)) if (GetBit(Bits.CenterPointScale))
args.ViewItem.VisualCenterPoint = this.CenterPointPercent; args.ViewItem.VisualCenterPoint = CenterPointPercent;
if (!this.GetBit(Bits.RotationAxis)) if (!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, RotationAxis);
} }
public AnimationEventType Type public AnimationEventType Type
{ {
get => this._type; get => _type;
set => this._type = value; set => _type = value;
} }
public Vector3 CenterPointPercent public Vector3 CenterPointPercent
{ {
get => !this.GetBit(Bits.CenterPointScale) ? Vector3.Zero : (Vector3)this.GetData(s_centerPointScaleProperty); get => !GetBit(Bits.CenterPointScale) ? Vector3.Zero : (Vector3)GetData(s_centerPointScaleProperty);
set set
{ {
if (!(this.CenterPointPercent != value)) if (!(CenterPointPercent != value))
return; return;
this.SetData(s_centerPointScaleProperty, value); SetData(s_centerPointScaleProperty, value);
this.SetBit(Bits.CenterPointScale, true); SetBit(Bits.CenterPointScale, true);
} }
} }
public Vector3 RotationAxis public Vector3 RotationAxis
{ {
get => !this.GetBit(Bits.RotationAxis) ? Rotation.Default.Axis : (Vector3)this.GetData(s_rotationAxisProperty); get => !GetBit(Bits.RotationAxis) ? Rotation.Default.Axis : (Vector3)GetData(s_rotationAxisProperty);
set set
{ {
if (!(this.RotationAxis != value)) if (!(RotationAxis != value))
return; return;
this.SetData(s_rotationAxisProperty, value); SetData(s_rotationAxisProperty, value);
this.SetBit(Bits.RotationAxis, true); SetBit(Bits.RotationAxis, true);
} }
} }
public bool DisableMouseInput public bool DisableMouseInput
{ {
get => this.GetBit(Bits.DisableMouseInput); get => GetBit(Bits.DisableMouseInput);
set => this.SetBit(Bits.DisableMouseInput, value); set => SetBit(Bits.DisableMouseInput, value);
} }
AnimationTemplate IAnimationProvider.Build( AnimationTemplate IAnimationProvider.Build(
ref AnimationArgs args) ref AnimationArgs args)
{ {
this.PrepareToPlay(ref args); PrepareToPlay(ref args);
return this; return this;
} }
@@ -107,38 +107,38 @@ namespace Microsoft.Iris.Animations
{ {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("{AnimationTemplate ID="); stringBuilder.Append("{AnimationTemplate ID=");
stringBuilder.Append(this.DebugID); stringBuilder.Append(DebugID);
stringBuilder.Append(", Loop="); stringBuilder.Append(", Loop=");
stringBuilder.Append(this.Loop); stringBuilder.Append(Loop);
stringBuilder.Append(", KeyframeCount="); stringBuilder.Append(", KeyframeCount=");
stringBuilder.Append(this.Keyframes.Count); stringBuilder.Append(Keyframes.Count);
stringBuilder.Append("}"); stringBuilder.Append("}");
return stringBuilder.ToString(); return stringBuilder.ToString();
} }
private bool GetBit(Animation.Bits bit) => this._bitsBitVector[(int)bit]; private bool GetBit(Animation.Bits bit) => _bitsBitVector[(int)bit];
private void SetBit(Animation.Bits bit, bool value) => this._bitsBitVector[(int)bit] = value; private void SetBit(Animation.Bits bit, bool value) => _bitsBitVector[(int)bit] = value;
private bool ChangeBit(Animation.Bits bit, bool value) private bool ChangeBit(Animation.Bits bit, bool value)
{ {
if (this._bitsBitVector[(int)bit] == value) if (_bitsBitVector[(int)bit] == value)
return false; return false;
this._bitsBitVector[(int)bit] = value; _bitsBitVector[(int)bit] = value;
return true; return true;
} }
protected object GetData(DataCookie cookie) => this._dataMap.GetData(cookie); protected object GetData(DataCookie cookie) => _dataMap.GetData(cookie);
protected void SetData(DataCookie cookie, object value) => this._dataMap.SetData(cookie, value); protected void SetData(DataCookie cookie, object value) => _dataMap.SetData(cookie, value);
protected Delegate GetEventHandler(EventCookie cookie) => this._dataMap.GetEventHandler(cookie); protected Delegate GetEventHandler(EventCookie cookie) => _dataMap.GetEventHandler(cookie);
protected void AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => this._dataMap.AddEventHandler(cookie, handlerToAdd); protected void AddEventHandler(EventCookie cookie, Delegate handlerToAdd) => _dataMap.AddEventHandler(cookie, handlerToAdd);
protected void RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => this._dataMap.RemoveEventHandler(cookie, handlerToRemove); protected void RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove) => _dataMap.RemoveEventHandler(cookie, handlerToRemove);
protected void RemoveEventHandlers(EventCookie cookie) => this._dataMap.RemoveEventHandlers(cookie); protected void RemoveEventHandlers(EventCookie cookie) => _dataMap.RemoveEventHandlers(cookie);
private static uint GetKey(EventCookie cookie) => EventCookie.ToUInt32(cookie); private static uint GetKey(EventCookie cookie) => EventCookie.ToUInt32(cookie);
+38 -38
View File
@@ -34,25 +34,25 @@ namespace Microsoft.Iris.Animations
public AnimationArgs(Camera cam) public AnimationArgs(Camera cam)
{ {
this.ViewItem = null; ViewItem = null;
this.OldPosition = Vector3.Zero; OldPosition = Vector3.Zero;
this.OldSize = Vector2.Zero; OldSize = Vector2.Zero;
this.OldScale = Vector3.Zero; OldScale = Vector3.Zero;
this.OldRotation = Rotation.Default; OldRotation = Rotation.Default;
this.OldAlpha = 0.0f; OldAlpha = 0.0f;
this.NewPosition = Vector3.Zero; NewPosition = Vector3.Zero;
this.NewSize = Vector2.Zero; NewSize = Vector2.Zero;
this.NewScale = Vector3.Zero; NewScale = Vector3.Zero;
this.NewRotation = Rotation.Default; NewRotation = Rotation.Default;
this.NewAlpha = 0.0f; NewAlpha = 0.0f;
this.OldEye = cam.Eye; OldEye = cam.Eye;
this.NewEye = cam.Eye; NewEye = cam.Eye;
this.OldAt = cam.At; OldAt = cam.At;
this.NewAt = cam.At; NewAt = cam.At;
this.OldUp = cam.Up; OldUp = cam.Up;
this.NewUp = cam.Up; NewUp = cam.Up;
this.OldZn = cam.Zn; OldZn = cam.Zn;
this.NewZn = cam.Zn; NewZn = cam.Zn;
} }
public AnimationArgs( public AnimationArgs(
@@ -68,25 +68,25 @@ namespace Microsoft.Iris.Animations
Rotation newRotation, Rotation newRotation,
float newAlpha) float newAlpha)
{ {
this.ViewItem = vi; ViewItem = vi;
this.OldPosition = oldPosition; OldPosition = oldPosition;
this.OldSize = oldSize; OldSize = oldSize;
this.OldScale = oldScale; OldScale = oldScale;
this.OldRotation = oldRotation; OldRotation = oldRotation;
this.OldAlpha = oldAlpha; OldAlpha = oldAlpha;
this.NewPosition = newPosition; NewPosition = newPosition;
this.NewSize = newSize; NewSize = newSize;
this.NewScale = newScale; NewScale = newScale;
this.NewRotation = newRotation; NewRotation = newRotation;
this.NewAlpha = newAlpha; NewAlpha = newAlpha;
this.OldEye = Vector3.Zero; OldEye = Vector3.Zero;
this.NewEye = Vector3.Zero; NewEye = Vector3.Zero;
this.OldAt = Vector3.Zero; OldAt = Vector3.Zero;
this.NewAt = Vector3.Zero; NewAt = Vector3.Zero;
this.OldUp = Vector3.Zero; OldUp = Vector3.Zero;
this.NewUp = Vector3.Zero; NewUp = Vector3.Zero;
this.OldZn = 0.0f; OldZn = 0.0f;
this.NewZn = 0.0f; NewZn = 0.0f;
} }
public AnimationArgs( public AnimationArgs(
@@ -12,8 +12,8 @@ namespace Microsoft.Iris.Animations
{ {
private float _progress; private float _progress;
public AnimationCompleteArgs(float progress) => this._progress = progress; public AnimationCompleteArgs(float progress) => _progress = progress;
public float Progress => this._progress; public float Progress => _progress;
} }
} }
@@ -16,32 +16,32 @@ namespace Microsoft.Iris.Animations
public event EventHandler Completed; public event EventHandler Completed;
public bool Playing => this._playing > 0; public bool Playing => _playing > 0;
internal void AssociateWithAnimationInstance(ActiveSequence anim) internal void AssociateWithAnimationInstance(ActiveSequence anim)
{ {
anim.AnimationCompleted += new EventHandler(this.OnAnimationCompleted); anim.AnimationCompleted += new EventHandler(OnAnimationCompleted);
++this._playing; ++_playing;
if (this._playing != 1) if (_playing != 1)
return; return;
this.FireNotification(NotificationID.Playing); FireNotification(NotificationID.Playing);
} }
internal void FireCompleted() internal void FireCompleted()
{ {
if (this.Completed != null) if (Completed != null)
this.Completed(this, EventArgs.Empty); Completed(this, EventArgs.Empty);
this.FireNotification(NotificationID.Completed); FireNotification(NotificationID.Completed);
} }
private void OnAnimationCompleted(object sender, EventArgs args) private void OnAnimationCompleted(object sender, EventArgs args)
{ {
((ActiveSequence)sender).AnimationCompleted -= new EventHandler(this.OnAnimationCompleted); ((ActiveSequence)sender).AnimationCompleted -= new EventHandler(OnAnimationCompleted);
--this._playing; --_playing;
if (this._playing != 0) if (_playing != 0)
return; return;
this.FireNotification(NotificationID.Playing); FireNotification(NotificationID.Playing);
this.FireCompleted(); FireCompleted();
} }
} }
} }
@@ -32,49 +32,49 @@ namespace Microsoft.Iris.Animations
public AnimationManager(IRenderSession session) public AnimationManager(IRenderSession session)
{ {
this._session = session; _session = session;
this._orphans = new Vector<OrphanedVisualCollection>(); _orphans = new Vector<OrphanedVisualCollection>();
this._session.AnimationSystem.UpdatesPerSecond = session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi ? 0 : 3; _session.AnimationSystem.UpdatesPerSecond = session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi ? 0 : 3;
this._session.AnimationSystem.BackCompat = true; _session.AnimationSystem.BackCompat = true;
} }
~AnimationManager() => this.Dispose(false); ~AnimationManager() => Dispose(false);
public void Dispose() public void Dispose()
{ {
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
this.Dispose(true); Dispose(true);
} }
protected virtual void Dispose(bool inDisposeFlag) protected virtual void Dispose(bool inDisposeFlag)
{ {
this._shuttingDown = true; _shuttingDown = true;
if (!inDisposeFlag) if (!inDisposeFlag)
return; return;
foreach (DisposableObject orphan in this._orphans) foreach (DisposableObject orphan in _orphans)
orphan.Dispose(this); orphan.Dispose(this);
this._orphans.Clear(); _orphans.Clear();
} }
internal bool ShuttingDown => this._shuttingDown; internal bool ShuttingDown => _shuttingDown;
public void SetGlobalSpeedAdjustment(float value) public void SetGlobalSpeedAdjustment(float value)
{ {
this.ValidateConnected(); ValidateConnected();
this._session.AnimationSystem.SpeedAdjustment = value; _session.AnimationSystem.SpeedAdjustment = value;
} }
public void PulseTimeAdvance(int pulseSize) public void PulseTimeAdvance(int pulseSize)
{ {
this.ValidateConnected(); ValidateConnected();
this._session.AnimationSystem.PulseTimeAdvance(pulseSize); _session.AnimationSystem.PulseTimeAdvance(pulseSize);
} }
public void RegisterAnimatedOrphans(OrphanedVisualCollection orphan) => this._orphans.Add(orphan); public void RegisterAnimatedOrphans(OrphanedVisualCollection orphan) => _orphans.Add(orphan);
public void UnregisterAnimatedOrphans(OrphanedVisualCollection orphan) => this._orphans.Remove(orphan); public void UnregisterAnimatedOrphans(OrphanedVisualCollection orphan) => _orphans.Remove(orphan);
public bool CanPlayAnimationType(AnimationType type) => this._session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi || type == AnimationType.Position || (type == AnimationType.Size || type == AnimationType.Scale) || type == AnimationType.Alpha; public bool CanPlayAnimationType(AnimationType type) => _session.GraphicsDevice.DeviceType != GraphicsDeviceType.Gdi || type == AnimationType.Position || (type == AnimationType.Size || type == AnimationType.Scale) || type == AnimationType.Alpha;
private void ValidateConnected() private void ValidateConnected()
{ {
@@ -82,27 +82,27 @@ namespace Microsoft.Iris.Animations
internal IKeyframeAnimation BuildAnimation(AnimationProxy owner) internal IKeyframeAnimation BuildAnimation(AnimationProxy owner)
{ {
this.ValidateConnected(); ValidateConnected();
IKeyframeAnimation keyframeAnimation = null; IKeyframeAnimation keyframeAnimation = null;
switch (owner.Type) switch (owner.Type)
{ {
case AnimationType.Position: case AnimationType.Position:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultPositionInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultPositionInput);
break; break;
case AnimationType.Size: case AnimationType.Size:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultSizeInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultSizeInput);
break; break;
case AnimationType.Alpha: case AnimationType.Alpha:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultAlphaInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultAlphaInput);
break; break;
case AnimationType.Scale: case AnimationType.Scale:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultScaleInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultScaleInput);
break; break;
case AnimationType.Rotate: case AnimationType.Rotate:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultRotationInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultRotationInput);
break; break;
case AnimationType.Orientation: case AnimationType.Orientation:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultOrientationInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultOrientationInput);
break; break;
case AnimationType.PositionX: case AnimationType.PositionX:
case AnimationType.PositionY: case AnimationType.PositionY:
@@ -111,28 +111,28 @@ namespace Microsoft.Iris.Animations
case AnimationType.ScaleX: case AnimationType.ScaleX:
case AnimationType.ScaleY: case AnimationType.ScaleY:
case AnimationType.Float: case AnimationType.Float:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultFloatInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultFloatInput);
break; break;
case AnimationType.Vector2: case AnimationType.Vector2:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector2Input); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector2Input);
break; break;
case AnimationType.Vector3: case AnimationType.Vector3:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector3Input); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector3Input);
break; break;
case AnimationType.Vector4: case AnimationType.Vector4:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector4Input); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultVector4Input);
break; break;
case AnimationType.CameraEye: case AnimationType.CameraEye:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraEyeInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraEyeInput);
break; break;
case AnimationType.CameraAt: case AnimationType.CameraAt:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraAtInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraAtInput);
break; break;
case AnimationType.CameraUp: case AnimationType.CameraUp:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraUpInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraUpInput);
break; break;
case AnimationType.CameraZn: case AnimationType.CameraZn:
keyframeAnimation = this._session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraZnInput); keyframeAnimation = _session.AnimationSystem.CreateKeyframeAnimation(owner, s_defaultCameraZnInput);
break; break;
} }
return keyframeAnimation; return keyframeAnimation;
+71 -71
View File
@@ -34,50 +34,50 @@ namespace Microsoft.Iris.Animations
{ {
UISession.Validate(activeSequence.Session); UISession.Validate(activeSequence.Session);
AnimationSystem.ValidateAnimationType(createType); AnimationSystem.ValidateAnimationType(createType);
this._activeSequence = activeSequence; _activeSequence = activeSequence;
this._type = createType; _type = createType;
this._animatableTarget = animatableTarget; _animatableTarget = animatableTarget;
this._rendererProperty = rendererProperty; _rendererProperty = rendererProperty;
this._animation = this._activeSequence.Session.AnimationManager.BuildAnimation(this); _animation = _activeSequence.Session.AnimationManager.BuildAnimation(this);
this.CommonCreate(loopCount, stopCmd); CommonCreate(loopCount, stopCmd);
} }
private void CommonCreate(int loopCount, StopCommand stopCmd) private void CommonCreate(int loopCount, StopCommand stopCmd)
{ {
this._animation.RepeatCount = loopCount; _animation.RepeatCount = loopCount;
this._animation.AsyncNotifyEvent += new AsyncNotifyHandler(this.OnAsyncNotification); _animation.AsyncNotifyEvent += new AsyncNotifyHandler(OnAsyncNotification);
this._animation.AddStageEvent(AnimationStage.Complete, new AnimationEvent(_animation, "AsyncNotify", 1U)); _animation.AddStageEvent(AnimationStage.Complete, new AnimationEvent(_animation, "AsyncNotify", 1U));
this._animation.AddStageEvent(AnimationStage.Reset, new AnimationEvent(_animation, "AsyncNotify", 2U)); _animation.AddStageEvent(AnimationStage.Reset, new AnimationEvent(_animation, "AsyncNotify", 2U));
this.SetStopCommand(stopCmd); SetStopCommand(stopCmd);
this._activeSequence.OnAttachChildAnimation(this); _activeSequence.OnAttachChildAnimation(this);
} }
protected override void OnDispose() protected override void OnDispose()
{ {
this.CleanupWorker(0.0f, false); CleanupWorker(0.0f, false);
base.OnDispose(); base.OnDispose();
} }
public UISession Session => this._activeSequence.Session; public UISession Session => _activeSequence.Session;
public AnimationType Type => this._type; public AnimationType Type => _type;
public bool HasDynamicKeyframes => this._dynamicFlag; public bool HasDynamicKeyframes => _dynamicFlag;
internal bool DoNotAutoRelease internal bool DoNotAutoRelease
{ {
get => this._doNotAutoReleaseFlag; get => _doNotAutoReleaseFlag;
set => this._doNotAutoReleaseFlag = value; set => _doNotAutoReleaseFlag = value;
} }
public void AddFloatKeyframe(BaseKeyframe keyframe, float value) public void AddFloatKeyframe(BaseKeyframe keyframe, float value)
{ {
++this._keyframesValue; ++_keyframesValue;
AnimationInput animationInput1; AnimationInput animationInput1;
if (keyframe.IsRelativeToObject) if (keyframe.IsRelativeToObject)
{ {
this._dynamicFlag = true; _dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
if (keyframe.Multiply && value != 1.0) if (keyframe.Multiply && value != 1.0)
{ {
AnimationInput animationInput2 = new ConstantAnimationInput(value); AnimationInput animationInput2 = new ConstantAnimationInput(value);
@@ -91,17 +91,17 @@ namespace Microsoft.Iris.Animations
} }
else else
animationInput1 = new ConstantAnimationInput(value); animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
} }
public void AddVector2Keyframe(BaseKeyframe keyframe, Vector2 value) public void AddVector2Keyframe(BaseKeyframe keyframe, Vector2 value)
{ {
++this._keyframesValue; ++_keyframesValue;
AnimationInput animationInput1; AnimationInput animationInput1;
if (keyframe.IsRelativeToObject) if (keyframe.IsRelativeToObject)
{ {
this._dynamicFlag = true; _dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
if (keyframe.Multiply && value != Vector2.UnitVector) if (keyframe.Multiply && value != Vector2.UnitVector)
{ {
AnimationInput animationInput2 = new ConstantAnimationInput(value); AnimationInput animationInput2 = new ConstantAnimationInput(value);
@@ -115,17 +115,17 @@ namespace Microsoft.Iris.Animations
} }
else else
animationInput1 = new ConstantAnimationInput(value); animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
} }
public void AddVector3Keyframe(BaseKeyframe keyframe, Vector3 value) public void AddVector3Keyframe(BaseKeyframe keyframe, Vector3 value)
{ {
++this._keyframesValue; ++_keyframesValue;
AnimationInput animationInput1; AnimationInput animationInput1;
if (keyframe.IsRelativeToObject) if (keyframe.IsRelativeToObject)
{ {
this._dynamicFlag = true; _dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
if (keyframe.Multiply && value != Vector3.UnitVector) if (keyframe.Multiply && value != Vector3.UnitVector)
{ {
AnimationInput animationInput2 = new ConstantAnimationInput(value); AnimationInput animationInput2 = new ConstantAnimationInput(value);
@@ -139,17 +139,17 @@ namespace Microsoft.Iris.Animations
} }
else else
animationInput1 = new ConstantAnimationInput(value); animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
} }
public void AddVector4Keyframe(BaseKeyframe keyframe, Vector4 value) public void AddVector4Keyframe(BaseKeyframe keyframe, Vector4 value)
{ {
++this._keyframesValue; ++_keyframesValue;
AnimationInput animationInput1; AnimationInput animationInput1;
if (keyframe.IsRelativeToObject) if (keyframe.IsRelativeToObject)
{ {
this._dynamicFlag = true; _dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
if (keyframe.Multiply && value != Vector4.UnitVector) if (keyframe.Multiply && value != Vector4.UnitVector)
{ {
AnimationInput animationInput2 = new ConstantAnimationInput(value); AnimationInput animationInput2 = new ConstantAnimationInput(value);
@@ -163,23 +163,23 @@ namespace Microsoft.Iris.Animations
} }
else else
animationInput1 = new ConstantAnimationInput(value); animationInput1 = new ConstantAnimationInput(value);
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation))); _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, GenerateInterpolation(keyframe.Interpolation)));
} }
public void AddRotationKeyframe(BaseKeyframe keyframe, Rotation value) public void AddRotationKeyframe(BaseKeyframe keyframe, Rotation value)
{ {
if (keyframe.Type != AnimationType.Orientation) if (keyframe.Type != AnimationType.Orientation)
{ {
this.AddVector4Keyframe(keyframe, new Vector4(value.Axis.X, value.Axis.Y, value.Axis.Z, value.AngleRadians)); AddVector4Keyframe(keyframe, new Vector4(value.Axis.X, value.Axis.Y, value.Axis.Z, value.AngleRadians));
} }
else else
{ {
++this._keyframesValue; ++_keyframesValue;
AnimationInput animationInput1; AnimationInput animationInput1;
if (keyframe.IsRelativeToObject) if (keyframe.IsRelativeToObject)
{ {
this._dynamicFlag = true; _dynamicFlag = true;
animationInput1 = keyframe.RelativeTo.CreateAnimationInput(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.SourceMask); animationInput1 = keyframe.RelativeTo.CreateAnimationInput(_animatableTarget, _rendererProperty.Property, _rendererProperty.SourceMask);
if (value != Rotation.Default) if (value != Rotation.Default)
{ {
AnimationInput animationInput2 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians)); AnimationInput animationInput2 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians));
@@ -190,7 +190,7 @@ namespace Microsoft.Iris.Animations
animationInput1 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians)); animationInput1 = new ConstantAnimationInput(new Quaternion(value.Axis, value.AngleRadians));
AnimationInterpolation interpolation = GenerateInterpolation(keyframe.Interpolation); AnimationInterpolation interpolation = GenerateInterpolation(keyframe.Interpolation);
interpolation.UseSphericalCombination = true; interpolation.UseSphericalCombination = true;
this._animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, interpolation)); _animation.AddKeyframe(new AnimationKeyframe(keyframe.Time, animationInput1, interpolation));
} }
} }
@@ -199,21 +199,21 @@ namespace Microsoft.Iris.Animations
switch (stopCmd) switch (stopCmd)
{ {
case StopCommand.LeaveCurrent: case StopCommand.LeaveCurrent:
this._animation.ResetBehavior = AnimationResetBehavior.LeaveCurrent; _animation.ResetBehavior = AnimationResetBehavior.LeaveCurrent;
break; break;
case StopCommand.MoveToBegin: case StopCommand.MoveToBegin:
this._animation.ResetBehavior = AnimationResetBehavior.SetInitialValue; _animation.ResetBehavior = AnimationResetBehavior.SetInitialValue;
break; break;
case StopCommand.MoveToEnd: case StopCommand.MoveToEnd:
this._animation.ResetBehavior = AnimationResetBehavior.SetFinalValue; _animation.ResetBehavior = AnimationResetBehavior.SetFinalValue;
break; break;
} }
this._animation.AutoReset = true; _animation.AutoReset = true;
} }
public bool ValidatePlayable() public bool ValidatePlayable()
{ {
if (this._keyframesValue >= 2) if (_keyframesValue >= 2)
return true; return true;
ErrorManager.ReportError("Animations must have at least 2 keyframes to play"); ErrorManager.ReportError("Animations must have at least 2 keyframes to play");
return false; return false;
@@ -221,50 +221,50 @@ namespace Microsoft.Iris.Animations
public void Play() public void Play()
{ {
if (!this.ValidatePlayable()) if (!ValidatePlayable())
return; return;
if (!this._activeSequence.Session.AnimationManager.CanPlayAnimationType(this._type)) if (!_activeSequence.Session.AnimationManager.CanPlayAnimationType(_type))
{ {
this.Cleanup(0.0f, true); Cleanup(0.0f, true);
} }
else else
{ {
if (this._playingFlag || this._animation == null || !this.Session.IsValid) if (_playingFlag || _animation == null || !Session.IsValid)
return; return;
this._animation.AddTarget(this._animatableTarget, this._rendererProperty.Property, this._rendererProperty.TargetMask); _animation.AddTarget(_animatableTarget, _rendererProperty.Property, _rendererProperty.TargetMask);
this._animation.Play(); _animation.Play();
this._playingFlag = true; _playingFlag = true;
} }
} }
public void Stop() => this.StopWorker(false, StopCommand.MoveToEnd); public void Stop() => StopWorker(false, StopCommand.MoveToEnd);
public void Stop(StopCommand stopCommand) => this.StopWorker(true, stopCommand); public void Stop(StopCommand stopCommand) => StopWorker(true, stopCommand);
private void StopWorker(bool stopCommandFlag, StopCommand stopCommand) private void StopWorker(bool stopCommandFlag, StopCommand stopCommand)
{ {
if (!this._playingFlag) if (!_playingFlag)
return; return;
this._playingFlag = false; _playingFlag = false;
if (this._animation == null || !this.Session.IsValid) if (_animation == null || !Session.IsValid)
return; return;
if (stopCommandFlag) if (stopCommandFlag)
this.SetStopCommand(stopCommand); SetStopCommand(stopCommand);
this._animation.Reset(); _animation.Reset();
this._animation.RemoveAllTargets(); _animation.RemoveAllTargets();
} }
private void Cleanup(float progress, bool forceDeferFlag) private void Cleanup(float progress, bool forceDeferFlag)
{ {
if (this._animation == null) if (_animation == null)
return; return;
if (UIDispatcher.IsUIThread && !forceDeferFlag) if (UIDispatcher.IsUIThread && !forceDeferFlag)
{ {
this.CleanupWorker(progress, true); CleanupWorker(progress, true);
} }
else else
{ {
if (!this.Session.IsValid) if (!Session.IsValid)
return; return;
DeferredCall.Post(DispatchPriority.Housekeeping, s_deferredCleanupWorker, this); DeferredCall.Post(DispatchPriority.Housekeeping, s_deferredCleanupWorker, this);
} }
@@ -272,17 +272,17 @@ namespace Microsoft.Iris.Animations
private void CleanupWorker(float progress, bool withNotifications) private void CleanupWorker(float progress, bool withNotifications)
{ {
this._playingFlag = false; _playingFlag = false;
if (this._animation != null) if (_animation != null)
{ {
this._animation.AsyncNotifyEvent -= new AsyncNotifyHandler(this.OnAsyncNotification); _animation.AsyncNotifyEvent -= new AsyncNotifyHandler(OnAsyncNotification);
this._animation.UnregisterUsage(this); _animation.UnregisterUsage(this);
this._animation = null; _animation = null;
} }
this._animatableTarget = null; _animatableTarget = null;
if (!withNotifications) if (!withNotifications)
return; return;
this._activeSequence.OnDetachChildAnimation(this, progress); _activeSequence.OnDetachChildAnimation(this, progress);
} }
private static void DeferredCleanupWorker(object args) => (args as AnimationProxy).CleanupWorker(0.0f, true); private static void DeferredCleanupWorker(object args) => (args as AnimationProxy).CleanupWorker(0.0f, true);
@@ -322,10 +322,10 @@ namespace Microsoft.Iris.Animations
switch (nCookie) switch (nCookie)
{ {
case 1: case 1:
this.Cleanup(0.0f, false); Cleanup(0.0f, false);
break; break;
case 2: case 2:
this.Cleanup(0.0f, false); Cleanup(0.0f, false);
break; break;
} }
} }
@@ -29,28 +29,28 @@ namespace Microsoft.Iris.Animations
public AnimationTemplate(string debugIDName) public AnimationTemplate(string debugIDName)
{ {
this._keyframesList = new List<BaseKeyframe>(); _keyframesList = new List<BaseKeyframe>();
this.DebugID = debugIDName; DebugID = debugIDName;
} }
public string DebugID public string DebugID
{ {
get => this._debugIDName; get => _debugIDName;
set => this._debugIDName = value; set => _debugIDName = value;
} }
public int Loop public int Loop
{ {
get => this._loopCount; get => _loopCount;
set => this._loopCount = value; set => _loopCount = value;
} }
public List<BaseKeyframe> Keyframes => this._keyframesList; public List<BaseKeyframe> Keyframes => _keyframesList;
public ActiveSequence Play(ViewItem vi) public ActiveSequence Play(ViewItem vi)
{ {
AnimationArgs args = new AnimationArgs(vi); AnimationArgs args = new AnimationArgs(vi);
return this.Play(vi.RendererVisual, ref args, null); return Play(vi.RendererVisual, ref args, null);
} }
public ActiveSequence Play( public ActiveSequence Play(
@@ -58,7 +58,7 @@ namespace Microsoft.Iris.Animations
ref AnimationArgs args, ref AnimationArgs args,
EventHandler onCompleteHandler) EventHandler onCompleteHandler)
{ {
ActiveSequence instance = this.CreateInstance(visualTarget, ref args); ActiveSequence instance = CreateInstance(visualTarget, ref args);
if (onCompleteHandler != null) if (onCompleteHandler != null)
instance.AnimationCompleted += onCompleteHandler; instance.AnimationCompleted += onCompleteHandler;
instance.Play(); instance.Play();
@@ -70,7 +70,7 @@ namespace Microsoft.Iris.Animations
string property, string property,
ref AnimationArgs args) ref AnimationArgs args)
{ {
if (this._keyframesList.Count == 0) if (_keyframesList.Count == 0)
{ {
ErrorManager.ReportError("Animations must have at least 2 keyframes to play"); ErrorManager.ReportError("Animations must have at least 2 keyframes to play");
return null; return null;
@@ -79,7 +79,7 @@ namespace Microsoft.Iris.Animations
AnimationProxy[] animationProxyArray = new AnimationProxy[20]; AnimationProxy[] animationProxyArray = new AnimationProxy[20];
int[] numArray = new int[20]; int[] numArray = new int[20];
bool[] flagArray = new bool[20]; bool[] flagArray = new bool[20];
foreach (BaseKeyframe keyframes in this._keyframesList) foreach (BaseKeyframe keyframes in _keyframesList)
{ {
int type = (int)keyframes.Type; int type = (int)keyframes.Type;
keyframes.AddtoAnimation(this, aseq, property, ref args, ref animationProxyArray[type]); keyframes.AddtoAnimation(this, aseq, property, ref args, ref animationProxyArray[type]);
@@ -110,17 +110,17 @@ namespace Microsoft.Iris.Animations
IAnimatable animatableTarget, IAnimatable animatableTarget,
ref AnimationArgs args) ref AnimationArgs args)
{ {
return this.CreateInstance(animatableTarget, null, ref args); return CreateInstance(animatableTarget, null, ref args);
} }
public void AddKeyframe(BaseKeyframe key) => this.InsertSorted(key); public void AddKeyframe(BaseKeyframe key) => InsertSorted(key);
public BaseKeyframe GetKeyframe(float time) public BaseKeyframe GetKeyframe(float time)
{ {
int count = this._keyframesList.Count; int count = _keyframesList.Count;
for (int index = 0; index < count; ++index) for (int index = 0; index < count; ++index)
{ {
BaseKeyframe keyframes = this._keyframesList[index]; BaseKeyframe keyframes = _keyframesList[index];
if (IsSameTime(time, keyframes.Time)) if (IsSameTime(time, keyframes.Time))
return keyframes; return keyframes;
} }
@@ -129,58 +129,58 @@ namespace Microsoft.Iris.Animations
public void RemoveKeyframe(float time) public void RemoveKeyframe(float time)
{ {
BaseKeyframe keyframe = this.GetKeyframe(time); BaseKeyframe keyframe = GetKeyframe(time);
if (keyframe == null) if (keyframe == null)
return; return;
this._keyframesList.Remove(keyframe); _keyframesList.Remove(keyframe);
} }
public StopCommand GetStopCommand(AnimationType paramType) public StopCommand GetStopCommand(AnimationType paramType)
{ {
AnimationSystem.ValidateAnimationType(paramType); AnimationSystem.ValidateAnimationType(paramType);
StopCommand stopCommand = StopCommand.MoveToEnd; StopCommand stopCommand = StopCommand.MoveToEnd;
if (this._StopCommandSet != null) if (_StopCommandSet != null)
stopCommand = this._StopCommandSet[paramType]; stopCommand = _StopCommandSet[paramType];
return stopCommand; return stopCommand;
} }
public void SetStopCommand(AnimationType paramType, StopCommand command) public void SetStopCommand(AnimationType paramType, StopCommand command)
{ {
AnimationSystem.ValidateAnimationType(paramType); AnimationSystem.ValidateAnimationType(paramType);
if (this._StopCommandSet == null) if (_StopCommandSet == null)
this._StopCommandSet = new StopCommandSet(StopCommand.MoveToEnd); _StopCommandSet = new StopCommandSet(StopCommand.MoveToEnd);
this._StopCommandSet[paramType] = command; _StopCommandSet[paramType] = command;
} }
object ICloneable.Clone() => this.Clone(); object ICloneable.Clone() => Clone();
public virtual object Clone() public virtual object Clone()
{ {
AnimationTemplate anim = new AnimationTemplate(this._debugIDName); AnimationTemplate anim = new AnimationTemplate(_debugIDName);
this.CloneWorker(anim); CloneWorker(anim);
return anim; return anim;
} }
protected virtual void CloneWorker(AnimationTemplate anim) protected virtual void CloneWorker(AnimationTemplate anim)
{ {
anim._loopCount = this._loopCount; anim._loopCount = _loopCount;
int count = this._keyframesList.Count; int count = _keyframesList.Count;
for (int index = 0; index < count; ++index) for (int index = 0; index < count; ++index)
anim._keyframesList.Add(this._keyframesList[index].Clone()); anim._keyframesList.Add(_keyframesList[index].Clone());
anim._debugIDName = this._debugIDName; anim._debugIDName = _debugIDName;
} }
private void InsertSorted(BaseKeyframe key) private void InsertSorted(BaseKeyframe key)
{ {
for (int index = this._keyframesList.Count - 1; index >= 0; --index) for (int index = _keyframesList.Count - 1; index >= 0; --index)
{ {
if (_keyframesList[index].Time < (double)key.Time) if (_keyframesList[index].Time < (double)key.Time)
{ {
this._keyframesList.Insert(index + 1, key); _keyframesList.Insert(index + 1, key);
return; return;
} }
} }
this._keyframesList.Insert(0, key); _keyframesList.Insert(0, key);
} }
private static bool IsSameTime(float t1, float t2) private static bool IsSameTime(float t1, float t2)
@@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations
AnimationProxy animation, AnimationProxy animation,
ref AnimationArgs args) ref AnimationArgs args)
{ {
float effectiveValue = this.GetEffectiveValue(targetObject, this._value, ref args); float effectiveValue = GetEffectiveValue(targetObject, _value, ref args);
animation.AddFloatKeyframe(this, effectiveValue); animation.AddFloatKeyframe(this, effectiveValue);
} }
public float Value public float Value
{ {
get => this._value; get => _value;
set => this._value = value; set => _value = value;
} }
public override object ObjectValue => Value; public override object ObjectValue => Value;
@@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args) public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
{ {
float effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._value, ref args); float effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _value, ref args);
this.Apply(animationTarget, effectiveValue); Apply(animationTarget, effectiveValue);
} }
public abstract void Apply(IAnimatableOwner animationTarget, float value); public abstract void Apply(IAnimatableOwner animationTarget, float value);
public override void MagnifyValue(float magnifyValue) => this.Value *= magnifyValue; public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue;
} }
} }
+22 -22
View File
@@ -44,8 +44,8 @@ namespace Microsoft.Iris.Animations
public BaseKeyframe(float timeValue) public BaseKeyframe(float timeValue)
{ {
this._timeValue = timeValue; _timeValue = timeValue;
this._relative = RelativeTo.Final; _relative = RelativeTo.Final;
} }
public void AddtoAnimation( public void AddtoAnimation(
@@ -56,8 +56,8 @@ namespace Microsoft.Iris.Animations
ref AnimationProxy animation) ref AnimationProxy animation)
{ {
if (animation == null) if (animation == null)
animation = this.CreateProxy(anim, aseq, property); animation = CreateProxy(anim, aseq, property);
this.PopulateAnimationWorker(aseq.Target, animation, ref args); PopulateAnimationWorker(aseq.Target, animation, ref args);
} }
protected virtual AnimationProxy CreateProxy( protected virtual AnimationProxy CreateProxy(
@@ -65,14 +65,14 @@ namespace Microsoft.Iris.Animations
ActiveSequence aseq, ActiveSequence aseq,
string property) string property)
{ {
StopCommand stopCommand = anim.GetStopCommand(this.Type); StopCommand stopCommand = anim.GetStopCommand(Type);
RendererProperty rendererProperty = property != null ? new RendererProperty(property) : s_propertyMap[(int)this.Type]; RendererProperty rendererProperty = property != null ? new RendererProperty(property) : s_propertyMap[(int)Type];
return new AnimationProxy(aseq, aseq.Target, this.Type, rendererProperty, anim.Loop, stopCommand); return new AnimationProxy(aseq, aseq.Target, Type, rendererProperty, anim.Loop, stopCommand);
} }
public BaseKeyframe Clone() => (BaseKeyframe)this.MemberwiseClone(); public BaseKeyframe Clone() => (BaseKeyframe)MemberwiseClone();
object ICloneable.Clone() => this.Clone(); object ICloneable.Clone() => Clone();
protected abstract void PopulateAnimationWorker( protected abstract void PopulateAnimationWorker(
IAnimatable targetObject, IAnimatable targetObject,
@@ -81,22 +81,22 @@ namespace Microsoft.Iris.Animations
public float Time public float Time
{ {
get => this._timeValue; get => _timeValue;
set => this._timeValue = value; set => _timeValue = value;
} }
public RelativeTo RelativeTo public RelativeTo RelativeTo
{ {
get => this._relative == null ? RelativeTo.Absolute : this._relative; get => _relative == null ? RelativeTo.Absolute : _relative;
set => this._relative = value; set => _relative = value;
} }
public bool IsRelativeToObject => this.RelativeTo.IsRelativeToObject; public bool IsRelativeToObject => RelativeTo.IsRelativeToObject;
public Interpolation Interpolation public Interpolation Interpolation
{ {
get => this._interpolation; get => _interpolation;
set => this._interpolation = value; set => _interpolation = value;
} }
public abstract AnimationType Type { get; } public abstract AnimationType Type { get; }
@@ -113,24 +113,24 @@ namespace Microsoft.Iris.Animations
{ {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<"); stringBuilder.Append("<");
stringBuilder.Append(this.GetType().Name); stringBuilder.Append(GetType().Name);
stringBuilder.Append(" Time=\""); stringBuilder.Append(" Time=\"");
stringBuilder.Append(this._timeValue); stringBuilder.Append(_timeValue);
stringBuilder.Append("\""); stringBuilder.Append("\"");
if (this._interpolation != null) if (_interpolation != null)
{ {
stringBuilder.Append(" Interpolation=\""); stringBuilder.Append(" Interpolation=\"");
stringBuilder.Append(this._interpolation.ToString()); stringBuilder.Append(_interpolation.ToString());
stringBuilder.Append("\""); stringBuilder.Append("\"");
} }
if (this._relative != RelativeTo.Absolute) if (_relative != RelativeTo.Absolute)
{ {
stringBuilder.Append(" RelativeTo=\""); stringBuilder.Append(" RelativeTo=\"");
stringBuilder.Append(_relative); stringBuilder.Append(_relative);
stringBuilder.Append("\""); stringBuilder.Append("\"");
} }
stringBuilder.Append(" Value=\""); stringBuilder.Append(" Value=\"");
stringBuilder.Append(this.ObjectValue); stringBuilder.Append(ObjectValue);
stringBuilder.Append("\""); stringBuilder.Append("\"");
stringBuilder.Append("/>"); stringBuilder.Append("/>");
return stringBuilder.ToString(); return stringBuilder.ToString();
@@ -8,7 +8,7 @@ namespace Microsoft.Iris.Animations
{ {
internal abstract class BaseMultiplyFloatKeyframe : BaseFloatKeyframe internal abstract class BaseMultiplyFloatKeyframe : BaseFloatKeyframe
{ {
public BaseMultiplyFloatKeyframe() => this.Value = 1f; public BaseMultiplyFloatKeyframe() => Value = 1f;
public override bool Multiply => true; public override bool Multiply => true;
} }
@@ -10,7 +10,7 @@ namespace Microsoft.Iris.Animations
{ {
internal abstract class BaseMultiplyVector3Keyframe : BaseVector3Keyframe internal abstract class BaseMultiplyVector3Keyframe : BaseVector3Keyframe
{ {
public BaseMultiplyVector3Keyframe() => this.Value = Vector3.UnitVector; public BaseMultiplyVector3Keyframe() => Value = Vector3.UnitVector;
public override bool Multiply => true; public override bool Multiply => true;
@@ -19,8 +19,8 @@ namespace Microsoft.Iris.Animations
Vector3 baseValueVector, Vector3 baseValueVector,
ref AnimationArgs args) ref AnimationArgs args)
{ {
if (this.RelativeTo == RelativeTo.Final) if (RelativeTo == RelativeTo.Final)
baseValueVector *= this.GetRelativeToFinalValue(targetObject, ref args); baseValueVector *= GetRelativeToFinalValue(targetObject, ref args);
return baseValueVector; return baseValueVector;
} }
@@ -13,21 +13,21 @@ namespace Microsoft.Iris.Animations
{ {
private Rotation _valueRotation; private Rotation _valueRotation;
public BaseRotationKeyframe() => this._valueRotation = Rotation.Default; public BaseRotationKeyframe() => _valueRotation = Rotation.Default;
protected override void PopulateAnimationWorker( protected override void PopulateAnimationWorker(
IAnimatable targetObject, IAnimatable targetObject,
AnimationProxy animation, AnimationProxy animation,
ref AnimationArgs args) ref AnimationArgs args)
{ {
Rotation effectiveValue = this.GetEffectiveValue(targetObject, this._valueRotation, ref args); Rotation effectiveValue = GetEffectiveValue(targetObject, _valueRotation, ref args);
animation.AddRotationKeyframe(this, effectiveValue); animation.AddRotationKeyframe(this, effectiveValue);
} }
public Rotation Value public Rotation Value
{ {
get => this._valueRotation; get => _valueRotation;
set => this._valueRotation = value; set => _valueRotation = value;
} }
public override object ObjectValue => Value; public override object ObjectValue => Value;
@@ -42,8 +42,8 @@ namespace Microsoft.Iris.Animations
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args) public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
{ {
Rotation effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueRotation, ref args); Rotation effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueRotation, ref args);
this.Apply(animationTarget, effectiveValue); Apply(animationTarget, effectiveValue);
} }
public abstract void Apply(IAnimatableOwner animationTarget, Rotation valueRotation); public abstract void Apply(IAnimatableOwner animationTarget, Rotation valueRotation);
@@ -17,14 +17,14 @@ namespace Microsoft.Iris.Animations
AnimationProxy animation, AnimationProxy animation,
ref AnimationArgs args) ref AnimationArgs args)
{ {
Vector2 effectiveValue = this.GetEffectiveValue(targetObject, this._valueVector, ref args); Vector2 effectiveValue = GetEffectiveValue(targetObject, _valueVector, ref args);
animation.AddVector2Keyframe(this, effectiveValue); animation.AddVector2Keyframe(this, effectiveValue);
} }
public Vector2 Value public Vector2 Value
{ {
get => this._valueVector; get => _valueVector;
set => this._valueVector = value; set => _valueVector = value;
} }
public override object ObjectValue => Value; public override object ObjectValue => Value;
@@ -39,12 +39,12 @@ namespace Microsoft.Iris.Animations
public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args) public override void Apply(IAnimatableOwner animationTarget, ref AnimationArgs args)
{ {
Vector2 effectiveValue = this.GetEffectiveValue(animationTarget.AnimationTarget, this._valueVector, ref args); Vector2 effectiveValue = GetEffectiveValue(animationTarget.AnimationTarget, _valueVector, ref args);
this.Apply(animationTarget, effectiveValue); Apply(animationTarget, effectiveValue);
} }
public abstract void Apply(IAnimatableOwner animationTarget, Vector2 valueVector); public abstract void Apply(IAnimatableOwner animationTarget, Vector2 valueVector);
public override void MagnifyValue(float magnifyValue) => this.Value *= magnifyValue; public override void MagnifyValue(float magnifyValue) => Value *= magnifyValue;
} }
} }

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