/// <summary> /// 旋转动画(新开一个线程) /// </summary> /// <returns></returns> private async Task StartRotationAnimation() { var centerX = (float)(RefreshIcon.ActualWidth / 2); var centerY = (float)(RefreshIcon.ActualHeight / 2); await Task.Run(async() => { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { while (_isRefreshing) { await RefreshIcon.Rotate(_rotationDegree, centerX, centerY, 1000, 0, EasingType.Linear) .StartAsync(); _rotationDegree += 360; } }); }); }
/// <summary> /// Initializes a new instance of the RefreshLayout class. /// </summary> /// <param name="parent"></param> public RefreshLayout(EvasObject parent) : base(parent) { MinimumHeight = _minimumSize; _refreshState = RefreshState.Idle; _refreshIcon = new RefreshIcon(parent); _contentLayout = new Box(parent); _refreshIcon.Show(); _contentLayout.Show(); _gestureLayer = new GestureLayer(parent); _gestureLayer.Attach(_contentLayout); _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Move, OnMoved); _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.End, OnEnded); _gestureLayer.SetMomentumCallback(GestureLayer.GestureState.Abort, OnEnded); this.PackEnd(_contentLayout); this.PackEnd(_refreshIcon); SetLayoutCallback(OnLayoutUpdate); }
/// <summary> /// Initializes a new instance of the RefreshLayout class. /// </summary> public RefreshLayout() { _overlayArea = new View { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; Add(_overlayArea); _refreshIcon = new RefreshIcon { Opacity = 0 }; _overlayArea.Add(_refreshIcon); _panGestureDetector = new PanGestureDetector(); _panGestureDetector.Attach(this); _panGestureDetector.Detected += OnDetected; LayoutUpdated += OnLayout; _refreshState = RefreshState.Idle; }
public void LoadImageName() { // open folder, get all filenames //AppDomain.CurrentDomain.BaseDirectory string path = AppDomain.CurrentDomain.BaseDirectory + foldername; string[] filenames = Directory.GetFiles(path); // check filename to assign to variables foreach (var fullname in filenames) { string filename = Path.GetFileName(fullname); string[] tokens = StringProcess.SplitString(filename, new string[] { "_" }); if (tokens[0].ToLower() == "Application".ToLower()) { ApplicationIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Option".ToLower()) { OptionIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Remove".ToLower()) { RemoveIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "RemoveAll".ToLower()) { RemoveAllIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Add".ToLower()) { AddIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Preview".ToLower()) { PreviewIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Start".ToLower()) { StartIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Refresh".ToLower()) { RefreshIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Help".ToLower()) { HelpIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Open".ToLower()) { OpenIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Save".ToLower()) { SaveIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Information".ToLower()) { InformationIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "File".ToLower()) { FileIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Folder".ToLower()) { FolderIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "Action".ToLower()) { ActionIcon.Add ( new MyString() { Value = path + filename } ); } else if (tokens[0].ToLower() == "List".ToLower()) { ListIcon.Add ( new MyString() { Value = path + filename } ); } } }
public override View Run() { var scrollview = new Tizen.UIExtensions.NUI.ScrollView(); scrollview.ContentContainer.Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, }; var view = scrollview.ContentContainer; view.Add(new Label { Text = "RefreshIcon Test", TextColor = Color.White, FontSize = 9, FontAttributes = Tizen.UIExtensions.Common.FontAttributes.Bold, VerticalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Center, WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 100, Padding = new Extents(20, 10, 10, 10), BackgroundColor = Color.FromHex("#2196f3").ToNative(), BoxShadow = new Shadow(5, Color.FromHex("#bbbbbb").ToNative(), new Vector2(0, 5)) }); view.Add(new View { SizeHeight = 20, }); var hlayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, }, //BackgroundColor = Tizen.NUI.Color.Gray, Padding = 10, }; var refreshIcon = new RefreshIcon { BorderlineColor = Tizen.NUI.Color.Red, BorderlineWidth = 2f, }; refreshIcon.SizeHeight = (float)refreshIcon.Measure(300, 300).Height; refreshIcon.SizeWidth = (float)refreshIcon.Measure(300, 300).Width; hlayout.Add(refreshIcon); var refreshIcon2 = new RefreshIcon { Color = Color.Red, BackgroundColor = Color.Yellow, }; refreshIcon2.SizeHeight = (float)refreshIcon2.Measure(300, 300).Height; refreshIcon2.SizeWidth = (float)refreshIcon2.Measure(300, 300).Width; hlayout.Add(refreshIcon2); view.Add(hlayout); var slider1 = new Slider { Value = 0, Minimum = 0, Maximum = 1, SizeHeight = 50, WidthSpecification = LayoutParamPolicies.MatchParent, }; view.Add(slider1); slider1.ValueChanged += (s, e) => { refreshIcon.PullDistance = (float)slider1.Value; refreshIcon2.PullDistance = (float)slider1.Value; }; var switch1 = new Switch() { SizeHeight = 50, WidthSpecification = LayoutParamPolicies.MatchParent, }; view.Add(switch1); switch1.Toggled += (s, e) => { refreshIcon.IsRunning = switch1.IsToggled; refreshIcon2.IsRunning = switch1.IsToggled; }; return(scrollview); }
/// <summary> /// Click the refresh icon on the main menu /// </summary> public void ClickRefreshIcon() { RefreshIcon.WaitRetry(_driver).Click(); }
public void LoadImageName() { // open folder, get all filenames string path = AppDomain.CurrentDomain.BaseDirectory + foldername; string[] filenames = Directory.GetFiles(path); // check filename to assign to variables foreach (var fullname in filenames) { string filename = Path.GetFileName(fullname); string[] tokens = filename.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); if (tokens[0].ToLower() == "Application".ToLower()) { ApplicationIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Option".ToLower()) { OptionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Remove".ToLower()) { RemoveIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "RemoveAll".ToLower()) { RemoveAllIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Add".ToLower()) { AddIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Preview".ToLower()) { PreviewIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Start".ToLower()) { StartIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Refresh".ToLower()) { RefreshIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Help".ToLower()) { HelpIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Open".ToLower()) { OpenIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Save".ToLower()) { SaveIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Information".ToLower()) { InformationIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "File".ToLower()) { FileIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Folder".ToLower()) { FolderIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "Action".ToLower()) { ActionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "List".ToLower()) { ListIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "UpDirection".ToLower()) { UpDirectionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "RightDirection".ToLower()) { RightDirectionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "DownDirection".ToLower()) { DownDirectionIcon.Add ( path + filename ); } else if (tokens[0].ToLower() == "LeftDirection".ToLower()) { LeftDirectionIcon.Add ( path + filename ); } else { Images.Add ( path + filename ); } } }