public LoadingPage() { DataContext = model; model.PropertyChanged += Model_PropertyChanged; absoluteLayout = new Grid(); overlay = new Grid { Background = Brushes.Black, Opacity = 0.5, Visibility = Visibility.Hidden }; busyIndicator = new BusyIndicator() { IsBusy = true, Visibility = Visibility.Hidden }; Panel.SetZIndex(overlay, 1000); Panel.SetZIndex(busyIndicator, 1500); contentView = new Grid(); absoluteLayout.Children.Add(busyIndicator); absoluteLayout.Children.Add(overlay); absoluteLayout.Children.Add(contentView); }
private async void InitializeEditFormAsync(FormModel formModel) { bool canCall = true; try { if (formModel.IdForm != Guid.Empty) { BusyIndicator.BlockUI(); string path = string.Format("{0}/{1}", RoutingConstants.FormRoute, formModel.IdForm.ToString()); RequestResponse <FormModel> response = await requestManager.GetAsync <FormModel>(path); if (response.Data == null || response.IsError) { canCall = false; await InitializeAsync(true); } else { formModel = response.Data; } } } finally { BusyIndicator.UnblockUI(); } if (canCall) { OpenEditForm(formModel); } }
private async Task <bool> ValidateDeletionOfFormAsync(Guid id) { bool validationResult = id == null; if (!validationResult) { try { string url = string.Format("{0}/{1}?id={2}", RoutingConstants.FormRoute, RoutingFragmentConstants.ValidateDeletionOfFormFragment, id); BusyIndicator.BlockUI(); RequestResponse <TMValidationResult> response = await requestManager.GetAsync <TMValidationResult>(url); if (response.IsError || response.Data == null) { notificationManager.Alert(response.ErrorMessage, string.Empty, response.IsFatalError); } else if (!response.Data.IsValid) { notificationManager.Alert(response.Data.ValidationMessage); } else { validationResult = true; } } finally { BusyIndicator.UnblockUI(); } } return(validationResult); }
public async Task BtnDeleteForm() { if (SelectedForm != null) { try { BusyIndicator.BlockUI(); bool validationResult = await ValidateDeletionOfFormAsync(SelectedForm.IdForm); if (validationResult) { bool deleteForm = false; notificationManager.Confirm(Resources.ApplicationShortName, Environment.NewLine + Resources.DeleteFormQuestion, () => { deleteForm = true; }, owner: GetView()); if (deleteForm) { await DeleteFormAsync(); } } } finally { BusyIndicator.UnblockUI(); } } }
private async Task InitializeAsync(bool busyIndicatorIsWorking) { FormModels.Clear(); var filterQueryString = formFilter.ToQueryString(); var url = string.Format("{0}?{1}", RoutingConstants.FormRoute, filterQueryString); RequestResponse <IEnumerable <FormModel> > response = new RequestResponse <IEnumerable <FormModel> >(); try { if (!busyIndicatorIsWorking) { BusyIndicator.BlockUI(); } response = await requestManager .GetAsync <IEnumerable <FormModel> >(url); if (response != null && !response.IsError) { FormModels.AddRange(response.Data); UpdateHeaderView(); } else { notificationManager.Alert(response.ErrorMessage, response.IsFatalError); } } finally { if (!busyIndicatorIsWorking) { BusyIndicator.UnblockUI(); } } }
void ReleaseDesignerOutlets() { if (BioView != null) { BioView.Dispose(); BioView = null; } if (BusyIndicator != null) { BusyIndicator.Dispose(); BusyIndicator = null; } if (FilmsView != null) { FilmsView.Dispose(); FilmsView = null; } if (MiscView != null) { MiscView.Dispose(); MiscView = null; } if (PersonDetailsSegment != null) { PersonDetailsSegment.Dispose(); PersonDetailsSegment = null; } if (Poster != null) { Poster.Dispose(); Poster = null; } }
void ReleaseDesignerOutlets() { if (AllCinemasButton != null) { AllCinemasButton.Dispose(); AllCinemasButton = null; } if (AllFilmsButton != null) { AllFilmsButton.Dispose(); AllFilmsButton = null; } if (BusyIndicator != null) { BusyIndicator.Dispose(); BusyIndicator = null; } if (NearestCinemas != null) { NearestCinemas.Dispose(); NearestCinemas = null; } if (SearchButton != null) { SearchButton.Dispose(); SearchButton = null; } if (SettingsButton != null) { SettingsButton.Dispose(); SettingsButton = null; } }
private void SearchBtn_Click(object sender, RoutedEventArgs e) { var entity = new RTMEntities(); var name = (FNameTxt.Text.Trim() == "")?null :FNameTxt.Text; var family = (LNameTxt.Text.Trim() == "") ? null : LNameTxt.Text; var organ = (OrgCom.Text.Trim() == "") ? null : OrgCom.Text; var position = (PositionTxt.Text.Trim() == "") ? null : PositionTxt.Text; List <User> results = new List <User>(); var loader = new BusyIndicator(); this.layoutRoot.Children.Add(loader); Task.Factory.StartNew(delegate { try { results = DataManagement.SearchUsers(name, family, position, organ); } catch (System.Exception ex) { MessageBox.Show("تماس با سرور با مشکل مواجه شد"); } }).ContinueWith(delegate { if (results.Count > 0) { Grid.ItemsSource = results; } else { Grid.ItemsSource = null; } this.layoutRoot.Children.Remove(loader); }, TaskScheduler.FromCurrentSynchronizationContext()); }
private async void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { DatasetBox.IsChecked = false; SettingUpBox.IsChecked = false; TrainingBox.IsChecked = false; TestingBox.IsChecked = false; PlottingBox.IsChecked = false; RestartButton.IsEnabled = false; PredictButton.IsEnabled = false; BusyIndicator.Visibility = Windows.UI.Xaml.Visibility.Visible; BusyIndicator.Resume(); // Prepare diagram var plotModel = Diagram.Model; plotModel.PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1); Diagram.InvalidatePlot(); // Prepare the input files DatasetBox.IsChecked = true; var testDataPath = await MlDotNet.FilePath(@"ms-appx:///Data/test.tsv"); // Configure data transformations. SettingUpBox.IsChecked = true; var trainingDataPath = await MlDotNet.FilePath(@"ms-appx:///Data/training.tsv"); await ViewModel.Build(); // Create and train the model TrainingBox.IsChecked = true; await ViewModel.Train(trainingDataPath); // Save the model. await ViewModel.Save("classificationModel.zip"); // Test and evaluate the model TestingBox.IsChecked = true; var metrics = await ViewModel.Evaluate(testDataPath); // Diagram PlottingBox.IsChecked = true; var bars = new List <BarItem>(); foreach (var logloss in metrics.PerClassLogLoss) { bars.Add(new BarItem { Value = logloss }); } (plotModel.Series[0] as BarSeries).ItemsSource = bars; plotModel.InvalidatePlot(true); BusyIndicator.Visibility = Windows.UI.Xaml.Visibility.Collapsed; BusyIndicator.Pause(); RestartButton.IsEnabled = true; PredictButton.IsEnabled = true; }
/// <summary> /// Locks the screen ans starts the BusyIndicator by creating a popup. /// </summary> /// <param name="title">The title to be displayed by the BusyIndicator.</param> /// <returns>The BusyIndicator.</returns> public void Start() { // Create a popup with the size of the app's window. Popup popup = new Popup() { Height = Window.Current.Bounds.Height, IsLightDismissEnabled = false, Width = Window.Current.Bounds.Width }; // Create the BusyIndicator as a child, having the same size as the app. BusyIndicator busyIndicator = new BusyIndicator() { Height = popup.Height, Width = popup.Width, Text = this.Text, }; this.timer.Start(); this.timer.Tick += (f, y) => { busyIndicator.Text = Text; }; // Set the child of the popop popup.Child = busyIndicator; // Postion the popup to the upper left corner popup.SetValue(Canvas.LeftProperty, 0); popup.SetValue(Canvas.TopProperty, 0); // Open it. this.ParentPopup = popup; popup.IsOpen = true; // Return the BusyIndicator // return (busyIndicator); }
void ReleaseDesignerOutlets() { if (CustomNavigationBar != null) { CustomNavigationBar.Dispose(); CustomNavigationBar = null; } if (CustomNavigationItem != null) { CustomNavigationItem.Dispose(); CustomNavigationItem = null; } if (TableView != null) { TableView.Dispose(); TableView = null; } if (BusyIndicator != null) { BusyIndicator.Dispose(); BusyIndicator = null; } }
private void OnBootstrapp(object sender, EventArgs args) { BusyIndicator.Start(LoaderInfoGif, LoaderInfoText, "bootstraping..."); var grids = new List <KeyValuePair <ElementKeys, Grid> > { new KeyValuePair <ElementKeys, Grid>(ElementKeys.Pending, PendingImagesGrid), new KeyValuePair <ElementKeys, Grid>(ElementKeys.Completed, CompletedImagesGrid), new KeyValuePair <ElementKeys, Grid>(ElementKeys.Failed, FailedImagesGrid) }; var scrolls = new List <KeyValuePair <ElementKeys, ScrollViewer> > { new KeyValuePair <ElementKeys, ScrollViewer>(ElementKeys.Pending, PendingScroller), new KeyValuePair <ElementKeys, ScrollViewer>(ElementKeys.Completed, CompletedScroller), new KeyValuePair <ElementKeys, ScrollViewer>(ElementKeys.Failed, FailedScroller) }; var tabs = new List <KeyValuePair <ElementKeys, TabItem> > { new KeyValuePair <ElementKeys, TabItem>(ElementKeys.Pending, PendingTab), new KeyValuePair <ElementKeys, TabItem>(ElementKeys.Completed, CompletedTab), new KeyValuePair <ElementKeys, TabItem>(ElementKeys.Failed, FailedTab) }; Bootstrapper.Start(grids, scrolls, tabs); BusyIndicator.Stop(LoaderInfoGif, LoaderInfoText); }
private async Task GetOwnerAndUpdateGridAsync(OwnerDataModel selectedDirtyOwner, bool isBusyIndicatorOn) { try { if (!isBusyIndicatorOn) { BusyIndicator.BlockUI(); } if (selectedDirtyOwner == null || selectedDirtyOwner.IdOwner == null) { await InitializeAsync(true); throw new ArgumentNullException(); } OwnerDataModel resultOwner = await GetOwnerAsync(selectedDirtyOwner.IdOwner, isBusyIndicatorOn); if (resultOwner != null) { int indexOfOwner = Owners.IndexOf(selectedDirtyOwner); SelectedOwner.IsDirty = false; Owners.RemoveAt(indexOfOwner); Owners.Insert(indexOfOwner, resultOwner); } } finally { if (!isBusyIndicatorOn) { BusyIndicator.UnblockUI(); } } }
static public void ExecuteDebtorCollection(CrudAPI Api, BusyIndicator busyIndicator, IEnumerable <DCTransOpen> dcTransOpenList, IEnumerable <double> feelist, IEnumerable <double> changelist, bool isCurrencyReport, DebtorEmailType emailType, string emails = null, bool onlyThisEmail = false, bool isAddInterest = false) { var rapi = new ReportAPI(Api); var cwDateSelector = new CWDateSelector(); #if !SILVERLIGHT cwDateSelector.DialogTableId = 2000000025; #endif cwDateSelector.Closed += async delegate { if (cwDateSelector.DialogResult == true) { busyIndicator.IsBusy = true; busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("SendingWait"); var result = await rapi.DebtorCollection(dcTransOpenList, feelist, changelist, cwDateSelector.SelectedDate, emailType, isCurrencyReport, emails, onlyThisEmail); busyIndicator.IsBusy = false; if (result == ErrorCodes.Succes) { UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("SendEmailMsgOBJ"), isAddInterest ? Uniconta.ClientTools.Localization.lookup("InterestNote") : Uniconta.ClientTools.Localization.lookup("CollectionLetter")), Uniconta.ClientTools.Localization.lookup("Message"), MessageBoxButton.OK); } else { UtilDisplay.ShowErrorCode(result); } } }; cwDateSelector.Show(); }
private async void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { TrainingBox.IsChecked = false; PlotBox.IsChecked = false; RestartButton.IsEnabled = false; BusyIndicator.Visibility = Windows.UI.Xaml.Visibility.Visible; BusyIndicator.Resume(); // Clear the diagram. Diagram.Model.PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1); Diagram.InvalidatePlot(); // Create and train the regression model TrainingBox.IsChecked = true; var dataPath = await MlDotNet.FilePath(@"ms-appx:///Data/winequality_white_train.csv"); var featureImportances = await ViewModel.ComputePermutationMetrics(dataPath); // Visualize the R-Squared decrease for the model features. PlotBox.IsChecked = true; UpdatePlot(featureImportances); BusyIndicator.Visibility = Windows.UI.Xaml.Visibility.Collapsed; BusyIndicator.Pause(); RestartButton.IsEnabled = true; }
/// <summary> /// Increases the version. /// </summary> public async void IncreaseVersion() { if (this.Validate()) { return; } var selectedItems = this.GetSelectedItems(); if (!selectedItems.Any()) { await this.ShowDialog("RootDialog", "Please selected item(s)"); return; } // Show BusyIndicator var busyView = new BusyIndicator(); await DialogHost.Show(busyView, "RootDialog", (sender, args) => { Task.Run <bool>(() => this.HandleIncreaseVersion(selectedItems)).ContinueWith(tks => { Execute.OnUIThreadAsync(() => { DialogHost.CloseDialogCommand.Execute(true, busyView); }); }); }, null); }
private async Task <OwnerDataModel> GetOwnerAsync(Guid idOwner, bool isBusyIndicatorOn) { OwnerDataModel owner = new OwnerDataModel(); try { if (!isBusyIndicatorOn) { BusyIndicator.BlockUI(); } string url = string.Format("{0}/{1}?id={2}", RoutingConstants.OwnerRoute, RoutingFragmentConstants.GetOwnerWithParentOwnerCode, idOwner); var response = await requestManager.GetAsync <OwnerModel>(url); if (response != null && response.IsError) { notificationManager.Alert(response.ErrorMessage, response.IsFatalError); await InitializeAsync(isBusyIndicatorOn); owner = null; } else if (!response.IsError) { owner = mappingManager.MapToOwnerDataModel(response.Data); } } finally { if (!isBusyIndicatorOn) { BusyIndicator.UnblockUI(); } } return(owner); }
private async Task <bool> ValidateDeletionOfOwnerAsync() { string url = string.Format("{0}/{1}?id={2}", RoutingConstants.OwnerRoute, RoutingFragmentConstants.ValidateDeletionOfAnOwner, SelectedOwner.IdOwner); bool validationResult = false; try { BusyIndicator.BlockUI(); RequestResponse <TMValidationResult> response = await requestManager.GetAsync <TMValidationResult>(url); if (response.IsError || response.Data == null) { notificationManager.Alert(response.ErrorMessage, string.Empty, response.IsFatalError); } validationResult = response.Data.IsValid; if (!validationResult) { notificationManager.Alert(response.Data.ValidationMessage); } } finally { BusyIndicator.UnblockUI(); } return(validationResult); }
private async Task <bool> ValidateOwnerAsync(OwnerDataModel selectedDirtyOwner) { string url = string.Format("{0}/{1}?id={2}&ownerCode={3}&parentsOwnerCode={4}&ownersSystemCode={5}", RoutingConstants.OwnerRoute, RoutingFragmentConstants.ValidateCreationOrEditOfAnOwner, selectedDirtyOwner.IdOwner, selectedDirtyOwner.OwnerCode, selectedDirtyOwner.OwnerCodeOfParent, selectedDirtyOwner.SystemCode); bool validationResult = false; try { BusyIndicator.BlockUI(); RequestResponse <TMValidationResult> response = await requestManager.GetAsync <TMValidationResult>(url); if (response != null && response.IsError || response.Data == null) { notificationManager.Alert(response.ErrorMessage, string.Empty, response.IsFatalError); } validationResult = response.Data.IsValid; if (!validationResult) { notificationManager.Alert(response.Data.ValidationMessage); } } finally { BusyIndicator.UnblockUI(); } return(validationResult); }
private async Task AddBookFromFileAsync(IStorageFile file) { var dialog = new BusyIndicator(); var taskDescription = _resourceLoader.GetString("Application_Opening"); dialog.TaskDescription = string.Format(taskDescription, file.Name); dialog.Show(); try { await _bookProvider.AddBookAsync(file); } catch (NotImplementedException) { await ShowDocumentTypeIsNotSupportedMessageAsync(); } catch { await ShowDocumentOpeningErrorMessageAsync(); } finally { dialog.Hide(); } }
public static void EndLoading(int loaderHandler) { FrmMain mainUI = ((App)Application.Current).FrmMain; if ((mainUI.LoadingPanel.Items.Count > 0) && (loaderHandler >= 0)) { try { List <BusyIndicator> liste = new List <BusyIndicator>(); foreach (var select in mainUI.LoadingPanel.Items) { liste.Add(select as BusyIndicator); } BusyIndicator indicator = (from d in liste where (d.Name == loaderHandler.ToString()) select d).ElementAt(0); mainUI.LoadingPanel.Items.Remove(indicator); } catch (Exception ex) { throw new Exception("Erreur inconnu. Code erreur : 2 \n Message : " + ex.Message); } } }
/// <summary> /// Initializes the <see cref="Application.RootVisual"/> property. The /// initial UI will be displayed before the LoadUser operation has completed /// (The LoadUser operation will cause user to be logged automatically if /// using windows authentication or if the user had selected the "keep /// me signed in" option on a previous login). /// </summary> protected virtual void InitializeRootVisual() { this.busyIndicator = new BusyIndicator(); this.busyIndicator.Content = new MainPage(); this.busyIndicator.HorizontalContentAlignment = HorizontalAlignment.Stretch; this.busyIndicator.VerticalContentAlignment = VerticalAlignment.Stretch; this.RootVisual = this.busyIndicator; }
/// <summary> /// Retrieves the compliation at the specified path /// </summary> /// <param name="compilationPath"></param> public void Retrieve(string compilationPath) { _retriever.DoWork += Retriever_DoWork; _retriever.RunWorkerCompleted += Retriever_RunWorkerCompleted; _retriever.RunWorkerAsync(compilationPath); BusyIndicator.IsBusyWith("Loading compilation"); }
/// <summary> /// Creates the busy indicator, which will be automatically centered if needed. /// </summary> /// <returns>FrameworkElement.</returns> protected virtual FrameworkElement CreateBusyIndicator() { var busyIndicator = new BusyIndicator(); busyIndicator.SetBinding(System.Windows.Controls.BusyIndicator.BusyContentProperty, new Binding("Status")); busyIndicator.SetBinding(System.Windows.Controls.BusyIndicator.IsBusyProperty, new Binding("IsBusy")); return(busyIndicator); }
private void SyncHelper_OnAllFilesUploaded(object sender, EventArgs e) { BusyIndicator.Stop(LoaderInfoGif, LoaderInfoText); PendingTab.Tag = "0"; PendingTab.Header = "Pending"; PendingScroller.Tag = "0,0,1"; PendingImagesGrid.Height = 103; DragDropArea.Visibility = Visibility.Visible; }
/// <summary> /// Initializes the <see cref="Application.RootVisual"/> property. The /// initial UI will be displayed before the LoadUser operation has completed /// (The LoadUser operation will cause user to be logged automatically if /// using windows authentication or if the user had selected the "keep /// me signed in" option on a previous login). /// </summary> protected virtual void InitializeRootVisual() { this.busyIndicator = new BusyIndicator(); this.busyIndicator.Content = this.Container.GetExportedValue <MainPage>(); this.busyIndicator.HorizontalContentAlignment = HorizontalAlignment.Stretch; this.busyIndicator.VerticalContentAlignment = VerticalAlignment.Stretch; this.RootVisual = this.busyIndicator; this.busyIndicator.BusyContent = "正在处理,请稍候..."; }
private async Task EnableBusyIndicator(WizardPage page, BusyIndicator busyIndicator) { busyIndicator.IsBusy = true; TimeSpan timeSpan = new TimeSpan(0, 0, 10); await Task.Run(() => Thread.Sleep(timeSpan)); busyIndicator.IsBusy = false; page.CanSelectNextPage = true; page.Title = "Потерпите еще чуть-чуть"; page.Description = "Для окончания установки нажмите кнопку далее"; }
private async void Page_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { DatasetBox.IsChecked = false; SettingUpBox.IsChecked = false; TrainingBox.IsChecked = false; TestingBox.IsChecked = false; PlottingBox.IsChecked = false; RestartButton.IsEnabled = false; PredictButton.IsEnabled = false; BusyIndicator.Visibility = Windows.UI.Xaml.Visibility.Visible; BusyIndicator.PlayAnimation(); // Prepare the input files DatasetBox.IsChecked = true; // var testDataPath = await MlDotNet.FilePath(@"ms-appx:///Data/test.tsv"); // Configure data transformations. SettingUpBox.IsChecked = true; // var trainingDataPath = await MlDotNet.FilePath(@"ms-appx:///Data/training.tsv"); // await ViewModel.Build(trainingDataPath); // Create and train the model TrainingBox.IsChecked = true; // await ViewModel.Train(); // Save the model. // await ViewModel.Save("classificationModel.zip"); // Test and evaluate the model TestingBox.IsChecked = true; // var metrics = await ViewModel.Evaluate(testDataPath); // Diagram PlottingBox.IsChecked = true; var foreground = OxyColors.SteelBlue; var plotModel = new PlotModel { PlotAreaBorderThickness = new OxyThickness(1, 0, 0, 1), PlotAreaBorderColor = foreground, TextColor = foreground, TitleColor = foreground, SubtitleColor = foreground }; // ... Diagram.Model = plotModel; BusyIndicator.Visibility = Windows.UI.Xaml.Visibility.Collapsed; BusyIndicator.PauseAnimation(); RestartButton.IsEnabled = true; PredictButton.IsEnabled = true; }
void InitializeFileDiffInfo() { try { BusyIndicator.Show(); BusyIndicator.UpdateText("Loading file diff info: progress {0} from {1}"); fileDiffInfo = blameHelper.GetFileDiffInfo(filePath, BusyIndicator.UpdateProgress); } finally { BusyIndicator.Close(); } }
async private void PreviewElement_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e) { var bi = new BusyIndicator(); try { bi.Open("Please wait"); var imageEncodingProps = ImageEncodingProperties.CreatePng(); using (var stream = new InMemoryRandomAccessStream()) { await _mediaCapture.CapturePhotoToStreamAsync(imageEncodingProps, stream); _bytes = new byte[stream.Size]; var buffer = await stream.ReadAsync(_bytes.AsBuffer(), (uint)stream.Size, InputStreamOptions.None); _bytes = buffer.ToArray(0, (int)stream.Size); await ByteArrayToBitmapImage(_bytes); var bitmap = new BitmapImage(); stream.Seek(0); await bitmap.SetSourceAsync(stream); var model = this.Tag as MaintenanceRepair; if (model == null) { model = new MaintenanceRepair(); } if (model.IsMajorPivot) { model.MajorComponentImgList.Add(new ImageCapture { ImageBitmap = bitmap }); } else { model.SubComponentImgList.Add(new ImageCapture { ImageBitmap = bitmap }); } PreviewElement.Visibility = Windows.UI.Xaml.Visibility.Collapsed; Img.Visibility = Windows.UI.Xaml.Visibility.Visible; this.IsSecondaryButtonEnabled = true; } bi.Close(); } catch (Exception) { bi.Close(); } }
/// <summary> /// Creates a new <see cref="App"/> instance. /// </summary> public App() { InitializeComponent(); _busyIndicator = new BusyIndicator(); _busyIndicator.BusyContent = "User Authenticating, Please Wait..."; // Create a WebContext and add it to the ApplicationLifetimeObjects collection. // This will then be available as WebContext.Current. WebContext webContext = new WebContext(); webContext.Authentication = new FormsAuthentication(); //webContext.Authentication = new WindowsAuthentication(); this.ApplicationLifetimeObjects.Add(webContext); }
private void InitializeWidget(LayoutOrientation orientation) { MessageLabel = new Label(); MessageLabel.Name = "MessageLabel"; BusyIndicator_1 = new BusyIndicator(true); BusyIndicator_1.Name = "BusyIndicator_1"; // MessageLabel MessageLabel.TextColor = new UIColor(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); MessageLabel.Font = new UIFont(FontAlias.System, 25, FontStyle.Regular); MessageLabel.LineBreak = LineBreak.Character; // BusyIndicatorDialog this.AddChildLast(MessageLabel); this.AddChildLast(BusyIndicator_1); this.ShowEffect = new BunjeeJumpEffect() { }; this.HideEffect = new TiltDropEffect(); SetWidgetLayout(orientation); UpdateLanguage(); }
public Card(CustomButton close, int _h = 300, int _w = 370) { closeBtn = close; closeBtn.Margin = new Thickness(2); Height = _h; Width = _w; this.index = close.Index; hasPlayed = false; //UpDown control mediaPosition = new DoubleUpDown { Width = 75, Height = 30, Margin = new Thickness(2) }; mediaPosition.Value = 0; //Groupbox Box = new GroupBox(); Box.Width = Width; Box.Height = Height; Box.Header = new Label { Content = string.Format("Video {0}", index + 1) }; Box.Margin = new Thickness(5, 2, 5, 2); //StackPanels Panel = new StackPanel(); Panel.Orientation = Orientation.Vertical; //bottomPanel WrapPanel bottomPanel = new WrapPanel(); bottomPanel.Orientation = Orientation.Horizontal; bottomPanel.Height = 50; //MediaUriElement player = new MediaUriElement(); player.LoadedBehavior = WPFMediaKit.DirectShow.MediaPlayers.MediaState.Manual; player.PreferedPositionFormat = WPFMediaKit.DirectShow.MediaPlayers.MediaPositionFormat.MediaTime; player.Height = 225; player.Margin = new Thickness(1); //BusyIndicator busy = new BusyIndicator(); //Buttons Open = new Button { Content = "Open Video" }; PlayPause = new Button { Content = sPlay, Height = 30, Width = 30, Margin = new Thickness(2) }; //Slider slider = new Slider { Width = 200, Minimum = 0, SmallChange = 1, LargeChange = 10, Value = 0, Margin = new Thickness(2) }; PlayPause.IsEnabled = false; slider.IsEnabled = false; mediaPosition.IsEnabled = false; SetLayout(); Open.Click += Open_Click; PlayPause.Click += PlayPause_Click; }
private void InitializeWidget(LayoutOrientation orientation) { BusyIndicator_1 = new BusyIndicator(true); BusyIndicator_1.Name = "BusyIndicator_1"; // LoadingPanel this.BackgroundColor = new UIColor(153f / 255f, 153f / 255f, 153f / 255f, 127f / 255f); this.Clip = true; this.AddChildLast(BusyIndicator_1); SetWidgetLayout(orientation); UpdateLanguage(); }
/// <summary> /// OnBusyStateChanged /// </summary> /// <param name="d"></param> /// <param name="e"></param> private static void OnBusyStateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { bool isBusy = (bool)e.NewValue; bool wasBusy = (bool)e.OldValue; if (isBusy == wasBusy) { return; } var hostGridObject = (GetTargetVisual(d) ?? d); Debug.Assert(hostGridObject != null); var hostGrid = hostGridObject as Grid; if (hostGrid == null) { throw new InvalidCastException( string.Format( "The object being attached to must be of type {0}. Try embedding your visual inside a {0} control, and attaching the behavior to the {0} instead.", typeof(Grid).Name)); } if (isBusy) { Debug.Assert(LogicalTreeHelper.FindLogicalNode(hostGrid, "BusyIndicator") == null); bool dimBackground = GetDimBackground(d); var grid = new Grid { Name = "BusyIndicator", Opacity = 0.0 }; if (dimBackground) { grid.Cursor = Cursors.Wait; grid.ForceCursor = true; InputManager.Current.PreProcessInput += OnPreProcessInput; } grid.SetBinding(FrameworkElement.WidthProperty, new Binding("ActualWidth") { Source = hostGrid }); grid.SetBinding(FrameworkElement.HeightProperty, new Binding("ActualHeight") { Source = hostGrid }); for (int i = 1; i <= 3; ++i) { grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); } ProgressIndicator = new BusyIndicator() { Width = 150, Height = 120 }; var viewbox = new Viewbox { HorizontalAlignment = HorizontalAlignment.Center, Stretch = Stretch.Uniform, StretchDirection = StretchDirection.Both, Child = ProgressIndicator }; grid.SetValue(Panel.ZIndexProperty, 1000); grid.SetValue(Grid.RowSpanProperty, Math.Max(1, hostGrid.RowDefinitions.Count)); grid.SetValue(Grid.ColumnSpanProperty, Math.Max(1, hostGrid.ColumnDefinitions.Count)); if (GetAddMargins(d)) { viewbox.SetValue(Grid.RowProperty, 1); viewbox.SetValue(Grid.ColumnProperty, 1); } else { viewbox.SetValue(Grid.RowSpanProperty, 3); viewbox.SetValue(Grid.ColumnSpanProperty, 3); } viewbox.SetValue(Panel.ZIndexProperty, 1); var dimmer = new Rectangle { Name = "Dimmer", Opacity = GetDimmerOpacity(d), Fill = GetDimmerBrush(d), Visibility = (dimBackground ? Visibility.Visible : Visibility.Collapsed) }; dimmer.SetValue(Grid.RowSpanProperty, 3); dimmer.SetValue(Grid.ColumnSpanProperty, 3); dimmer.SetValue(Panel.ZIndexProperty, 0); grid.Children.Add(dimmer); grid.Children.Add(viewbox); grid.BeginAnimation(UIElement.OpacityProperty, new DoubleAnimation(1.0, GetDimTransitionDuration(d))); hostGrid.Children.Add(grid); } else { var grid = (Grid)LogicalTreeHelper.FindLogicalNode(hostGrid, "BusyIndicator"); Debug.Assert(grid != null); if (grid != null) { grid.Name = string.Empty; var fadeOutAnimation = new DoubleAnimation(0.0, GetDimTransitionDuration(d)); fadeOutAnimation.Completed += (sender, args) => OnFadeOutAnimationCompleted(d, hostGrid, grid); grid.BeginAnimation(UIElement.OpacityProperty, fadeOutAnimation); } } }
private void InitializeWidget(LayoutOrientation orientation) { StartButton = new Button(); StartButton.Name = "StartButton"; StopButton = new Button(); StopButton.Name = "StopButton"; BusyIndicator_1 = new BusyIndicator(); BusyIndicator_1.Name = "BusyIndicator_1"; // StartButton StartButton.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); StartButton.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular); // StopButton StopButton.TextColor = new UIColor(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f); StopButton.TextFont = new UIFont(FontAlias.System, 25, FontStyle.Regular); // MainScene this.RootWidget.AddChildLast(StartButton); this.RootWidget.AddChildLast(StopButton); this.RootWidget.AddChildLast(BusyIndicator_1); SetWidgetLayout(orientation); UpdateLanguage(); }