Skip to content

Commit

Permalink
Swapped private property to variable
Browse files Browse the repository at this point in the history
  • Loading branch information
jonteohr committed Apr 22, 2024
1 parent 5300e78 commit 2bfb90c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions GradientTheme/Controls/TyperLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class TyperLabel : Label
private const int TypeSpeed = 150;
private const int TimerSpeed = 3;
private bool m_typing;
private string WindowTitle { get; set; }
private string m_windowTitle;
private string m_lastTitle;

private string[] m_titles;
Expand All @@ -20,13 +20,13 @@ public string[] Titles
set
{
m_titles = value;
Content = WindowTitle = GetRandomTitle();
Content = m_windowTitle = GetRandomTitle();
}
}

public TyperLabel()
{
var binding = new Binding("WindowTitle");
var binding = new Binding("m_windowTitle");
BindingOperations.SetBinding(this, TyperLabel.ContentProperty, binding);

var timer = new Timer();
Expand All @@ -43,23 +43,23 @@ private void TimerOnElapsed(object? sender, ElapsedEventArgs e)
{
m_typing = true;

m_lastTitle = WindowTitle;
m_lastTitle = m_windowTitle;

for (var i = WindowTitle.Length - 1; i < WindowTitle.Length; i--)
for (var i = m_windowTitle.Length - 1; i < m_windowTitle.Length; i--)
{
if (i < 0)
break;

WindowTitle = WindowTitle.Remove(i);
SafeThreadInvoker(() => Content = WindowTitle);
m_windowTitle = m_windowTitle.Remove(i);
SafeThreadInvoker(() => Content = m_windowTitle);
Thread.Sleep(TypeSpeed);
}

WindowTitle = GetRandomTitle();
m_windowTitle = GetRandomTitle();

for (var i = 0; i <= WindowTitle.Length; i++)
for (var i = 0; i <= m_windowTitle.Length; i++)
{
var tmp = WindowTitle.Substring(0, i);
var tmp = m_windowTitle.Substring(0, i);
SafeThreadInvoker(() => Content = tmp);
Thread.Sleep(TypeSpeed);
}
Expand Down

0 comments on commit 2bfb90c

Please sign in to comment.