/// <summary> /// _progressBar initialisation. /// </summary> private void OnIntialize() { _progressBar = new Tizen.NUI.Components.Progress(); _progressBar.ParentOrigin = ParentOrigin.TopLeft; _progressBar.PivotPoint = PivotPoint.TopLeft; _progressBar.Focusable = true; _progressBar.Size2D = new Size2D(1728, 4); _progressBar.ProgressImageURL = progressImage; _progressBar.TrackImageURL = trackImage; _progressBar.MinValue = 0.0f; _progressBar.MaxValue = 100.0f; _progressBar.ProgressState = Tizen.NUI.Components.Progress.ProgressStatusType.Indeterminate; _progressBar.TooltipText = "progressBar"; // Change _progressBar's Indeterminate. _progressBar.KeyEvent += (obj, e) => { if (e.Key.KeyPressedName == "Return") { if (_progressBar.ProgressState == Tizen.NUI.Components.Progress.ProgressStatusType.Indeterminate) { _progressBar.ProgressState = Tizen.NUI.Components.Progress.ProgressStatusType.Determinate; } else { _progressBar.ProgressState = Tizen.NUI.Components.Progress.ProgressStatusType.Indeterminate; } } return(false); }; }
/// <summary> /// Dispose progressBar /// </summary> public void Deactivate() { Window.Instance.GetDefaultLayer().Remove(guide); guide.Dispose(); guide = null; Window.Instance.GetDefaultLayer().Remove(percentage); percentage.Dispose(); percentage = null; Window.Instance.GetDefaultLayer().Remove(progressBar); progressBar.Dispose(); progressBar = null; }
/// <summary> /// ProgressBar initialisation. /// </summary> private void Initialize() { Window.Instance.BackgroundColor = Color.Black; guide = new TextLabel(); guide.HorizontalAlignment = HorizontalAlignment.Center; guide.VerticalAlignment = VerticalAlignment.Center; guide.PositionUsesPivotPoint = true; guide.ParentOrigin = ParentOrigin.TopLeft; guide.PivotPoint = PivotPoint.TopLeft; guide.Size2D = new Size2D(1920, 96); guide.FontFamily = "Samsung One 600"; guide.Position2D = new Position2D(0, 94); guide.MultiLine = false; //guide.PointSize = 15.0f; guide.PointSize = DeviceCheck.PointSize15; guide.Text = "ProgressBar Sample \n"; guide.TextColor = Color.White; //guide.BackgroundColor = new Color(43.0f / 255.0f, 145.0f / 255.0f, 175.0f / 255.0f, 1.0f); Window.Instance.GetDefaultLayer().Add(guide); Progress progressSample = new Progress(); progressBar = progressSample.GetProgressBar(); progressBar.Position = new Position(100, 540, 0); Window.Instance.GetDefaultLayer().Add(progressBar); percentage = new TextLabel(); percentage.HorizontalAlignment = HorizontalAlignment.Center; percentage.VerticalAlignment = VerticalAlignment.Center; percentage.PositionUsesPivotPoint = true; percentage.ParentOrigin = ParentOrigin.TopLeft; percentage.PivotPoint = PivotPoint.TopLeft; percentage.Size2D = new Size2D(200, 80); percentage.FontFamily = "Samsung One 400"; percentage.Position2D = new Position2D(1700, 440); percentage.MultiLine = false; percentage.PointSize = DeviceCheck.PointSize10; percentage.Text = (progressBar.CurrentValue * 100).ToString() + "%"; percentage.TextColor = Color.White; Window.Instance.GetDefaultLayer().Add(percentage); // Create timer. In this timer tick, // change the progressBar's value. Timer timer = new Timer(50); timer.Tick += (obj, e) => { if (progressBar != null) { float progress = (float)Math.Round(progressBar.CurrentValue, 2); if (progress == 1.0f) { progressBar.CurrentValue = 0.0f; percentage.Text = (progressBar.CurrentValue * 100).ToString() + "%"; return(false); } else { progressBar.CurrentValue = progress + 0.01f; percentage.Text = (progressBar.CurrentValue * 100).ToString() + "%"; return(true); } } else { return(true); } }; timer.Start(); }