forked from AdvDebug/NetShield_Protector
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRainbowText.cs
41 lines (36 loc) · 1.38 KB
/
RainbowText.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Transitions;
using System.Windows.Forms;
using System.Drawing;
namespace NetShield_Protector
{
class RainbowObj
{
public RainbowObj(object Obj, string PropertyName, ITransitionType TransitionType, int interval = 100)
{
timer = new Timer() { Interval = interval };
timer.Tick += timerFunc;
transitionType = TransitionType;
propertyName = PropertyName;
obj = Obj;
colorCycle = new Color[] { Color.Red, Color.Magenta, Color.Blue, Color.Cyan, Color.Green, Color.Yellow };
}
private Timer timer { get; set; }
public object obj {get;set;}
public Color[] colorCycle {get;set;}
public ITransitionType transitionType { get; set; }
public string propertyName { get; set; }
public void Start() { timer.Start(); }
public void Stop() { timer.Stop(); }
public int currentColorIndex = 0;
private void timerFunc(object sender, EventArgs e)
{
if (currentColorIndex >= colorCycle.Count()) { currentColorIndex = 0; }
if (obj is Control) { ((Control)obj).Update(); }
Transition.run(obj, propertyName, colorCycle[currentColorIndex++], transitionType);
}
}
}