public TaskManagerViewModel(IShellStatusBar statusBar, ITargetedRestClient restClient, IWindowService windowService) { _statusBar = statusBar; _windowService = windowService; _restClient = restClient; _refreshTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(10) }; _refreshTimer.Tick += RefreshTimerOnTick; }
public RegistryTreeViewModel(ITargetedRestClient restClient, IShellStatusBar statusBar) { _restClient = restClient; _statusBar = statusBar; Entries = new EntriesHelper <RegistryKeyViewModel>(); Selection = new TreeRootSelector <RegistryKeyViewModel, IntegratedRegistryKey>(Entries) { Comparers = new[] { new RegistryPathComparer() } }; Entries.SetEntries(new[] { RegistryHive.ClassesRoot, RegistryHive.CurrentUser, RegistryHive.LocalMachine, RegistryHive.Users, RegistryHive.CurrentUser }.Select(CreateHiveViewModel)); }
public RegistryKeyViewModel(RegistryTreeViewModel rootTreeViewModel, IntegratedRegistryKey registryKey, ITargetedRestClient restClient, IShellStatusBar statusBar, RegistryKeyViewModel parentViewModel) { RegistryKey = registryKey; _rootTreeViewModel = rootTreeViewModel; _restClient = restClient; _statusBar = statusBar; Parent = parentViewModel; Entries = new EntriesHelper <RegistryKeyViewModel>(LoadSubKeys); Selection = new TreeSelector <RegistryKeyViewModel, IntegratedRegistryKey>(registryKey, this, parentViewModel == null ? rootTreeViewModel.Selection : parentViewModel.Selection, Entries); if (!registryKey.HasSubKeys) { Entries.SetEntries(Enumerable.Empty <RegistryKeyViewModel>()); } }
public FileExplorerViewModel(IShellStatusBar statusBar, IWindowService windowService, IMemoryCache cache, ITargetedRestClient client, IAppDispatcher dispatcher, IImageProvider imageProvider) { StatusBar = statusBar; Window = windowService; RestClient = client; FileSystem = new RemoteFileSystem(cache, RestClient); ImageProvider = imageProvider; Dispatcher = dispatcher; ProcessingEntries = new ObservableCollection <ProcessingEntryViewModel>(); NavigationBarViewModel = new NavigationBarViewModel(); DirectoryTreeViewModel = new DirectoryTreeViewModel(); EntriesViewModel = new EntriesViewModel(); FileTransferManagerViewModel = new FileTransferManagerViewModel(); foreach (var childViewModel in new IFileExplorerChildViewModel[] { NavigationBarViewModel, DirectoryTreeViewModel, EntriesViewModel, FileTransferManagerViewModel }) { childViewModel.Initialize(this); } }
/// <summary> /// Display a status on a <see cref="IShellStatusBar" /> while a <see cref="Task" /> is running. Any exception will be /// caught and displayed on the status bar. To avoid flickering in case the task executes very fast, the message isn't /// shown immediately and will be visible for at least one second. /// </summary> /// <param name="task">The task that should be visualized on the status bar.</param> /// <param name="shellStatusBar">The status bar.</param> /// <param name="message">The text message that should be displayed</param> /// <param name="animation">The animation that should be shown</param> /// <param name="mustShow">If true, the status will be shown on the status bar even if the task finishes extremly fast.</param> /// <returns> /// Return the task that wraps the <see cref="task" /> with the creation of the status and whether an exception /// was not thrown (return <code>false</code> if an exception was thrown). /// </returns> public static async Task <bool> DisplayOnStatusBarCatchErrors(this Task task, IShellStatusBar shellStatusBar, string message, StatusBarAnimation animation = StatusBarAnimation.None, bool mustShow = false) { try { await task.DisplayOnStatusBar(shellStatusBar, message, animation, mustShow); return(true); } catch (RestException e) { shellStatusBar.ShowError(e.GetRestExceptionMessage()); return(false); } catch (Exception e) { shellStatusBar.ShowError(e.Message); return(false); } }
/// <summary> /// Display a status on a <see cref="IShellStatusBar" /> while a <see cref="Task" /> is running. Any exception will be /// caught and displayed on the status bar. To avoid flickering in case the task executes very fast, the message isn't /// shown immediately and will be visible for at least one second. /// </summary> /// <param name="task">The task that should be visualized on the status bar.</param> /// <param name="shellStatusBar">The status bar.</param> /// <param name="message">The text message that should be displayed</param> /// <param name="animation">The animation that should be shown</param> /// <param name="mustShow">If true, the status will be shown on the status bar even if the task finishes extremly fast.</param> /// <returns>Return the task that wraps the <see cref="task" /> with the creation of the status and the result.</returns> public static async Task <SuccessOrError <T> > DisplayOnStatusBarCatchErrors <T>(this Task <T> task, IShellStatusBar shellStatusBar, string message, StatusBarAnimation animation = StatusBarAnimation.None, bool mustShow = false) { try { return(await task.DisplayOnStatusBar(shellStatusBar, message, animation, mustShow)); } catch (RestException e) { shellStatusBar.ShowError(e.GetRestExceptionMessage()); return(SuccessOrError <T> .DefaultFailed); } catch (Exception e) { shellStatusBar.ShowError(e.Message); return(SuccessOrError <T> .DefaultFailed); } }
public MessageBoxViewModel(ITargetedRestClient restClient, IWindowService windowService, IShellStatusBar statusBar) { _windowService = windowService; _statusBar = statusBar; _restClient = restClient; }
public RegistryEditorViewModel(IWindowService windowService, IShellStatusBar statusBar, ITargetedRestClient restClient) { _windowService = windowService; _statusBar = statusBar; _restClient = restClient; }
public ModuleNamePlaceholderViewModel(IShellStatusBar statusBar, ITargetedRestClient restClient) { _statusBar = statusBar; _restClient = restClient; }
public SystemUtilitiesViewModel(IShellStatusBar statusBar, ITargetedRestClient restClient) { _statusBar = statusBar; _restClient = restClient; }
public ClipboardManagerViewModel(IShellStatusBar statusBar, ITargetedRestClient restClient) { _statusBar = statusBar; _restClient = restClient; }
public DeviceManagerViewModel(IShellStatusBar statusBar, ITargetedRestClient restClient, IWindowService windowService) { _statusBar = statusBar; _restClient = restClient; _windowService = windowService; }
public SystemInformationViewModel(IShellStatusBar statusBar, ITargetedRestClient restClient) { _statusBar = statusBar; _restClient = restClient; }