mirror of
https://github.com/ZuneDev/ZuneShell.dll.git
synced 2026-07-27 13:11:51 -07:00
Simplified usages in UIX project
This commit is contained in:
@@ -22,49 +22,49 @@ namespace Microsoft.Iris.ViewItems
|
||||
|
||||
public TextRunRenderer()
|
||||
{
|
||||
this.Layout = this;
|
||||
this._renderingHelper = new TextFlowRenderingHelper();
|
||||
this._paintHandler = new PaintInvalidEventHandler(this.OnRunPaintInvalid);
|
||||
Layout = this;
|
||||
_renderingHelper = new TextFlowRenderingHelper();
|
||||
_paintHandler = new PaintInvalidEventHandler(OnRunPaintInvalid);
|
||||
}
|
||||
|
||||
protected override void OnDispose()
|
||||
{
|
||||
this.Data = null;
|
||||
Data = null;
|
||||
base.OnDispose();
|
||||
}
|
||||
|
||||
public TextRunData Data
|
||||
{
|
||||
get => this._data;
|
||||
get => _data;
|
||||
set
|
||||
{
|
||||
if (this._data == value)
|
||||
if (_data == value)
|
||||
return;
|
||||
if (this._data != null)
|
||||
if (_data != null)
|
||||
{
|
||||
this._data.PaintInvalid -= this._paintHandler;
|
||||
this._data.Run.UnregisterUsage(this);
|
||||
_data.PaintInvalid -= _paintHandler;
|
||||
_data.Run.UnregisterUsage(this);
|
||||
}
|
||||
this._data = value;
|
||||
if (this._data != null)
|
||||
_data = value;
|
||||
if (_data != null)
|
||||
{
|
||||
this._data.PaintInvalid += this._paintHandler;
|
||||
this._data.Run.RegisterUsage(this);
|
||||
_data.PaintInvalid += _paintHandler;
|
||||
_data.Run.RegisterUsage(this);
|
||||
}
|
||||
this.FireNotification(NotificationID.Data);
|
||||
FireNotification(NotificationID.Data);
|
||||
}
|
||||
}
|
||||
|
||||
public Color Color
|
||||
{
|
||||
get => this._color;
|
||||
get => _color;
|
||||
set
|
||||
{
|
||||
if (!(this._color != value))
|
||||
if (!(_color != value))
|
||||
return;
|
||||
this._color = value;
|
||||
this.MarkPaintInvalid();
|
||||
this.FireNotification(NotificationID.Color);
|
||||
_color = value;
|
||||
MarkPaintInvalid();
|
||||
FireNotification(NotificationID.Color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,44 +72,44 @@ namespace Microsoft.Iris.ViewItems
|
||||
|
||||
private void OnRunPaintInvalid()
|
||||
{
|
||||
this._renderingHelper.InvalidateGradients();
|
||||
this.MarkPaintInvalid();
|
||||
_renderingHelper.InvalidateGradients();
|
||||
MarkPaintInvalid();
|
||||
}
|
||||
|
||||
protected override bool HasContent() => this._data != null;
|
||||
protected override bool HasContent() => _data != null;
|
||||
|
||||
protected override void CreateContent() => base.CreateContent();
|
||||
|
||||
protected override void OnEffectChanged()
|
||||
{
|
||||
if (this._contents == null)
|
||||
if (_contents == null)
|
||||
return;
|
||||
this._contents.Effect = null;
|
||||
_contents.Effect = null;
|
||||
}
|
||||
|
||||
protected override void OnPaint(bool visible)
|
||||
{
|
||||
base.OnPaint(visible);
|
||||
if (this._contents == null || this._data == null)
|
||||
if (_contents == null || _data == null)
|
||||
return;
|
||||
TextRun run = this._data.Run;
|
||||
Text textViewItem = this._data.TextViewItem;
|
||||
TextRun run = _data.Run;
|
||||
Text textViewItem = _data.TextViewItem;
|
||||
if (!run.Visible)
|
||||
return;
|
||||
IImage imageForRun = Text.GetImageForRun(this.UISession, this._data.Run, this._color.A != 0 ? this._color : this._data.Color);
|
||||
if (this._contents.Effect == null)
|
||||
IImage imageForRun = Text.GetImageForRun(UISession, _data.Run, _color.A != 0 ? _color : _data.Color);
|
||||
if (_contents.Effect == null)
|
||||
{
|
||||
this._contents.Effect = EffectClass.CreateImageRenderEffectWithFallback(this.Effect, this, null);
|
||||
this._contents.Effect.UnregisterUsage(this);
|
||||
_contents.Effect = EffectClass.CreateImageRenderEffectWithFallback(Effect, this, null);
|
||||
_contents.Effect.UnregisterUsage(this);
|
||||
}
|
||||
EffectClass.SetDefaultEffectProperty(this.Effect, this._contents.Effect, imageForRun);
|
||||
this._contents.RelativeSize = true;
|
||||
this._contents.Size = Vector2.UnitVector;
|
||||
EffectClass.SetDefaultEffectProperty(Effect, _contents.Effect, imageForRun);
|
||||
_contents.RelativeSize = true;
|
||||
_contents.Size = Vector2.UnitVector;
|
||||
}
|
||||
|
||||
Size ILayout.Measure(ILayoutNode layoutNode, Size constraint)
|
||||
{
|
||||
Size constraint1 = Size.Min(this._data.Size, constraint);
|
||||
Size constraint1 = Size.Min(_data.Size, constraint);
|
||||
DefaultLayout.Measure(layoutNode, constraint1);
|
||||
return constraint1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user