public async Task When_ProgressRing_Visible() { const int expectedSize = #if __ANDROID__ 48; //Natively set as 48 for Android; 20 for other platforms #else 20; #endif var panel = new StackPanel(); var ring = new ProgressRing() { IsActive = true }; panel.Children.Add(ring); var border = new Border(); border.Child = panel; TestServices.WindowHelper.WindowContent = border; await TestServices.WindowHelper.WaitForIdle(); border.Measure(new Size(1000, 1000)); border.Arrange(new Rect(0, 0, 1000, 1000)); Assert.AreEqual(expectedSize, Math.Round(ring.ActualHeight)); }
private void InitializeComponent() { AvaloniaXamlLoader.Load(this); searchStatusRing = this.FindControl <ProgressRing>("SearchStatusRing"); statusLabel = this.FindControl <TextBlock>("StatusLabel"); deviceListBox = this.FindControl <ListBox>("DeviceListBox"); AppEnvironment.btService.BTFindStart += delegate { searchStatusRing.IsActive = true; deviceListBox.IsEnabled = false; }; AppEnvironment.btService.BTFindEnd += delegate { searchStatusRing.IsActive = false; deviceListBox.IsEnabled = true; }; this.Closed += delegate { AppEnvironment.btService.BTFindStart -= delegate { searchStatusRing.IsActive = true; }; AppEnvironment.btService.BTFindEnd -= delegate { searchStatusRing.IsActive = false; }; }; }
private void SetProgress() { if (this.Progress != null) { return; } bool available = false; lock (_progressCountLock) { if (_progressCount < 100) { _progressCount++; available = true; } } if (available) { var progress = new ProgressRing { IsActive = true }; progress.SetBinding(ProgressRing.BackgroundProperty, new Binding { Source = this, Path = new PropertyPath("Background") }); progress.SetBinding(ProgressRing.ForegroundProperty, new Binding { Source = this, Path = new PropertyPath("Foreground") }); this.Content = progress; } }
protected async void SetProgressRing(ProgressRing progressRing, bool value) { await this.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { progressRing.IsActive = value; }); }
public void InitializeComponent() { if (this._contentLoaded) { return; } this._contentLoaded = true; Application.LoadComponent((object)this, new Uri("/VKClient.Common;component/Profiles/Shared/Views/ProfilePage.xaml", UriKind.Relative)); this.Common = (VisualStateGroup)this.FindName("Common"); this.Loading = (VisualState)this.FindName("Loading"); this.Reloading = (VisualState)this.FindName("Reloading"); this.Blocked = (VisualState)this.FindName("Blocked"); this.Private = (VisualState)this.FindName("Private"); this.LoadingFailed = (VisualState)this.FindName("LoadingFailed"); this.Loaded = (VisualState)this.FindName("Loaded"); this.viewportControl = (ViewportControl)this.FindName("viewportControl"); this.stackPanelRoot = (StackPanel)this.FindName("stackPanelRoot"); this.canvasBackground = (Canvas)this.FindName("canvasBackground"); this.gridHeader = (Grid)this.FindName("gridHeader"); this.ucProfileInfoHeader = (ProfileInfoHeaderUC)this.FindName("ucProfileInfoHeader"); this.PhotoMenu = (ContextMenu)this.FindName("PhotoMenu"); this.borderHeaderPlaceholder = (Border)this.FindName("borderHeaderPlaceholder"); this.ucMedia = (MediaItemsHorizontalUC)this.FindName("ucMedia"); this.stackPanelNotLoaded = (StackPanel)this.FindName("stackPanelNotLoaded"); this.progressRing = (ProgressRing)this.FindName("progressRing"); this.textBlockLoadingStatus = (TextBlock)this.FindName("textBlockLoadingStatus"); this.buttonTryAgain = (Button)this.FindName("buttonTryAgain"); this.wallPanel = (MyVirtualizingPanel2)this.FindName("wallPanel"); this.ucHeader = (GenericHeaderUC)this.FindName("ucHeader"); this.ucPullToRefresh = (PullToRefreshUC)this.FindName("ucPullToRefresh"); }
protected override void OnApplyTemplate() { if (_cvMain == null) { _cvMain = GetTemplateChild("cvMain") as ContentView; _cvMain.SendMessage += _cvMain_SendMessage; } if (_prLoading == null) { _prLoading = GetTemplateChild("prLoading") as ProgressRing; } if (_tbSearchUrl == null) { _tbSearchUrl = GetTemplateChild("tbSearchUrl") as TextBox; _tbSearchUrl.KeyUp += _tbSearchUrl_KeyUp; } if (_tbText == null) { _tbText = GetTemplateChild("tbText") as TextBlock; } if (_butAddTab == null) { _butAddTab = GetTemplateChild("butAddTab") as Button; } base.OnApplyTemplate(); }
protected override void OnApplyTemplate() { if (_webView != null) { _webView.LoadCompleted -= OnLoadCompleted; } _progress = GetTemplateChild("progress") as ProgressRing; _webView = GetTemplateChild("webView") as WebView; if (_webView != null) { _webView.LoadCompleted += OnLoadCompleted; } _isInitialized = true; SetHtmlSource(HtmlSource); SetCSharpSource(CSharpSource); SetXamlSource(XamlSource); SetXmlSource(XmlSource); SetJsonSource(JsonSource); base.OnApplyTemplate(); }
public static void Initialize(Frame frame, NavigationView navigationView, ProgressRing progressRing) { Logger.WriteLine("Initializing NavigationService..."); Frame = frame; NavigationView = navigationView; ProgressRing = progressRing; // When header collection changes, update navigation view header Headers.CollectionChanged += (s, e) => { NavigationView.Header = (Headers.Count > 0) ? Headers.Peek() : ""; }; Frame.Navigated += (s, e) => { UpdateBackButtonVisibillity(); }; if (!Initialized) { Logger.WriteLine("NavigationService was not properly initialized."); } else { Logger.WriteLine("NavigationService was properly initialized."); } }
/// <summary> /// Called when the login button is pressed. Sends input data to the mobile sevice to login /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void LoginButton_Click(object sender, RoutedEventArgs e) { // Disable the button after press to stop multiple presses LoginButton.IsEnabled = false; // Login the user and then load data from the mobile service. Boolean LoginVerbose = true; // Display the progress wheel when logging in ProgressRing LoginProgress = new ProgressRing(); LoginProgress.HorizontalAlignment = HorizontalAlignment.Center; LoginProgress.VerticalAlignment = VerticalAlignment.Center; ContentRoot.Children.Add(LoginProgress); LoginProgress.IsActive = true; // Send the entered email and password to the account service to login if (await CustomAccountService.Login(EmailLogin.Text, PasswordLogin.Password, LoginVerbose)) { if (!Frame.Navigate(typeof(PivotPage))) { throw new Exception(this.resourceLoader.GetString("NavigationFailedExceptionMessage")); } } // Disable the progress wheel LoginProgress.IsActive = false; ContentRoot.Children.Remove(LoginProgress); // Reenable the button to prevent the user from getting stuck for any reason LoginButton.IsEnabled = true; }
private async Task LoadMoreAsync() { ProgressRing progressRing = new ProgressRing() { Visibility = Visibility.Visible, IsActive = true, }; LoadmoreBtn.Content = progressRing; LoadmoreBtn.IsEnabled = false; try { progressRing.Visibility = Visibility.Collapsed; tempList = await new Html2Class().DoVOAAsync(baseurl + pageIndex.ToString() + ".html"); pageIndex++; tempList.ForEach(x => source.Add(x)); LoadmoreBtn.Content = "点击加载更多~"; LoadmoreBtn.IsEnabled = true; } catch { pageIndex--; progressRing.Visibility = Visibility.Collapsed; LoadmoreBtn.IsEnabled = true; LoadmoreBtn.Content = "加载失败,点击重试~"; } }
public static void CaculateQuerySpan(WillCaculatefn fn, UIShow uishow, ContentControl ctl, ProgressRing progress) { #region string tmp = ""; progress.IsActive = true; DateTime starttime = DateTime.Now; fn.BeginInvoke(new AsyncCallback((IAsyncResult) => { DateTime endtime = DateTime.Now; if (MainWindow.IsConnectingDB) { tmp = string.Format("上次查询时长:{0}ms", (endtime - starttime).TotalMilliseconds); } else { tmp = "上次查询时长:超时!"; } ctl.Dispatcher.BeginInvoke(new UIShow(() => { ctl.Content = tmp; progress.IsActive = false; uishow.Invoke(); })); }), fn); #endregion }
public async void Connect(MetroWindow window, ProgressRing ring) { await Task.Run(() => { const string url = @"http://194.87.232.14:999"; //const string url = @"http://localhost:8080"; _connection = new HubConnection(url); _hub = _connection.CreateHubProxy("TransaqHub"); try { _connection.Start().Wait(); Application.Current.Dispatcher.Invoke(() => { window.HideOverlay(); ring.IsActive = false; }); _hub.On("ServerReply", msg => CheckServerReply(msg)); } catch (Exception e) { Application.Current.Dispatcher.Invoke(async() => { ring.IsActive = false; await window.ShowMessageAsync("Error", "Server is unavailable."); Application.Current.Shutdown(); }); } }); }
/// <summary> protected override void OnApplyTemplate() { base.OnApplyTemplate(); this.contentPresenter = this.GetTemplateChild("contentPresenter") as ContentPresenter; this.busyIndicator = this.GetTemplateChild("busyIndicator") as ProgressRing; }
void ReleaseDesignerOutlets() { if (DayText != null) { DayText.Dispose(); DayText = null; } if (NextButton != null) { NextButton.Dispose(); NextButton = null; } if (PreviousButton != null) { PreviousButton.Dispose(); PreviousButton = null; } if (ProgressRing != null) { ProgressRing.Dispose(); ProgressRing = null; } if (TableView != null) { TableView.Dispose(); TableView = null; } }
private Canvas CreateProgressBoard(string name) { Canvas canvas = new Canvas() { Name = name, Width = 50, Height = 50, Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.LightGray), Opacity = 0.7 }; Canvas.SetZIndex(canvas, 2); ProgressRing processingRing = new ProgressRing() { Width = 40, Height = 40, Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black), IsActive = true }; canvas.Children.Add(processingRing); HorizontalCenterOnCanvas(processingRing, canvas); VerticalCenterOnCanvas(processingRing, canvas); return(canvas); }
/// <summary> /// Called when the register button is pressed. Gets input boxes and sends to the mobile service to register /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void RegisterButton_Click(object sender, RoutedEventArgs e) { // Disable the button to prevent multiple attempts RegisterButton.IsEnabled = false; // Display the progress wheel when regstering ProgressRing LoginProgress = new ProgressRing(); LoginProgress.HorizontalAlignment = HorizontalAlignment.Center; LoginProgress.VerticalAlignment = VerticalAlignment.Center; ContentRoot.Children.Add(LoginProgress); LoginProgress.IsActive = true; // Send the email and password to the mobile service if (await CustomAccountService.Register(EmailRegister.Text, PasswordRegister.Password)) { if (!Frame.Navigate(typeof(PivotPage))) { throw new Exception(this.resourceLoader.GetString("NavigationFailedExceptionMessage")); } } // Disable the progress wheel LoginProgress.IsActive = false; ContentRoot.Children.Remove(LoginProgress); // Reenable the button when finished RegisterButton.IsEnabled = true; }
private async void CacheButton_OnClick(object sender, RoutedEventArgs e) { if ((String)CacheButton.Content == "缓存") { CacheButton.IsEnabled = false; var progressRing = new ProgressRing(); progressRing.IsActive = true; CacheButton.Content = progressRing; CacheProgressBar.Visibility = Visibility.Visible; Download(this.Uri, this.Name); } else if ((String)CacheButton.Content == "取消缓存") { CacheButton.IsEnabled = false; var progressRing = new ProgressRing(); progressRing.IsActive = true; CacheButton.Content = progressRing; CacheProgressBar.Visibility = Visibility.Collapsed; var file = await MediaManager.Instance.SaveFolder.GetFileAsync(this.Name); await file.DeleteAsync(); CacheButton.Content = "缓存"; CacheButton.IsEnabled = true; MediaManager.Instance.LoadCachedItems(); } }
private void ShowLoader(Panel control) { var rect = new Rectangle { Margin = new Thickness(0), Fill = new SolidColorBrush(WPFColor.FromArgb(192, 40, 40, 40)), Name = "prLoaderContainer" }; var loader = new ProgressRing { Foreground = (Brush)FindResource("AccentColorBrush"), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Width = 80, Height = 80, IsActive = true, Name = "prLoader" }; Panel.SetZIndex(rect, 10000); Panel.SetZIndex(loader, 10001); control.Children.Add(rect); control.Children.Add(loader); }
protected override void OnApplyTemplate() { base.OnApplyTemplate(); _scrollViewer = GetTemplateChild(ScrollViewerName) as ScrollViewer; _manipulationCanvas = GetTemplateChild(ManipulationCanvasName) as Canvas; _dragCanvas = GetTemplateChild(DragCanvasName) as Canvas; _progressRing = GetTemplateChild(ProgressRingName) as ProgressRing; if (_dragCanvas == null || _manipulationCanvas == null || _scrollViewer == null || _progressRing == null) { throw new Exception("Container missing in CatrobatListViewWorker"); } _dragCanvas.Tapped += _dragCanvas_Tapped; _dragCanvas.RightTapped += _dragCanvas_RightTapped; _dragCanvas.PointerPressed += _dragCanvas_PointerPressed; this.ManipulationDelta += CatrobatListViewWorker_ManipulationDelta; this.ManipulationCompleted += CatrobatListViewWorker_ManipulationCompleted; this.PointerReleased += CatrobatListViewWorker_PointerReleased; SetReorderEnabled(this._reorderEnabled); SetGroupingEnabled(this.GroupingEnabled); InitReorderableEmptyDummyControl(); }
/// <summary> /// 生成时初始化课程 /// </summary> /// <param name="titile">标题</param> /// <param name="subtitle">子标题</param> /// <param name="progress">当前进度</param> public void Construct(string titile, string subtitle, int progress) { _progressRing = GetComponentInChildren <ProgressRing>(); transform.GetChild(0).GetComponent <Text>().text = titile; transform.GetChild(1).GetComponent <Text>().text = subtitle; _progressRing.SetProgress(progress); }
private async Task GetCategoryData() { // Display the progress wheel when getting data ProgressRing LoginProgress = new ProgressRing(); LoginProgress.HorizontalAlignment = HorizontalAlignment.Center; LoginProgress.VerticalAlignment = VerticalAlignment.Center; ContentRoot.Children.Add(LoginProgress); LoginProgress.IsActive = true; // Get the list of category names from the database to display in the choice box List <string> CategoryNames = new List <string>(); IMobileServiceTable <Category> CategoryTable = App.alltheairgeadClient.GetTable <Category>(); Categories = await CategoryTable.ToListAsync(); // Add each to a list of names to set as the item source for the box foreach (Category i in Categories) { CategoryNames.Add(i.id); } CategoryBox.ItemsSource = CategoryNames; // Disable the progress wheel LoginProgress.IsActive = false; ContentRoot.Children.Remove(LoginProgress); }
public ProgressRingHelper(Grid targetGrid, int size = 50) { _progressRing = null; _targetGrid = targetGrid as Grid; if (_targetGrid != null) { _progressRing = new ProgressRing() { Width = size, Height = size, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, IsActive = true }; Panel.SetZIndex(_progressRing, Panel.GetZIndex(_targetGrid) + 1); _targetGrid.Children.Add(_progressRing); } else { Dispose(); } }
//load comment for entry protected async void tryLoadContent() { //set the current page details & reformate details newsTitleTB.Text = story.title; newsDateTB.Text = reformatString(story.date, "\n"); newsPubliserTb.Text = "Publisher: " + reformatString(story.by, "\n"); newsUrlTb.Text = "Url: " + reformatString(story.url, "\n"); newsScoreTb.Text = reformatString(story._lscore, "\n"); //Show loading ProgressRing progressRing1 = new ProgressRing(); progressRing1.IsActive = true; loaderRing.Children.Add(progressRing1); //load sub comments HNewsItemModel tmpHns; int iCnt = 0;//@todo: This should be a setting param foreach (string id in story.kids) { progressRing1.IsActive = false; tmpHns = await hnApiCli.getStoryById(id); comments.Add( tmpHns ); //Load 100 articles only if (++iCnt == 100) { break; } } }
public HomePage() { InitializeComponent(); var progressRing = new ProgressRing { RingThickness = 5, Progress = 0.34f, RingBaseColor = Color.Gray, RingProgressColor = Color.Blue, Scale = 10 }; ParchmentButton.Text = AppResources.TranslationApplyforParchment; /* List<Qualification> Qualifications = Proxy.GetQualifications(App._Id); * qualListView.ItemsSource = Qualifications; * List<Competency> compList = new List<Competency>(); * foreach (Qualification q in Qualifications) * { q.Progress = Proxy.CalQualProgress(App._Id, q.QualCode); * compList = Proxy.GetCompetencies(App._Id, q.QualCode); * q.DoneC = compList.Where(c => c.Results == "PA").Count(c => c.CompTypeCode == "C"); * q.DoneE = compList.Where(c => c.Results == "PA").Count(c => c.CompTypeCode == "E"); * q.DoneLE=compList.Where(c=>c.Results=="PA").Count(c=>c.CompTypeCode=="LE") + compList.Where(c => c.Results == "PA").Count(c => c.CompTypeCode == "C_SUP"); * if (q.Progress==1) * { * q.DoneTotal = q.TotalUnits; * ParchmentButton.IsEnabled = true; * } * else * { * q.DoneTotal = q.DoneC + q.DoneE + q.DoneLE; * } * q.StringCoreResult= String.Format("Core Units: {0} of {1}", q.DoneC, q.CoreUnits); * q.StringElectiveResult = String.Format("Elective Units: {0} of {1}", q.DoneE, q.ElectedUnits); * q.StringLEResult = String.Format("Elective Units: {0} of {1}", q.DoneLE, q.ReqListedElectedUnits); * q.StringTotalResult= String.Format("Total Units: {0} of {1}", q.DoneTotal, q.TotalUnits); * q.StringProgress = String.Format(q.Progress * 100 + " %"); * } */ }
public Task When_ProgressRing_Collapsed() => RunOnUIThread.Execute(() => { var SUT = new ProgressRing { Visibility = Visibility.Collapsed }; var spacerBorder = new Border { Width = 10, Height = 10, Margin = new Thickness(5) }; var root = new Grid { Children = { spacerBorder, SUT } }; root.Measure(new Size(1000, 1000)); Assert.AreEqual(10d + 5d + 5d, root.DesiredSize.Height); });
private LoadingHelper() { var contentGrid = new Grid { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Height = Window.Current.Bounds.Height, Width = Window.Current.Bounds.Width, Background = new SolidColorBrush(Color.FromArgb(125, 0, 0, 0)) }; _progressRing = new ProgressRing { VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Width = Window.Current.Bounds.Width / 4, Height = Window.Current.Bounds.Width / 4 }; contentGrid.Children.Add(_progressRing); _loadingPopup = new Popup() { HorizontalOffset = 0, VerticalOffset = 0, Height = Window.Current.Bounds.Height, Width = Window.Current.Bounds.Width, Child = contentGrid }; }
protected override void OnApplyTemplate() { scrollViewer = GetTemplateChild("ScrollViewer") as ScrollViewer; progressRing = GetTemplateChild("ProgressRing") as ProgressRing; scrollViewer.Loaded += scrollViewer_Loaded; base.OnApplyTemplate(); }
public async void tryLoadContent() { //Show loading ProgressRing progressRing1 = new ProgressRing(); progressRing1.IsActive = true; loaderRing.Children.Add(progressRing1); string[] hnTopIds = await hnApiCli.getTopStoriesIdList(); HNewsItemModel tmpHns; int iCnt = 0;//@todo: This should be a setting param foreach (string id in hnTopIds) { //@todo: Should be moved progressRing1.IsActive = false; tmpHns = await hnApiCli.getStoryById(id); news.Add( tmpHns ); //Load 100 articles only if (++iCnt == 100) { break; } } }
public static async void MultipleInstance(Uri targeturiWeb) { CoreApplicationView newView = CoreApplication.CreateNewView(); int newViewId = 0; await newView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { Grid grid = new Grid(); grid.Children.Clear(); WebView web = new WebView(); ProgressRing pr = new ProgressRing { Height = 50, Width = 50, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, IsActive = true, Visibility = Visibility.Visible, Foreground = new SolidColorBrush(Windows.UI.Colors.Crimson) }; grid.Children.Add(web); grid.Children.Add(pr); web.Navigate(targeturiWeb); web.ContentLoading += (s, a) => { pr.Visibility = Visibility.Visible; }; web.LoadCompleted += (s, a) => { pr.Visibility = Visibility.Collapsed; }; Window.Current.Content = grid; Window.Current.Activate(); newViewId = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().Id; } ); bool viewShown = await Windows.UI.ViewManagement.ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); }
public async void Play_Experiment(Device tool) { for (double i = 0; i < 120; i += 0.5) { DataChartNode active = null; foreach (ExperimentNode node in Exp.Cards) { if (node.GetType() == typeof(DataChartNode)) { active = node as DataChartNode; } } Debug.WriteLine("Playing"); DataPoint d = await Get_DataPoints(i); Debug.WriteLine(d.X); active.Add_Data_Point(d); } Playing = true; ProgressRing ring = new ProgressRing() { Height = 25, Width = 25, IsActive = true }; PlayExperimentButton.Content = ring; PlayExperimentButton.Click -= Play_Click; PlayExperimentButton.Click += Abort_Experiment; }