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
+36 -36
View File
@@ -32,45 +32,45 @@ namespace Microsoft.Iris.UI
public Class(MarkupTypeSchema type)
{
this._typeSchema = type;
this._storage = new Dictionary<object, object>(type.TotalPropertiesAndLocalsCount);
this._scriptEnabled = true;
_typeSchema = type;
_storage = new Dictionary<object, object>(type.TotalPropertiesAndLocalsCount);
_scriptEnabled = true;
}
protected override void OnDispose()
{
this._typeSchema.RunFinalEvaluates(this);
_typeSchema.RunFinalEvaluates(this);
base.OnDispose();
this._scriptEnabled = false;
if (this._listeners != null)
_scriptEnabled = false;
if (_listeners != null)
{
this._listeners.Dispose(this);
this._listeners = null;
_listeners.Dispose(this);
_listeners = null;
}
this._notifier.ClearListeners();
this._storage.Clear();
if (this._disposables == null)
_notifier.ClearListeners();
_storage.Clear();
if (_disposables == null)
return;
for (int index = 0; index < this._disposables.Count; ++index)
this._disposables[index].Dispose(this);
for (int index = 0; index < _disposables.Count; ++index)
_disposables[index].Dispose(this);
}
public void RegisterDisposable(IDisposableObject disposable)
{
if (this._disposables == null)
this._disposables = new Vector<IDisposableObject>();
this._disposables.Add(disposable);
if (_disposables == null)
_disposables = new Vector<IDisposableObject>();
_disposables.Add(disposable);
}
public bool UnregisterDisposable(ref IDisposableObject disposable)
{
if (this._disposables != null)
if (_disposables != null)
{
int index = this._disposables.IndexOf(disposable);
int index = _disposables.IndexOf(disposable);
if (index != -1)
{
disposable = this._disposables[index];
this._disposables.RemoveAt(index);
disposable = _disposables[index];
_disposables.RemoveAt(index);
return true;
}
}
@@ -83,7 +83,7 @@ namespace Microsoft.Iris.UI
{
}
void INotifyObject.AddListener(Listener listener) => this._notifier.AddListener(listener);
void INotifyObject.AddListener(Listener listener) => _notifier.AddListener(listener);
public virtual object ReadSymbol(SymbolReference symbolRef)
{
@@ -92,7 +92,7 @@ namespace Microsoft.Iris.UI
{
case SymbolOrigin.Properties:
case SymbolOrigin.Locals:
obj = this._storage[symbolRef.Symbol];
obj = _storage[symbolRef.Symbol];
break;
case SymbolOrigin.Reserved:
if (symbolRef.Symbol == nameof(Class) || symbolRef.Symbol == "this")
@@ -105,31 +105,31 @@ namespace Microsoft.Iris.UI
return obj;
}
public virtual void WriteSymbol(SymbolReference symbolRef, object value) => this.SetProperty(symbolRef.Symbol, value);
public virtual void WriteSymbol(SymbolReference symbolRef, object value) => SetProperty(symbolRef.Symbol, value);
public virtual object GetProperty(string name) => this._storage[name];
public virtual object GetProperty(string name) => _storage[name];
public virtual void SetProperty(string name, object value)
{
if (this._storage.ContainsKey(name) && Utility.IsEqual(this._storage[name], value))
if (_storage.ContainsKey(name) && Utility.IsEqual(_storage[name], value))
return;
this._storage[name] = value;
this._notifier.Fire(name);
_storage[name] = value;
_notifier.Fire(name);
}
public MarkupListeners Listeners
{
get => this._listeners;
set => this._listeners = value;
get => _listeners;
set => _listeners = value;
}
public Dictionary<object, object> Storage => this._storage;
public Dictionary<object, object> Storage => _storage;
public void ScheduleScriptRun(uint scriptId, bool ignoreErrors)
{
if (!this._scriptRunScheduler.Pending)
if (!_scriptRunScheduler.Pending)
DeferredCall.Post(DispatchPriority.Script, s_executePendingScriptsHandler, this);
this._scriptRunScheduler.ScheduleRun(scriptId, ignoreErrors);
_scriptRunScheduler.ScheduleRun(scriptId, ignoreErrors);
}
private static void ExecutePendingScripts(object args)
@@ -138,17 +138,17 @@ namespace Microsoft.Iris.UI
@class._scriptRunScheduler.Execute(@class);
}
public object RunScript(uint scriptId, bool ignoreErrors, ParameterContext parameterContext) => this._typeSchema.Run(this, scriptId, ignoreErrors, parameterContext);
public object RunScript(uint scriptId, bool ignoreErrors, ParameterContext parameterContext) => _typeSchema.Run(this, scriptId, ignoreErrors, parameterContext);
public void NotifyScriptErrors()
{
this._scriptEnabled = false;
_scriptEnabled = false;
ErrorManager.ReportWarning("Script runtime failure: Scripting has been disabled for '{0}' due to runtime scripting errors", _typeSchema.Name);
}
public bool ScriptEnabled => this._scriptEnabled;
public bool ScriptEnabled => _scriptEnabled;
public override string ToString() => this._typeSchema.ToString();
public override string ToString() => _typeSchema.ToString();
[Conditional("DEBUG")]
public void DEBUG_MarkInitialized()
+30 -30
View File
@@ -22,36 +22,36 @@ namespace Microsoft.Iris.UI
public EffectClass(MarkupTypeSchema type, IEffectTemplate effectTemplate)
: base(type)
=> this._effectTemplate = effectTemplate;
=> _effectTemplate = effectTemplate;
protected override void OnDispose()
{
base.OnDispose();
if (this._activeAnimations != null)
if (_activeAnimations != null)
{
foreach (DisposableObject activeAnimation in this._activeAnimations)
foreach (DisposableObject activeAnimation in _activeAnimations)
activeAnimation.Dispose(this);
this._activeAnimations.Clear();
_activeAnimations.Clear();
}
foreach (EffectClass.EffectAndOwner effectAndOwner in this._effectsInUse)
foreach (EffectClass.EffectAndOwner effectAndOwner in _effectsInUse)
effectAndOwner.Effect.UnregisterUsage(this);
this._effectsInUse.Clear();
_effectsInUse.Clear();
}
public string DefaultImageElement => ((EffectClassTypeSchema)this.TypeSchema).DefaultElementSymbol;
public string DefaultImageElement => ((EffectClassTypeSchema)TypeSchema).DefaultElementSymbol;
public IEffect CreateRenderEffect(object owner)
{
IEffect effect = null;
if (this._effectTemplate != null && this._effectTemplate.IsBuilt)
if (_effectTemplate != null && _effectTemplate.IsBuilt)
{
effect = this._effectTemplate.CreateInstance(this);
this._effectsInUse.Add(new EffectClass.EffectAndOwner(effect, owner));
effect = _effectTemplate.CreateInstance(this);
_effectsInUse.Add(new EffectClass.EffectAndOwner(effect, owner));
effect.RegisterUsage(owner);
}
if (effect != null && this._properties != null)
if (effect != null && _properties != null)
{
foreach (KeyValueEntry<string, EffectValue> property in this._properties)
foreach (KeyValueEntry<string, EffectValue> property in _properties)
property.Value.SetValueOnEffect(effect, property.Key);
}
return effect;
@@ -79,14 +79,14 @@ namespace Microsoft.Iris.UI
public void DoneWithRenderEffects(object owner)
{
if (this.IsDisposed)
if (IsDisposed)
return;
for (int index = this._effectsInUse.Count - 1; index >= 0; --index)
for (int index = _effectsInUse.Count - 1; index >= 0; --index)
{
if (this._effectsInUse[index].Owner == owner)
if (_effectsInUse[index].Owner == owner)
{
this._effectsInUse[index].Effect.UnregisterUsage(this);
this._effectsInUse.RemoveAt(index);
_effectsInUse[index].Effect.UnregisterUsage(this);
_effectsInUse.RemoveAt(index);
}
}
}
@@ -111,33 +111,33 @@ namespace Microsoft.Iris.UI
public void SetRenderEffectProperty(string property, EffectValue value)
{
if (this._properties == null)
this._properties = new Map<string, EffectValue>();
this._properties[property] = value;
foreach (EffectClass.EffectAndOwner effectAndOwner in this._effectsInUse)
if (_properties == null)
_properties = new Map<string, EffectValue>();
_properties[property] = value;
foreach (EffectClass.EffectAndOwner effectAndOwner in _effectsInUse)
value.SetValueOnEffect(effectAndOwner.Effect, property);
}
public void PlayAnimation(string property, EffectAnimation animation)
{
if (this._activeAnimations == null)
this._activeAnimations = new Vector<ActiveSequence>();
foreach (EffectClass.EffectAndOwner effectAndOwner in this._effectsInUse)
if (_activeAnimations == null)
_activeAnimations = new Vector<ActiveSequence>();
foreach (EffectClass.EffectAndOwner effectAndOwner in _effectsInUse)
{
AnimationArgs args = new AnimationArgs();
ActiveSequence instance = animation.CreateInstance(effectAndOwner.Effect, property, ref args);
instance?.Play();
instance.DeclareOwner(this);
instance.AnimationCompleted += new EventHandler(this.OnAnimationComplete);
this._activeAnimations.Add(instance);
instance.AnimationCompleted += new EventHandler(OnAnimationComplete);
_activeAnimations.Add(instance);
}
}
private void OnAnimationComplete(object sender, EventArgs args)
{
ActiveSequence activeSequence = (ActiveSequence)sender;
activeSequence.AnimationCompleted -= new EventHandler(this.OnAnimationComplete);
this._activeAnimations.Remove(activeSequence);
activeSequence.AnimationCompleted -= new EventHandler(OnAnimationComplete);
_activeAnimations.Remove(activeSequence);
activeSequence.Dispose(this);
}
@@ -150,8 +150,8 @@ namespace Microsoft.Iris.UI
public EffectAndOwner(IEffect effect, object owner)
{
this.Effect = effect;
this.Owner = owner;
Effect = effect;
Owner = owner;
}
}
}
+12 -12
View File
@@ -19,29 +19,29 @@ namespace Microsoft.Iris.UI
public EffectElementWrapper(EffectClass cls, string elementName)
{
this._class = cls;
this._elementName = elementName;
_class = cls;
_elementName = elementName;
}
public void SetProperty(string propertyName, int value) => this._class.SetRenderEffectProperty(this.MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Int));
public void SetProperty(string propertyName, int value) => _class.SetRenderEffectProperty(MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Int));
public void SetProperty(string propertyName, float value) => this._class.SetRenderEffectProperty(this.MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Float));
public void SetProperty(string propertyName, float value) => _class.SetRenderEffectProperty(MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Float));
public void SetProperty(string propertyName, UIImage value) => this._class.SetRenderEffectProperty(this.MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.UIImage));
public void SetProperty(string propertyName, UIImage value) => _class.SetRenderEffectProperty(MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.UIImage));
public void SetProperty(string propertyName, IUIVideoStream value) => this._class.SetRenderEffectProperty(this.MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.IUIVideoStream));
public void SetProperty(string propertyName, IUIVideoStream value) => _class.SetRenderEffectProperty(MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.IUIVideoStream));
public void SetProperty(string propertyName, Color value) => this._class.SetRenderEffectProperty(this.MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Color));
public void SetProperty(string propertyName, Color value) => _class.SetRenderEffectProperty(MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Color));
public void SetProperty(string propertyName, Vector2 value) => this._class.SetRenderEffectProperty(this.MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Vector2));
public void SetProperty(string propertyName, Vector2 value) => _class.SetRenderEffectProperty(MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Vector2));
public void SetProperty(string propertyName, Vector3 value) => this._class.SetRenderEffectProperty(this.MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Vector3));
public void SetProperty(string propertyName, Vector3 value) => _class.SetRenderEffectProperty(MakeEffectPropertyName(propertyName), new EffectValue(value, EffectValueType.Vector3));
public void PlayAnimation(EffectProperty property, EffectAnimation animation) => this._class.PlayAnimation(this.MakeEffectPropertyName(property), animation);
public void PlayAnimation(EffectProperty property, EffectAnimation animation) => _class.PlayAnimation(MakeEffectPropertyName(property), animation);
private string MakeEffectPropertyName(string propertyName) => MakeEffectPropertyName(this._elementName, propertyName);
private string MakeEffectPropertyName(string propertyName) => MakeEffectPropertyName(_elementName, propertyName);
private string MakeEffectPropertyName(EffectProperty property) => MakeEffectPropertyName(this._elementName, property);
private string MakeEffectPropertyName(EffectProperty property) => MakeEffectPropertyName(_elementName, property);
public static string MakeEffectPropertyName(string elementName, EffectProperty property)
{
+3 -3
View File
@@ -16,11 +16,11 @@ namespace Microsoft.Iris.UI
public EffectValue(object value, EffectValueType type)
{
this._value = value;
this._type = type;
_value = value;
_type = type;
}
public void SetValueOnEffect(IEffect effect, string property) => SetValueOnEffect(effect, property, this._value, this._type);
public void SetValueOnEffect(IEffect effect, string property) => SetValueOnEffect(effect, property, _value, _type);
public static void SetValueOnEffect(
IEffect effect,
+16 -16
View File
@@ -21,7 +21,7 @@ namespace Microsoft.Iris.UI
private static Environment s_instance;
private static float s_dpiScale = Math.Max(1f, NativeApi.SpGetDpi() / 96f);
private Environment() => this._soundEffectsEnabledFlag = true;
private Environment() => _soundEffectsEnabledFlag = true;
public static Environment Instance
{
@@ -33,52 +33,52 @@ namespace Microsoft.Iris.UI
}
}
public bool IsMouseActive => this._mouseActiveFlag;
public bool IsMouseActive => _mouseActiveFlag;
public void SetIsMouseActive(bool value)
{
if (this._mouseActiveFlag == value)
if (_mouseActiveFlag == value)
return;
this._mouseActiveFlag = value;
_mouseActiveFlag = value;
}
public bool IsRightToLeft => UISession.Default.IsRtl;
public ColorScheme ColorScheme => this._currentColorScheme;
public ColorScheme ColorScheme => _currentColorScheme;
public void SetColorScheme(ColorScheme value)
{
if (this._currentColorScheme == value)
if (_currentColorScheme == value)
return;
this._currentColorScheme = value;
this.FireNotification(NotificationID.ColorScheme);
_currentColorScheme = value;
FireNotification(NotificationID.ColorScheme);
}
public bool SoundEffectsEnabled => this._soundEffectsEnabledFlag;
public bool SoundEffectsEnabled => _soundEffectsEnabledFlag;
public void SetSoundEffectsEnabled(bool value)
{
if (this._soundEffectsEnabledFlag == value)
if (_soundEffectsEnabledFlag == value)
return;
this._soundEffectsEnabledFlag = value;
_soundEffectsEnabledFlag = value;
}
public static float DpiScale => s_dpiScale;
public float AnimationSpeed
{
get => this.AnimationSystem.SpeedAdjustment;
set => this.AnimationSystem.SpeedAdjustment = value;
get => AnimationSystem.SpeedAdjustment;
set => AnimationSystem.SpeedAdjustment = value;
}
public int AnimationUpdatesPerSecond
{
get => this.AnimationSystem.UpdatesPerSecond;
set => this.AnimationSystem.UpdatesPerSecond = value;
get => AnimationSystem.UpdatesPerSecond;
set => AnimationSystem.UpdatesPerSecond = value;
}
private IAnimationSystem AnimationSystem => UISession.Default.RenderSession.AnimationSystem;
public void AnimationAdvance(int milliseconds) => this.AnimationSystem.PulseTimeAdvance(milliseconds);
public void AnimationAdvance(int milliseconds) => AnimationSystem.PulseTimeAdvance(milliseconds);
}
}
+52 -52
View File
@@ -19,36 +19,36 @@ namespace Microsoft.Iris.UI
private bool _disabled;
private string _name;
public InputHandler() => this._handlerStage = InputHandlerStage.Direct;
public InputHandler() => _handlerStage = InputHandlerStage.Direct;
public InputHandlerStage HandlerStage
{
get => this._handlerStage;
get => _handlerStage;
set
{
if (this._handlerStage == value)
if (_handlerStage == value)
return;
this._handlerStage = value;
this.FireNotification(NotificationID.HandlerStage);
_handlerStage = value;
FireNotification(NotificationID.HandlerStage);
}
}
protected bool HandleDirect => (this.HandlerStage & InputHandlerStage.Direct) == InputHandlerStage.Direct;
protected bool HandleDirect => (HandlerStage & InputHandlerStage.Direct) == InputHandlerStage.Direct;
protected bool HandleRouted => (this.HandlerStage & InputHandlerStage.Routed) == InputHandlerStage.Routed;
protected bool HandleRouted => (HandlerStage & InputHandlerStage.Routed) == InputHandlerStage.Routed;
protected bool HandleBubbled => (this.HandlerStage & InputHandlerStage.Bubbled) == InputHandlerStage.Bubbled;
protected bool HandleBubbled => (HandlerStage & InputHandlerStage.Bubbled) == InputHandlerStage.Bubbled;
private bool ShouldHandleStage(EventRouteStages stage)
{
switch (stage)
{
case EventRouteStages.Direct:
return this.HandleDirect;
return HandleDirect;
case EventRouteStages.Bubbled:
return this.HandleBubbled;
return HandleBubbled;
case EventRouteStages.Routed:
return this.HandleRouted;
return HandleRouted;
default:
return false;
}
@@ -57,16 +57,16 @@ namespace Microsoft.Iris.UI
protected override void OnDispose()
{
base.OnDispose();
this._ui = null;
_ui = null;
}
protected override void OnOwnerDeclared(object owner)
{
base.OnOwnerDeclared(owner);
this._ui = (UIClass)owner;
_ui = (UIClass)owner;
}
public void NotifyUIInitialized() => this.ConfigureInteractivity();
public void NotifyUIInitialized() => ConfigureInteractivity();
protected virtual void ConfigureInteractivity()
{
@@ -82,91 +82,91 @@ namespace Microsoft.Iris.UI
public bool Enabled
{
get => !this._disabled;
get => !_disabled;
set
{
if (this.Enabled == value)
if (Enabled == value)
return;
this._disabled = !value;
this.FireNotification(NotificationID.Enabled);
this._ui.UpdateCursor();
_disabled = !value;
FireNotification(NotificationID.Enabled);
_ui.UpdateCursor();
}
}
public string Name
{
get => this._name;
set => this._name = NotifyService.CanonicalizeString(value);
get => _name;
set => _name = NotifyService.CanonicalizeString(value);
}
public void DeliverInput(UIClass ui, InputInfo info, EventRouteStages stage)
{
if (!this.Enabled || !this.ShouldHandleStage(stage))
if (!Enabled || !ShouldHandleStage(stage))
return;
switch (info.EventType)
{
case InputEventType.CommandDown:
this.OnCommandDown(ui, (KeyCommandInfo)info);
OnCommandDown(ui, (KeyCommandInfo)info);
break;
case InputEventType.CommandUp:
this.OnCommandUp(ui, (KeyCommandInfo)info);
OnCommandUp(ui, (KeyCommandInfo)info);
break;
case InputEventType.GainKeyFocus:
this.OnGainKeyFocus(ui, (KeyFocusInfo)info);
OnGainKeyFocus(ui, (KeyFocusInfo)info);
break;
case InputEventType.LoseKeyFocus:
this.OnLoseKeyFocus(ui, (KeyFocusInfo)info);
OnLoseKeyFocus(ui, (KeyFocusInfo)info);
break;
case InputEventType.KeyDown:
this.OnKeyDown(ui, (KeyStateInfo)info);
OnKeyDown(ui, (KeyStateInfo)info);
break;
case InputEventType.KeyUp:
this.OnKeyUp(ui, (KeyStateInfo)info);
OnKeyUp(ui, (KeyStateInfo)info);
break;
case InputEventType.KeyCharacter:
this.OnKeyCharacter(ui, (KeyCharacterInfo)info);
OnKeyCharacter(ui, (KeyCharacterInfo)info);
break;
case InputEventType.MouseMove:
this.OnMouseMove(ui, (MouseMoveInfo)info);
OnMouseMove(ui, (MouseMoveInfo)info);
break;
case InputEventType.GainMouseFocus:
this.OnGainMouseFocus(ui, (MouseFocusInfo)info);
OnGainMouseFocus(ui, (MouseFocusInfo)info);
break;
case InputEventType.LoseMouseFocus:
this.OnLoseMouseFocus(ui, (MouseFocusInfo)info);
OnLoseMouseFocus(ui, (MouseFocusInfo)info);
break;
case InputEventType.MousePrimaryDown:
this.OnMousePrimaryDown(ui, (MouseButtonInfo)info);
OnMousePrimaryDown(ui, (MouseButtonInfo)info);
break;
case InputEventType.MouseSecondaryDown:
this.OnMouseSecondaryDown(ui, (MouseButtonInfo)info);
OnMouseSecondaryDown(ui, (MouseButtonInfo)info);
break;
case InputEventType.MousePrimaryUp:
this.OnMousePrimaryUp(ui, (MouseButtonInfo)info);
OnMousePrimaryUp(ui, (MouseButtonInfo)info);
break;
case InputEventType.MouseSecondaryUp:
this.OnMouseSecondaryUp(ui, (MouseButtonInfo)info);
OnMouseSecondaryUp(ui, (MouseButtonInfo)info);
break;
case InputEventType.MouseDoubleClick:
this.OnMouseDoubleClick(ui, (MouseButtonInfo)info);
OnMouseDoubleClick(ui, (MouseButtonInfo)info);
break;
case InputEventType.MouseWheel:
this.OnMouseWheel(ui, (MouseWheelInfo)info);
OnMouseWheel(ui, (MouseWheelInfo)info);
break;
case InputEventType.DragEnter:
this.OnDragEnter(ui, (DragDropInfo)info);
OnDragEnter(ui, (DragDropInfo)info);
break;
case InputEventType.DragOver:
this.OnDragOver(ui, (DragDropInfo)info);
OnDragOver(ui, (DragDropInfo)info);
break;
case InputEventType.DragLeave:
this.OnDragLeave(ui, (DragDropInfo)info);
OnDragLeave(ui, (DragDropInfo)info);
break;
case InputEventType.DragDropped:
this.OnDropped(ui, (DragDropInfo)info);
OnDropped(ui, (DragDropInfo)info);
break;
case InputEventType.DragComplete:
this.OnDragComplete(ui, (DragDropInfo)info);
OnDragComplete(ui, (DragDropInfo)info);
break;
}
}
@@ -263,17 +263,17 @@ namespace Microsoft.Iris.UI
{
}
internal void NotifyLoseDeepKeyFocus() => this.OnLoseDeepKeyFocus();
internal void NotifyLoseDeepKeyFocus() => OnLoseDeepKeyFocus();
internal void NotifyGainDeepKeyFocus() => this.OnGainDeepKeyFocus();
internal void NotifyGainDeepKeyFocus() => OnGainDeepKeyFocus();
internal virtual CursorID GetCursor() => CursorID.NotSpecified;
protected void UpdateCursor()
{
if (this._ui == null)
if (_ui == null)
return;
this._ui.UpdateCursor();
_ui.UpdateCursor();
}
public static InputHandlerModifiers GetModifiers(
@@ -297,11 +297,11 @@ namespace Microsoft.Iris.UI
string contextName)
{
object obj = context != null ? context.Target : null;
object eventContext = this.GetEventContext(source);
object eventContext = GetEventContext(source);
if (eventContext == obj)
return;
context = new WeakReference(eventContext);
this.FireNotification(contextName);
FireNotification(contextName);
}
protected object CheckEventContext(ref WeakReference context)
@@ -324,13 +324,13 @@ namespace Microsoft.Iris.UI
if (!(clickTarget is UIClass uiClass) || !uiClass.IsValid)
return null;
object eventContext;
for (eventContext = uiClass.GetEventContext(); eventContext == null && uiClass != this.UI; eventContext = uiClass.GetEventContext())
for (eventContext = uiClass.GetEventContext(); eventContext == null && uiClass != UI; eventContext = uiClass.GetEventContext())
uiClass = uiClass.Parent;
return eventContext;
}
public override string ToString() => this.GetType().Name;
public override string ToString() => GetType().Name;
protected UIClass UI => this._ui;
protected UIClass UI => _ui;
}
}
+3 -3
View File
@@ -14,13 +14,13 @@ namespace Microsoft.Iris.UI
public RootLoadResult(string name)
: base(name)
=> this.RootType = new UIClassTypeSchema(this, name);
=> RootType = new UIClassTypeSchema(this, name);
protected override void OnDispose()
{
base.OnDispose();
this.RootType.Dispose(this);
this.RootType = null;
RootType.Dispose(this);
RootType = null;
}
public override TypeSchema FindType(string name) => (TypeSchema)null;
+3 -3
View File
@@ -14,9 +14,9 @@ namespace Microsoft.Iris.UI
public RootUI(UIZone zone)
: base(MarkupSystem.RootGlobal.RootType)
{
this.DeclareOwner(zone);
this.PropagateZone(zone);
this.NotifyInitialized();
DeclareOwner(zone);
PropagateZone(zone);
NotifyInitialized();
}
protected override void OnOwnerDeclared(object owner)
+2 -2
View File
@@ -10,8 +10,8 @@ namespace Microsoft.Iris.UI
{
private object _payload;
public SavedKeyFocus(object objectToWrap) => this._payload = objectToWrap;
public SavedKeyFocus(object objectToWrap) => _payload = objectToWrap;
public object Payload => this._payload;
public object Payload => _payload;
}
}
File diff suppressed because it is too large Load Diff
+114 -114
View File
@@ -41,244 +41,244 @@ namespace Microsoft.Iris.UI
: base(session)
{
session.InputManager.KeyFocusCanBeNull = true;
session.InputManager.InvalidKeyFocus += new InvalidKeyFocusHandler(this.OnInvalidKeyFocus);
this._showWindowFrame = true;
this._alwaysOnTop = false;
this._showInTaskbar = true;
this._showShadow = false;
this._startCentered = false;
this._startInWorkArea = false;
this._preventInterruption = false;
this.UpdateStyles();
this.SetWindowOptions(WindowOptions.FreeformResize, true);
this._notificationCallback = new NativeApi.NotifyWindowCallback(this.OnNotifyCallback);
session.InputManager.InvalidKeyFocus += new InvalidKeyFocusHandler(OnInvalidKeyFocus);
_showWindowFrame = true;
_alwaysOnTop = false;
_showInTaskbar = true;
_showShadow = false;
_startCentered = false;
_startInWorkArea = false;
_preventInterruption = false;
UpdateStyles();
SetWindowOptions(WindowOptions.FreeformResize, true);
_notificationCallback = new NativeApi.NotifyWindowCallback(OnNotifyCallback);
IntPtr handle;
RendererApi.IFC(NativeApi.SpCreateNotifyWindow(out handle, this._notificationCallback));
this.AppNotifyWindow = handle;
RendererApi.IFC(NativeApi.SpCreateNotifyWindow(out handle, _notificationCallback));
AppNotifyWindow = handle;
}
private void OnInitialize()
{
UIZone newZone = new UIZone(this);
newZone.DeclareOwner(this);
this.AttachChildZone(newZone);
newZone.RootViewItem.RequestSource(this._initialSource, this._initialProperties);
AttachChildZone(newZone);
newZone.RootViewItem.RequestSource(_initialSource, _initialProperties);
}
public string Caption
{
get => this.Text;
get => Text;
set
{
if (!(value != this.Text))
if (!(value != Text))
return;
this.Text = value;
this.FireNotification(NotificationID.Caption);
Text = value;
FireNotification(NotificationID.Caption);
}
}
public bool ShowWindowFrame
{
get => this._showWindowFrame;
get => _showWindowFrame;
set
{
if (this._showWindowFrame == value)
if (_showWindowFrame == value)
return;
this._showWindowFrame = value;
this.UpdateStyles();
this.FireNotification(NotificationID.ShowWindowFrame);
_showWindowFrame = value;
UpdateStyles();
FireNotification(NotificationID.ShowWindowFrame);
}
}
public bool ShowShadow
{
get => this._showShadow;
get => _showShadow;
set
{
if (this._showShadow == value)
if (_showShadow == value)
return;
this._showShadow = value;
this.SetWindowOptions(WindowOptions.ShowFormShadow, value);
_showShadow = value;
SetWindowOptions(WindowOptions.ShowFormShadow, value);
}
}
public bool PreventInterruption
{
get => this._preventInterruption;
get => _preventInterruption;
set
{
if (this._preventInterruption == value)
if (_preventInterruption == value)
return;
this._preventInterruption = value;
this.SetWindowOptions(WindowOptions.PreventInterruption, value);
_preventInterruption = value;
SetWindowOptions(WindowOptions.PreventInterruption, value);
}
}
public MaximizeMode MaximizeMode
{
get => this._maximizeMode;
get => _maximizeMode;
set
{
if (this._maximizeMode == value)
if (_maximizeMode == value)
return;
this._maximizeMode = value;
_maximizeMode = value;
if (value == MaximizeMode.FullScreen)
this.SetWindowOptions(WindowOptions.MaximizeFullScreen, true);
SetWindowOptions(WindowOptions.MaximizeFullScreen, true);
else
this.SetWindowOptions(WindowOptions.MaximizeFullScreen, false);
this.FireNotification(NotificationID.MaximizeMode);
SetWindowOptions(WindowOptions.MaximizeFullScreen, false);
FireNotification(NotificationID.MaximizeMode);
}
}
public bool StartCentered
{
get => this._startCentered;
get => _startCentered;
set
{
if (this._startCentered == value)
if (_startCentered == value)
return;
this._startCentered = value;
this.SetWindowOptions(WindowOptions.StartCentered, value);
_startCentered = value;
SetWindowOptions(WindowOptions.StartCentered, value);
}
}
public bool StartInWorkArea
{
get => this._startInWorkArea;
get => _startInWorkArea;
set
{
if (this._startInWorkArea == value)
if (_startInWorkArea == value)
return;
this._startInWorkArea = value;
this.SetWindowOptions(WindowOptions.StartInWorkArea, value);
_startInWorkArea = value;
SetWindowOptions(WindowOptions.StartInWorkArea, value);
}
}
public bool RespectsStartupSettings
{
get => this._respectStartupSettings;
get => _respectStartupSettings;
set
{
if (this._respectStartupSettings == value)
if (_respectStartupSettings == value)
return;
this._respectStartupSettings = value;
this.SetWindowOptions(WindowOptions.RespectStartupSettings, value);
_respectStartupSettings = value;
SetWindowOptions(WindowOptions.RespectStartupSettings, value);
}
}
public bool AlwaysOnTop
{
get => this._alwaysOnTop;
get => _alwaysOnTop;
set
{
if (this._alwaysOnTop == value)
if (_alwaysOnTop == value)
return;
this._alwaysOnTop = value;
this.UpdateStyles();
this.FireNotification(NotificationID.AlwaysOnTop);
_alwaysOnTop = value;
UpdateStyles();
FireNotification(NotificationID.AlwaysOnTop);
}
}
public bool ShowInTaskbar
{
get => this._showInTaskbar;
get => _showInTaskbar;
set
{
if (this._showInTaskbar == value)
if (_showInTaskbar == value)
return;
this._showInTaskbar = value;
this.UpdateStyles();
this.FireNotification(NotificationID.ShowInTaskbar);
_showInTaskbar = value;
UpdateStyles();
FireNotification(NotificationID.ShowInTaskbar);
}
}
public int MouseIdleTimeout
{
get => this._mouseIdleTimeout;
get => _mouseIdleTimeout;
set
{
this._mouseIdleTimeout = value;
_mouseIdleTimeout = value;
if (value != 0)
{
this.SetMouseIdleOptions(new Size(2, 2), (uint)value);
this.SetWindowOptions(WindowOptions.TrackMouseIdle, true);
SetMouseIdleOptions(new Size(2, 2), (uint)value);
SetWindowOptions(WindowOptions.TrackMouseIdle, true);
}
else
this.SetWindowOptions(WindowOptions.TrackMouseIdle, false);
this.FireNotification(NotificationID.MouseIdleTimeout);
SetWindowOptions(WindowOptions.TrackMouseIdle, false);
FireNotification(NotificationID.MouseIdleTimeout);
}
}
public bool HideMouseOnIdle
{
get => this._hideMouseOnIdle;
get => _hideMouseOnIdle;
set
{
if (this._hideMouseOnIdle == value)
if (_hideMouseOnIdle == value)
return;
this._hideMouseOnIdle = value;
this.SetWindowOptions(WindowOptions.MouseleaveOnIdle, value);
_hideMouseOnIdle = value;
SetWindowOptions(WindowOptions.MouseleaveOnIdle, value);
if (value)
this.IdleCursor = CursorID.None;
IdleCursor = CursorID.None;
else
this.IdleCursor = CursorID.NotSpecified;
this.FireNotification(NotificationID.HideMouseOnIdle);
IdleCursor = CursorID.NotSpecified;
FireNotification(NotificationID.HideMouseOnIdle);
}
}
public void RequestLoad(string source, Vector<UIPropertyRecord> properties)
{
if (this.Zone == null)
if (Zone == null)
{
this._initialSource = source;
this._initialProperties = properties;
_initialSource = source;
_initialProperties = properties;
}
else
this.Zone.RootViewItem.RequestSource(source, properties);
Zone.RootViewItem.RequestSource(source, properties);
}
public SavedKeyFocus SaveKeyFocus() => this.Zone != null && this.Zone.RootUI != null ? new SavedKeyFocus(this.Zone.RootUI.SaveKeyFocus()) : null;
public SavedKeyFocus SaveKeyFocus() => Zone != null && Zone.RootUI != null ? new SavedKeyFocus(Zone.RootUI.SaveKeyFocus()) : null;
public void RestoreKeyFocus(SavedKeyFocus state)
{
if (state == null)
return;
DeferredCall.Post(DispatchPriority.LayoutSync, new DeferredHandler(this.DeferredRestoreKeyFocus), state.Payload);
DeferredCall.Post(DispatchPriority.LayoutSync, new DeferredHandler(DeferredRestoreKeyFocus), state.Payload);
}
private void DeferredRestoreKeyFocus(object cookie)
{
if (this.Zone == null || this.Zone.RootUI == null)
if (Zone == null || Zone.RootUI == null)
return;
this.Zone.RootUI.RestoreKeyFocus(cookie);
Zone.RootUI.RestoreKeyFocus(cookie);
}
private void UpdateStyles()
{
FormStyleInfo formStyleInfo = new FormStyleInfo();
uint num1 = 100663296;
uint num2 = !this.ShowInTaskbar ? 128U : 262144U;
if (this.AlwaysOnTop)
uint num2 = !ShowInTaskbar ? 128U : 262144U;
if (AlwaysOnTop)
num2 |= 8U;
formStyleInfo.uStyleFullscreen = num1;
formStyleInfo.uExStyleFullscreen = num2;
uint num3 = num1 | 720896U;
uint num4 = !this.ShowWindowFrame ? num3 | 2147483648U : num3 | 12845056U;
uint num4 = !ShowWindowFrame ? num3 | 2147483648U : num3 | 12845056U;
formStyleInfo.uStyleRestored = num4;
formStyleInfo.uExStyleRestored = num2;
formStyleInfo.uStyleMinimized = num4;
formStyleInfo.uExStyleMinimized = num2;
formStyleInfo.uStyleMaximized = num4;
formStyleInfo.uExStyleMaximized = num2;
this.Styles = formStyleInfo;
Styles = formStyleInfo;
}
protected override void OnLoad()
{
base.OnLoad();
Graphic.EnsureFallbackImages();
this.OnInitialize();
this.Visible = true;
OnInitialize();
Visible = true;
}
internal override void OnShow(bool fShow, bool fFirstShow)
@@ -286,51 +286,51 @@ namespace Microsoft.Iris.UI
base.OnShow(fShow, fFirstShow);
if (!fShow || !fFirstShow)
return;
this.Session.InputManager.KeyFocusCanBeNull = false;
if (this._initialLoadComplete == null)
Session.InputManager.KeyFocusCanBeNull = false;
if (_initialLoadComplete == null)
return;
DeferredCall.Post(DispatchPriority.Idle, new SimpleCallback(this.DeliverIntialLoadCompleteCallback));
DeferredCall.Post(DispatchPriority.Idle, new SimpleCallback(DeliverIntialLoadCompleteCallback));
}
protected override void OnActivationChange()
{
this.FireNotification(NotificationID.Active);
FireNotification(NotificationID.Active);
base.OnActivationChange();
}
protected override void OnWindowStateChanged(bool fUnplanned) => this.FireNotification(NotificationID.WindowState);
protected override void OnWindowStateChanged(bool fUnplanned) => FireNotification(NotificationID.WindowState);
protected override void OnLocationChanged(Point position) => this.FireNotification(NotificationID.Position);
protected override void OnLocationChanged(Point position) => FireNotification(NotificationID.Position);
protected override void OnSizeChanged() => this.FireNotification(NotificationID.ClientSize);
protected override void OnSizeChanged() => FireNotification(NotificationID.ClientSize);
public bool MouseIsIdle => this._mouseIsIdle;
public bool MouseIsIdle => _mouseIsIdle;
protected override void OnMouseIdle(bool value)
{
if (this._mouseIsIdle != value)
if (_mouseIsIdle != value)
{
this._mouseIsIdle = value;
this.FireNotification(NotificationID.MouseActive);
_mouseIsIdle = value;
FireNotification(NotificationID.MouseActive);
}
base.OnMouseIdle(value);
}
private void DeliverIntialLoadCompleteCallback()
{
DeferredCall.Post(DispatchPriority.Idle, this._initialLoadComplete, null);
this._initialLoadComplete = null;
DeferredCall.Post(DispatchPriority.Idle, _initialLoadComplete, null);
_initialLoadComplete = null;
}
public void SetInitialLoadCompleteCallback(DeferredHandler callback) => this._initialLoadComplete = callback;
public void SetInitialLoadCompleteCallback(DeferredHandler callback) => _initialLoadComplete = callback;
public void Close() => this.RequestClose(FormCloseReason.UserRequest);
public void Close() => RequestClose(FormCloseReason.UserRequest);
protected override void OnCloseRequest(FormCloseReason nReason)
{
bool block = false;
if (this.CloseRequested != null)
this.CloseRequested(nReason, ref block);
if (CloseRequested != null)
CloseRequested(nReason, ref block);
if (block)
return;
base.OnCloseRequest(nReason);
@@ -341,9 +341,9 @@ namespace Microsoft.Iris.UI
protected override void OnDestroy()
{
base.OnDestroy();
this.Zone.Dispose(this);
this.Session.InputManager.InvalidKeyFocus -= new InvalidKeyFocusHandler(this.OnInvalidKeyFocus);
this.Session.Dispatcher.StopCurrentMessageLoop();
Zone.Dispose(this);
Session.InputManager.InvalidKeyFocus -= new InvalidKeyFocusHandler(OnInvalidKeyFocus);
Session.Dispatcher.StopCurrentMessageLoop();
NativeApi.SpDestroyNotifyWindow();
}
@@ -358,7 +358,7 @@ namespace Microsoft.Iris.UI
return;
}
}
this.SetDefaultKeyFocus();
SetDefaultKeyFocus();
}
protected override IntPtr OnAccGetObject(int wparam, int lparam)
@@ -373,7 +373,7 @@ namespace Microsoft.Iris.UI
if (rootAccessibleProxy.ClientBridge == null)
{
object accPtr2;
AccessibleProxy.CreateStdAccessibleObject(this.__WindowHandle, -4, AccessibleProxy.IID_IAccessible, out accPtr2);
AccessibleProxy.CreateStdAccessibleObject(__WindowHandle, -4, AccessibleProxy.IID_IAccessible, out accPtr2);
rootAccessibleProxy.AttachClientBridge((IAccessible)accPtr2);
}
}
@@ -390,18 +390,18 @@ namespace Microsoft.Iris.UI
int param1,
int param2)
{
return notification == NativeApi.NotificationType.GetObject ? this.OnAccGetObject(param1, param2) : new IntPtr(0);
return notification == NativeApi.NotificationType.GetObject ? OnAccGetObject(param1, param2) : new IntPtr(0);
}
private void FireNotification(string id)
{
if (this.PropertyChanged != null)
this.PropertyChanged(id);
this._notifier.Fire(id);
if (PropertyChanged != null)
PropertyChanged(id);
_notifier.Fire(id);
}
public event FormPropertyChangedHandler PropertyChanged;
void INotifyObject.AddListener(Listener listener) => this._notifier.AddListener(listener);
void INotifyObject.AddListener(Listener listener) => _notifier.AddListener(listener);
}
}
+102 -102
View File
@@ -40,39 +40,39 @@ namespace Microsoft.Iris.UI
public UIZone(UIForm form)
{
this._parentSession = form.Session;
this._form = form;
this._scale = Vector3.UnitVector;
this._rootUI = new Microsoft.Iris.UI.RootUI(this);
this._rootViewItem = new RootViewItem(this, _rootUI, form);
this._rootUI.SetRootItem(_rootViewItem);
this._cachedInputDeliveryData = new UIZone.InputDeliveryData();
this._cachedUIClassStorage = new UIClass[4][];
this._cachedUIClassStorageIndex = this._cachedUIClassStorage.Length - 1;
_parentSession = form.Session;
_form = form;
_scale = Vector3.UnitVector;
_rootUI = new Microsoft.Iris.UI.RootUI(this);
_rootViewItem = new RootViewItem(this, _rootUI, form);
_rootUI.SetRootItem(_rootViewItem);
_cachedInputDeliveryData = new UIZone.InputDeliveryData();
_cachedUIClassStorage = new UIClass[4][];
_cachedUIClassStorageIndex = _cachedUIClassStorage.Length - 1;
}
protected override void OnDispose()
{
base.OnDispose();
this._rootUI.Dispose(this);
this._rootUI = null;
_rootUI.Dispose(this);
_rootUI = null;
}
public UISession Session => this._parentSession;
public UISession Session => _parentSession;
public UIForm Form => this._form;
public UIForm Form => _form;
public RootViewItem RootViewItem => this._rootViewItem;
public RootViewItem RootViewItem => _rootViewItem;
public UIClass RootUI => _rootUI;
public bool ZonePhysicalVisible => this._physicalVisible;
public bool ZonePhysicalVisible => _physicalVisible;
public Size RootContainerSize => this._containerSize;
public Size RootContainerSize => _containerSize;
public Vector3 HostDisplayScale => this._scale;
public Vector3 HostDisplayScale => _scale;
public bool InfiniteLayoutLoopDetected => this._uncommittedLayouts > 153;
public bool InfiniteLayoutLoopDetected => _uncommittedLayouts > 153;
public ICookedInputSite MapInput(
IRawInputSite rawSource,
@@ -97,10 +97,10 @@ namespace Microsoft.Iris.UI
ICookedInputSite finalTarget,
InputInfo info)
{
UIZone.InputDeliveryData inputDeliveryData = this.GetInputDeliveryData();
UIZone.InputDeliveryData inputDeliveryData = GetInputDeliveryData();
inputDeliveryData.target = finalTarget as UIClass;
inputDeliveryData.sourceInputInfo = info;
inputDeliveryData.eventRoute = this.ComputeEventRoute((UIClass)endpoint, out inputDeliveryData.routingLength);
inputDeliveryData.eventRoute = ComputeEventRoute((UIClass)endpoint, out inputDeliveryData.routingLength);
if (inputDeliveryData.eventRoute != null)
--inputDeliveryData.routingLength;
return inputDeliveryData;
@@ -115,10 +115,10 @@ namespace Microsoft.Iris.UI
switch (focusType)
{
case InputDeviceType.Keyboard:
this.DoDeepFocusUpdates(ref this._keyFocusRouteList, deepFocusFlag, directFocusChild, param, UIClass.GetFocusUpdateProc(InputDeviceType.Keyboard));
DoDeepFocusUpdates(ref _keyFocusRouteList, deepFocusFlag, directFocusChild, param, UIClass.GetFocusUpdateProc(InputDeviceType.Keyboard));
break;
case InputDeviceType.Mouse:
this.DoDeepFocusUpdates(ref this._mouseFocusRouteList, deepFocusFlag, directFocusChild, param, UIClass.GetFocusUpdateProc(InputDeviceType.Mouse));
DoDeepFocusUpdates(ref _mouseFocusRouteList, deepFocusFlag, directFocusChild, param, UIClass.GetFocusUpdateProc(InputDeviceType.Mouse));
break;
}
}
@@ -130,16 +130,16 @@ namespace Microsoft.Iris.UI
switch (stage)
{
case EventRouteStages.Direct:
this.DeliverInputDirectWorker(data, false);
DeliverInputDirectWorker(data, false);
break;
case EventRouteStages.Bubbled:
this.DeliverInputIndirectWorker(data, false);
DeliverInputIndirectWorker(data, false);
break;
case EventRouteStages.Routed:
this.DeliverInputIndirectWorker(data, true);
DeliverInputIndirectWorker(data, true);
break;
case EventRouteStages.Unhandled:
this.DeliverInputDirectWorker(data, true);
DeliverInputDirectWorker(data, true);
break;
}
return data.routeTruncated && !routeTruncated ? InputDeliveryStatus.Truncated : InputDeliveryStatus.Normal;
@@ -147,10 +147,10 @@ namespace Microsoft.Iris.UI
public void UpdateCursor(UIClass changedUI)
{
if (this._form == null)
if (_form == null)
return;
UIClass uiClass = this.Session.InputManager.Queue.CurrentMouseFocus as UIClass;
if (changedUI != null && !this.IsChildADescendant(changedUI, uiClass))
UIClass uiClass = Session.InputManager.Queue.CurrentMouseFocus as UIClass;
if (changedUI != null && !IsChildADescendant(changedUI, uiClass))
return;
CursorID cursorId = CursorID.NotSpecified;
if (uiClass != null && uiClass.Zone == this)
@@ -164,76 +164,76 @@ namespace Microsoft.Iris.UI
}
if (cursorId == CursorID.NotSpecified)
cursorId = CursorID.Arrow;
this._form.Cursor = cursorId;
_form.Cursor = cursorId;
}
public bool IsChildADescendant(ITreeNode potentialParent, ITreeNode potentialChild) => potentialParent is Microsoft.Iris.Library.TreeNode treeNode && treeNode.HasDescendant(potentialChild as Microsoft.Iris.Library.TreeNode);
public bool IsChildKeyFocusable(ITreeNode child) => ((UIClass)child).IsKeyFocusable();
public bool IsChildRooted(ITreeNode child) => this.IsChildRooted((Microsoft.Iris.Library.TreeNode)child);
public bool IsChildRooted(ITreeNode child) => IsChildRooted((Microsoft.Iris.Library.TreeNode)child);
public bool IsChildRooted(Microsoft.Iris.Library.TreeNode child) => child.Zone == this;
public int RootAccessibilityID => 0;
protected void ResendPaintedContent() => this._rootViewItem?.ResendExistingContentTree();
protected void ResendPaintedContent() => _rootViewItem?.ResendExistingContentTree();
protected void OnContainerChange()
{
RootViewItem rootViewItem = this._rootViewItem;
RootViewItem rootViewItem = _rootViewItem;
if (rootViewItem == null || rootViewItem.IsDisposed)
return;
rootViewItem.MarkLayoutInvalid();
bool zonePhysicalVisible = this.ZonePhysicalVisible;
bool zonePhysicalVisible = ZonePhysicalVisible;
if (zonePhysicalVisible)
return;
rootViewItem.ApplyLayoutOutputs(true);
this._previousZonePhysicalVisibleFlag = zonePhysicalVisible;
_previousZonePhysicalVisibleFlag = zonePhysicalVisible;
}
protected void OnHostDisplayScaleChange() => this._rootViewItem?.NotifyEffectiveScaleChange(true);
protected void OnHostDisplayScaleChange() => _rootViewItem?.NotifyEffectiveScaleChange(true);
internal void ScheduleScaleChangeNotifications()
{
if (this._needScaleNotificationsFlag)
if (_needScaleNotificationsFlag)
return;
this.ScheduleUiTask(UiTask.Initialization);
this._needScaleNotificationsFlag = true;
ScheduleUiTask(UiTask.Initialization);
_needScaleNotificationsFlag = true;
}
internal void ScheduleFullyEnabledChangeNotifications()
{
if (this._needFullyEnabledNotificationsFlag)
if (_needFullyEnabledNotificationsFlag)
return;
this.ScheduleUiTask(UiTask.Initialization);
this._needFullyEnabledNotificationsFlag = true;
ScheduleUiTask(UiTask.Initialization);
_needFullyEnabledNotificationsFlag = true;
}
public void OnRenderDeviceReset() => this.ResendPaintedContent();
public void OnRenderDeviceReset() => ResendPaintedContent();
public void SetPhysicalVisible(bool visible)
{
if (this._physicalVisible == visible)
if (_physicalVisible == visible)
return;
this._physicalVisible = visible;
this.OnContainerChange();
_physicalVisible = visible;
OnContainerChange();
}
public void ResizeRootContainer(Size size)
{
if (!(this._containerSize != size))
if (!(_containerSize != size))
return;
this._containerSize = size;
this.OnContainerChange();
_containerSize = size;
OnContainerChange();
}
public void SetHostDisplayScale(Vector3 scale)
{
if (!(this._scale != scale))
if (!(_scale != scale))
return;
this._scale = scale;
this.OnHostDisplayScaleChange();
_scale = scale;
OnHostDisplayScaleChange();
}
public bool OnInboundKeyNavigation(
@@ -249,61 +249,61 @@ namespace Microsoft.Iris.UI
{
add
{
if (this.sessionInputEvent == null)
this.Session.InputManager.PreviewInput += new InputNotificationHandler(this.OnSessionInput);
this.sessionInputEvent += value;
if (sessionInputEvent == null)
Session.InputManager.PreviewInput += new InputNotificationHandler(OnSessionInput);
sessionInputEvent += value;
}
remove
{
this.sessionInputEvent -= value;
if (this.sessionInputEvent != null)
sessionInputEvent -= value;
if (sessionInputEvent != null)
return;
this.Session.InputManager.PreviewInput -= new InputNotificationHandler(this.OnSessionInput);
Session.InputManager.PreviewInput -= new InputNotificationHandler(OnSessionInput);
}
}
private void OnSessionInput(object sender, InputNotificationEventArgs args) => this.sessionInputEvent(args.InputInfo, args.HandledStage);
private void OnSessionInput(object sender, InputNotificationEventArgs args) => sessionInputEvent(args.InputInfo, args.HandledStage);
protected void ImplementUiTask(UiTask task, object param)
{
switch (task)
{
case UiTask.Initialization:
this.DeliverInitializations();
DeliverInitializations();
break;
case UiTask.LayoutComputation:
ILayoutNode rootViewItem1 = _rootViewItem;
if (rootViewItem1 == null)
break;
ScrollingLayout.ResetScrollFocusIntoView();
if (this.ZonePhysicalVisible)
if (ZonePhysicalVisible)
{
Size rootContainerSize = this.RootContainerSize;
Size rootContainerSize = RootContainerSize;
rootViewItem1.Measure(rootContainerSize);
rootViewItem1.Arrange(new LayoutSlot(rootContainerSize));
++this._uncommittedLayouts;
this.ScheduleUiTask(UiTask.Painting);
++_uncommittedLayouts;
ScheduleUiTask(UiTask.Painting);
}
else
rootViewItem1.MarkHidden();
rootViewItem1.Commit();
this._rootViewItem.ResetLayoutInvalid();
_rootViewItem.ResetLayoutInvalid();
break;
case UiTask.LayoutApplication:
ViewItem rootViewItem2 = _rootViewItem;
if (rootViewItem2 == null)
break;
bool zonePhysicalVisible = this.ZonePhysicalVisible;
rootViewItem2.ApplyLayoutOutputs(this._previousZonePhysicalVisibleFlag != zonePhysicalVisible);
this._previousZonePhysicalVisibleFlag = zonePhysicalVisible;
bool zonePhysicalVisible = ZonePhysicalVisible;
rootViewItem2.ApplyLayoutOutputs(_previousZonePhysicalVisibleFlag != zonePhysicalVisible);
_previousZonePhysicalVisibleFlag = zonePhysicalVisible;
break;
case UiTask.Painting:
if (this._rootViewItem != null)
if (_rootViewItem != null)
{
this._rootViewItem.UISession.Dispatcher.RequestBatchFlush();
this._rootViewItem.PaintTree(true);
_rootViewItem.UISession.Dispatcher.RequestBatchFlush();
_rootViewItem.PaintTree(true);
}
this._uncommittedLayouts = 0;
_uncommittedLayouts = 0;
break;
}
}
@@ -323,7 +323,7 @@ namespace Microsoft.Iris.UI
bool handled = sourceInputInfo.Handled;
target.DeliverInput(sourceInputInfo, EventRouteStages.Routed);
if (sourceInputInfo.Handled != handled)
this.TraceHandled(traceLevelForEvent, sourceInputInfo, target);
TraceHandled(traceLevelForEvent, sourceInputInfo, target);
if (sourceInputInfo.RouteTruncated && !data.routeTruncated)
{
data.routeTruncated = true;
@@ -340,7 +340,7 @@ namespace Microsoft.Iris.UI
bool handled = sourceInputInfo.Handled;
target.DeliverInput(sourceInputInfo, EventRouteStages.Bubbled);
if (sourceInputInfo.Handled != handled)
this.TraceHandled(traceLevelForEvent, sourceInputInfo, target);
TraceHandled(traceLevelForEvent, sourceInputInfo, target);
if (sourceInputInfo.RouteTruncated && !data.routeTruncated)
{
data.routeTruncated = true;
@@ -364,7 +364,7 @@ namespace Microsoft.Iris.UI
target.DeliverInput(sourceInputInfo, stage);
if (sourceInputInfo.Handled == handled)
return;
this.TraceHandled(traceLevelForEvent, sourceInputInfo, target);
TraceHandled(traceLevelForEvent, sourceInputInfo, target);
}
private void TraceHandled(byte traceLevel, InputInfo info, UIClass target)
@@ -373,8 +373,8 @@ namespace Microsoft.Iris.UI
private UIZone.InputDeliveryData GetInputDeliveryData()
{
UIZone.InputDeliveryData inputDeliveryData = this._cachedInputDeliveryData;
this._cachedInputDeliveryData = null;
UIZone.InputDeliveryData inputDeliveryData = _cachedInputDeliveryData;
_cachedInputDeliveryData = null;
if (inputDeliveryData == null)
inputDeliveryData = new UIZone.InputDeliveryData();
return inputDeliveryData;
@@ -388,23 +388,23 @@ namespace Microsoft.Iris.UI
inputDeliveryData.target = null;
inputDeliveryData.sourceInputInfo = null;
if (!inputDeliveryData.eventRouteCached)
this.RecycleUIClassArray(inputDeliveryData.eventRoute);
RecycleUIClassArray(inputDeliveryData.eventRoute);
else
inputDeliveryData.eventRouteCached = false;
inputDeliveryData.eventRoute = null;
inputDeliveryData.routingLength = 0;
inputDeliveryData.routeTruncated = false;
this._cachedInputDeliveryData = inputDeliveryData;
_cachedInputDeliveryData = inputDeliveryData;
}
private UIClass[] GetUIClassArray(int requiredLength)
{
UIClass[] uiClassArray = null;
if (this._cachedUIClassStorageIndex >= 0)
if (_cachedUIClassStorageIndex >= 0)
{
uiClassArray = this._cachedUIClassStorage[this._cachedUIClassStorageIndex];
this._cachedUIClassStorage[this._cachedUIClassStorageIndex] = null;
--this._cachedUIClassStorageIndex;
uiClassArray = _cachedUIClassStorage[_cachedUIClassStorageIndex];
_cachedUIClassStorage[_cachedUIClassStorageIndex] = null;
--_cachedUIClassStorageIndex;
}
if (uiClassArray == null || uiClassArray.Length < requiredLength)
uiClassArray = new UIClass[requiredLength];
@@ -413,11 +413,11 @@ namespace Microsoft.Iris.UI
private void RecycleUIClassArray(UIClass[] storage)
{
if (storage == null || this._cachedUIClassStorageIndex >= this._cachedUIClassStorage.Length - 1)
if (storage == null || _cachedUIClassStorageIndex >= _cachedUIClassStorage.Length - 1)
return;
++this._cachedUIClassStorageIndex;
++_cachedUIClassStorageIndex;
Array.Clear(storage, 0, storage.Length);
this._cachedUIClassStorage[this._cachedUIClassStorageIndex] = storage;
_cachedUIClassStorage[_cachedUIClassStorageIndex] = storage;
}
private UIClass[] ComputeEventRoute(UIClass endpoint, out int entriesCount)
@@ -427,7 +427,7 @@ namespace Microsoft.Iris.UI
return null;
for (UIClass uiClass = endpoint; uiClass != null; uiClass = uiClass.Parent)
++entriesCount;
UIClass[] uiClassArray = this.GetUIClassArray(entriesCount);
UIClass[] uiClassArray = GetUIClassArray(entriesCount);
UIClass uiClass1 = endpoint;
int num = entriesCount;
for (; uiClass1 != null; uiClass1 = uiClass1.Parent)
@@ -454,12 +454,12 @@ namespace Microsoft.Iris.UI
refCurrentFocusRouteList = uiClassArray2;
if (inputDeliveryData != null)
inputDeliveryData.eventRouteCached = true;
UIClass[] removedFromRoute = this.FindControlsRemovedFromRoute(uiClassArray1, uiClassArray2);
UIClass[] removedFromRoute = FindControlsRemovedFromRoute(uiClassArray1, uiClassArray2);
if (removedFromRoute != null)
UpdateControlFocusStates(removedFromRoute, false, null, updateProc);
this.RecycleUIClassArray(uiClassArray1);
RecycleUIClassArray(uiClassArray1);
if (removedFromRoute != uiClassArray1)
this.RecycleUIClassArray(removedFromRoute);
RecycleUIClassArray(removedFromRoute);
if (uiClassArray2 == null)
return;
UpdateControlFocusStates(uiClassArray2, true, directFocusChild, updateProc);
@@ -496,7 +496,7 @@ namespace Microsoft.Iris.UI
if (Array.IndexOf<UIClass>(newRouteList, oldRoute) < 0)
{
if (uiClassArray == null)
uiClassArray = this.GetUIClassArray(oldRouteList.Length - index);
uiClassArray = GetUIClassArray(oldRouteList.Length - index);
uiClassArray[num++] = oldRoute;
}
}
@@ -534,18 +534,18 @@ namespace Microsoft.Iris.UI
{
while (true)
{
while (this._needFullyEnabledNotificationsFlag)
while (_needFullyEnabledNotificationsFlag)
{
this._needFullyEnabledNotificationsFlag = false;
_needFullyEnabledNotificationsFlag = false;
UIClass rootUi = _rootUI;
if (rootUi != null)
rootUi.DeliverFullyEnabled(true);
else
break;
}
if (this._needScaleNotificationsFlag)
if (_needScaleNotificationsFlag)
{
this._needScaleNotificationsFlag = false;
_needScaleNotificationsFlag = false;
ViewItem rootViewItem = _rootViewItem;
if (rootViewItem != null)
rootViewItem.DeliverEffectiveScaleChange(false);
@@ -561,23 +561,23 @@ namespace Microsoft.Iris.UI
public void ScheduleUiTask(UiTask task)
{
uint num = (uint)(task & (UiTask)~(int)this._tasksRequestedValue);
uint num = (uint)(task & (UiTask)~(int)_tasksRequestedValue);
if (num == 0U)
return;
this._tasksRequestedValue |= num;
this._parentSession.ScheduleUiTask(task);
_tasksRequestedValue |= num;
_parentSession.ScheduleUiTask(task);
}
public void ProcessUiTask(UiTask task, object param)
{
uint num = (uint)task;
if (((int)this._tasksRequestedValue & (int)num) == 0)
if (((int)_tasksRequestedValue & (int)num) == 0)
return;
this._tasksRequestedValue &= ~num;
this.ImplementUiTask(task, param);
_tasksRequestedValue &= ~num;
ImplementUiTask(task, param);
}
public override string ToString() => this.GetType().Name + "[" + _form + "]";
public override string ToString() => GetType().Name + "[" + _form + "]";
private class InputDeliveryData
{
File diff suppressed because it is too large Load Diff
+13 -13
View File
@@ -16,35 +16,35 @@ namespace Microsoft.Iris.UI
public ViewItemID(int id)
{
this._id = id;
this._stringPart = null;
_id = id;
_stringPart = null;
}
public ViewItemID(string stringPart)
{
this._id = -1;
this._stringPart = stringPart;
_id = -1;
_stringPart = stringPart;
}
public ViewItemID(int id, string stringPart)
{
this._id = id;
this._stringPart = stringPart;
_id = id;
_stringPart = stringPart;
}
public bool IDValid => this._id != -1;
public bool IDValid => _id != -1;
public bool StringPartValid => this._stringPart != null;
public bool StringPartValid => _stringPart != null;
public int ID => this._id;
public int ID => _id;
public string StringPart => this._stringPart;
public string StringPart => _stringPart;
public override string ToString()
{
if (!this.StringPartValid)
return this._id.ToString();
return !this.IDValid ? this._stringPart : InvariantString.Format("{0} {1}", _stringPart, _id);
if (!StringPartValid)
return _id.ToString();
return !IDValid ? _stringPart : InvariantString.Format("{0} {1}", _stringPart, _id);
}
}
}