Ejemplo n.º 1
0
        private void AttachLoadingAdorner(UIElement view, ExplorerViewModel viewModel)
        {
            LoadingAdorner loading = new LoadingAdorner(view);

            //We can set font information and text.
            loading.FontSize      = 14;
            loading.OverlayedText = "Please Wait! Extracting folders/files information from Selected Drive.";
            loading.Typeface      = new Typeface(new FontFamily("Arial"), FontStyles.Italic, FontWeights.Bold, FontStretches.Normal);

            Binding bind = new Binding();

            bind.Source    = viewModel;
            bind.Path      = new PropertyPath("Isbusy");
            bind.Converter = new VisibilityConverter();
            loading.SetBinding(LoadingAdorner.VisibilityProperty, bind);
            System.Windows.Documents.AdornerLayer.GetAdornerLayer(view).Add(loading);
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _adorner = new LoadingAdorner(this);

            Binding isLoadingBinding = new Binding("IsLoading");

            isLoadingBinding.Source = RootModel;
            _adorner.SetBinding(LoadingAdorner.IsLoadingProperty, isLoadingBinding);

            Loaded += delegate
            {
                AdornerLayer layer = AdornerLayer.GetAdornerLayer(this);
                if (layer != null)
                {
                    layer.Add(_adorner);
                }

                RaiseEvent(new ProgressRoutedEventArgs(ProgressEvent, new ProgressEventArgs(0, "DirectoryTree Loaded",
                                                                                            WorkType.Unknown, WorkStatusType.wsCompleted, WorkResultType.wrSuccess)));
            };
        }