Exemple #1
0
        private void OnSelectDirectoryExecute(object obj)
        {
            //if ((obj as RoutedPropertyChangedEventArgs<object>)?.NewValue is TreeViewItem)
            //{
            //    this.SelectedDirectoryViewModel =
            //    ((((RoutedPropertyChangedEventArgs<object>)obj).NewValue as TreeViewItem)?.DataContext as
            //        IFileBrowserViewModel)?.RootDeviceDirectoryViewModel;
            //}
            //else
            //{
            //    this.SelectedDirectoryViewModel =
            //        (obj as RoutedPropertyChangedEventArgs<object>)?.NewValue as
            //        IDeviceDirectoryViewModel;
            //}
            if (obj == null)
            {
                return;
            }

            if (obj is TreeViewItem)
            {
                TreeViewItem          item = (TreeViewItem)obj;
                IFileBrowserViewModel vm   = item.DataContext as IFileBrowserViewModel;
                this.SelectedDirectoryViewModel = vm?.RootDeviceDirectoryViewModel;
            }
            else
            {
                this.SelectedDirectoryViewModel = obj as IDeviceDirectoryViewModel;
            }
        }
Exemple #2
0
 public FileBrowserHub()
 {
     this.viewModel = new FileBrowserViewModel(((App)Application.Current).DataSource, this.Dispatcher, true);
     this.InitializeComponent();
     this.navigationHelper            = new NavigationHelper(this);
     this.navigationHelper.LoadState += this.OnLoadState;
     ((App)Application.Current).DataSource.Reseted += this.OnDataSourceReseted;
     this.ViewModel.ShowSettings += OnShowSettings;
     this.ViewModel.AskReconnect += OnAskReconnect;
 }