Exemple #1
0
        public override async void DoAction(FileItem selection)
        {
            if (selection == null)
            {
                return;
            }

            var result = new FileListerAction(Workspace, selection).DoAction();

            try
            {
                if (result != null)
                {
                    Path = result;
                    await Refresh().ConfigureAwait(false);
                }
            }
            catch (UnauthorizedAccessException)
            {
                await System.Windows.Application.Current.Dispatcher.Invoke(async() =>
                {
                    Workspace.CommandRepository.GetCommandByName(nameof(GainAccessToDirectoryCommand)).Execute(result);
                }
                                                                           );
            }
            catch (Exception ex)
            {
                var message = selection.ItemType == ItemType.Container
                    ? "Could not navigate to "
                    : "Could not start ";
                NotificationHost.AddError(message + selection.Name, ex);
            }
        }
Exemple #2
0
 private Encoding GetEncoding()
 {
     try
     {
         return(GetEncoding(Path));
     }
     catch (Exception ex)
     {
         NotificationHost.AddError("Fehler beim Ermitteln des Encodings", ex);
         return(Encoding.Default);
     }
 }
Exemple #3
0
 public Workspace([ImportMany] IEnumerable <Lazy <ILister> > listers, Options options, CommandRepository commandRepository)
 {
     _listers              = listers;
     Options               = options;
     CommandRepository     = commandRepository;
     RenamePopupViewModel  = new RenamePopupViewModel(this);
     Docking               = new DockViewModel(this);
     KeyDispatcher         = new KeyDispatcher(this);
     CommanderbarViewModel = new CommanderbarViewModel(this);
     TaskManager           = new TaskManager(this);
     NotificationHost      = new NotificationHost(this);
     ThemeHandler          = new ThemeHandler(this);
     AddressbarViewModel   = new AdressbarViewModel(this);
     RibbonViewModel       = new RibbonViewModel(this);
     TemporaryFavorites    = new TemporaryFavorites <IItem>();
     PopupViewModel        = new FilterPopupViewModel(this, options, null);
 }
Exemple #4
0
        public async Task <bool> DoBreadcrumbAction(string breadPath)
        {
            var uri = new Uri(breadPath);

            if (uri.IsUnc)
            {
                try
                {
                    LoadingStatus = LoadingStatus.Loading;
                    var valid = await IsValidNetworkLocation(uri).ConfigureAwait(false);

                    if (valid)
                    {
                        Path = breadPath;
                    }
                }
                finally
                {
                    LoadingStatus = LoadingStatus.Loaded;
                }
            }
            else if (File.Exists(breadPath) || breadPath.EndsWith("\\") && Directory.Exists(breadPath))
            {
                var path = System.IO.Path.GetDirectoryName(breadPath);
                Path = path;
            }
            else if (Directory.Exists(breadPath + "\\"))
            {
                var path = System.IO.Path.GetDirectoryName(breadPath + "\\");
                Path = path;
            }
            else
            {
                NotificationHost.AddError(breadPath + " could not be found.");
                return(false);
            }
            await Refresh().ConfigureAwait(false);

            return(true);
        }