protected override FrameworkElement CreateControl(GoogleDrivePopupTreeParams initParams)
        {
            _dispatcher = Dispatcher.CurrentDispatcher;
            var param = initParams;
            var vm    = _viewModel = new GoogleDriveTreeViewModel {
                UpdateFrequentFolder = true
            };

            vm.Initialize(param.DriveService);
            if (param.FrequentFiles != null)
            {
                vm.SetFrequentFiles(param.FrequentFiles);
            }
            vm.PropertyChanged += HandleViewModelPropertyChanged;
            var tree = _treeView = new GoogleDriveTreeView {
                EnableFrequentFiles = true, DataContext = vm
            };

            tree.SetBinding(GoogleDriveTreeView.ItemsSourceProperty, new Binding(vm.Property(v => v.ItemsView)));
            tree.SetBinding(GoogleDriveTreeView.SelectedItemProperty, new Binding(vm.Property(v => v.SelectedItem))
            {
                Mode = BindingMode.TwoWay
            });
            tree.SetupLoaded(() => tree.Dispatcher.BeginInvoke(async() =>
            {
                await vm.InitializeAsync(false).ConfigureAwait(true);
                var path = param.Path;
                await vm.SelectAsync(path.Split(',')).ConfigureAwait(true);
                UpdateState();
            }, DispatcherPriority.DataBind));

            return(tree);
        }
        private void LoadTreeBusyIndicator()
        {
            LoadingIndicatorPanel.Visibility = Visibility.Visible;
            MainContent.IsEnabled            = false;
            Task.Factory.StartNew(() =>
            {
                var googleDriveTreeViewModel = new GoogleDriveTreeViewModel().Items;

                Application.Current.Dispatcher.BeginInvoke(
                    DispatcherPriority.Background,
                    new Action(() =>
                {
                    GoogleDriveFolderHierarchy.ItemsSource = googleDriveTreeViewModel;
                }));
            }).ContinueWith((task) =>
            {
                LoadingIndicatorPanel.Visibility = Visibility.Collapsed;
                MainContent.IsEnabled            = true;
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }