public override void Run(Window window) { Log.Debug(TestName, "CircleProgressBar run"); Conformant conformant = new Conformant(window); conformant.Show(); var surface = new CircleSurface(conformant); CircleProgressBar pb1 = new CircleProgressBar(conformant, surface) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, // bar Value = 0, Maximum = 100, Minimum = 0, BarRadius = 100, BarLineWidth = 15, BarColor = Color.Green, // background BackgroundRadius = 100, BackgroundLineWidth = 15, BackgroundColor = Color.Aqua, }; pb1.Show(); conformant.SetContent(pb1); Label lb1 = new Label(window) { Text = string.Format("S {0} %", pb1.Value), }; lb1.Resize(window.ScreenSize.Width, window.ScreenSize.Height); lb1.Move(160, window.ScreenSize.Height / 2 - 40); lb1.Show(); EcoreMainloop.AddTimer(0.05, () => { if (pb1.Value == pb1.Maximum / 2) { // Test purpose : set disable pb1.IsEnabled = false; } if (pb1.Value == pb1.Maximum) { EcoreMainloop.RemoveTimer(pb1); } pb1.Value += 1; lb1.Text = string.Format("S {0} %", pb1.Value); return(true); }); }
public override void Run(Window window) { Log.Debug(TestName, "CircleProgressBar run"); Conformant conformant = new Conformant(window); conformant.Show(); Naviframe naviframe = new Naviframe(window); naviframe.Show(); conformant.SetContent(naviframe); var surface = new CircleSurface(conformant); CircleProgressBar pb1 = new CircleProgressBar(naviframe, surface) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, Value = 0, Maximum = 100, Minimum = 0, }; pb1.Show(); naviframe.Push(pb1, null, "empty"); Label lb1 = new Label(window) { Text = string.Format("S {0} %", pb1.Value), }; lb1.Resize(window.ScreenSize.Width, window.ScreenSize.Height); lb1.Move(160, window.ScreenSize.Height / 2 - 40); lb1.Show(); EcoreMainloop.AddTimer(0.05, () => { if (pb1.Value == pb1.Maximum / 2) { // Test purpose : set disable pb1.IsEnabled = false; } if (pb1.Value == pb1.Maximum) { EcoreMainloop.RemoveTimer(pb1); } pb1.Value += 1; lb1.Text = string.Format("S {0} %", pb1.Value); return(true); }); }
public IDisposable Schedule <TState>(TState state, TimeSpan dueTime, Func <IScheduler, TState, IDisposable> action) { var innerDisp = Disposable.Empty; bool isCancelled = false; IntPtr timer = EcoreMainloop.AddTimer(dueTime.TotalSeconds, () => { if (!isCancelled) { innerDisp = action(this, state); } return(false); }); return(Disposable.Create(() => { isCancelled = true; EcoreMainloop.RemoveTimer(timer); innerDisp.Dispose(); })); }
public override void Run(Window window) { var square = window.GetInnerSquare(); Background bg = new Background(window) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, Color = Color.Gray }; bg.Show(); window.AddResizeObject(bg); Conformant conformant = new Conformant(window); conformant.Show(); int number = 0; bool bReturn = true; Label label1 = new Label(window); label1.Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 2); Button btnTimerSwitch = new Button(window); btnTimerSwitch.Text = "Timer : On"; btnTimerSwitch.Geometry = new Rect(square.X, square.Y + square.Height / 2, square.Width, square.Height / 2); Func <bool> handler = () => { label1.Text = (++number).ToString(); label1.EdjeObject["elm.text"].TextStyle = "DEFAULT='color=#000000 font_size=64 align=left valign=bottom wrap=word'"; return(bReturn); }; IntPtr prevId = EcoreMainloop.AddTimer(1.0, handler); btnTimerSwitch.Clicked += (s, e) => { if (bReturn) { bReturn = false; btnTimerSwitch.Text = "Timer : Off"; } else { bReturn = true; btnTimerSwitch.Text = "Timer : On"; EcoreMainloop.RemoveTimer(prevId); prevId = EcoreMainloop.AddTimer(1.0, handler); } }; window.BackButtonPressed += (s, e) => { EcoreMainloop.RemoveTimer(prevId); }; label1.Show(); btnTimerSwitch.Show(); }