public async void Execute(object parameter)
        {
            var settingsLister = KexContainer.Resolve <SettingsLister>();

            _workspace.Open(settingsLister);
            await settingsLister.Refresh().ConfigureAwait(false);
        }
Exemple #2
0
        public async void Execute(object parameter)
        {
            var searchPattern = parameter as string;

            if (string.IsNullOrEmpty(searchPattern))
            {
                _workspace.NotificationHost.AddError("Please enter Searchterm");
                return;
            }

            if (_workspace.ActiveLister is SearchLister searchLister)
            {
                searchLister.SearchPattern = (string)parameter;
                if (searchLister.View != null)
                {
                    await searchLister.Refresh().ConfigureAwait(false);
                }
                else
                {
                    searchLister.GotView += searchLister_GotView;
                }
            }
            else
            {
                searchLister               = KexContainer.Resolve <SearchLister>();
                searchLister.Path          = _workspace.ActiveLister.Path;
                searchLister.SearchPattern = searchPattern;
                searchLister.GotView      += searchLister_GotView;
                _workspace.Open(searchLister);
            }
        }
Exemple #3
0
        public void Execute(object parameter)
        {
            var parameters = parameter as string;

            if (string.IsNullOrEmpty(parameters))
            {
                return;
            }

            var command = parameters;

            if (_workspace.ActiveLister is ConsoleLister fromLister)
            {
                fromLister.Command = command;
                fromLister.Refresh();
            }
            else
            {
                var console = KexContainer.Resolve <ConsoleLister>();
                if (_workspace.ActiveLister is FileLister fileLister)
                {
                    console.WorkingDirectory = _workspace.ActiveLister.Path;
                    console.Selection        = fileLister.SelectedItems;
                }

                console.Command = command;
                _workspace.Open(console);
                console.GotView += l => console.Refresh();
            }
        }
Exemple #4
0
        public void Register()
        {
            var kexFocus      = (Key)Enum.Parse(typeof(Key), _options.GlobalHotKey);
            var showClipboard = (Key)Enum.Parse(typeof(Key), _options.ViewClipboardHotKey);

            try
            {
                HotkeyManager.Current.AddOrReplace("FocusWindows", kexFocus, ModifierKeys.Windows, (n, h) =>
                {
                    _mainWindow.Activate();
                    _mainWindow.WindowState = WindowState.Normal;
                    _workspace.FocusListView();
                });
                HotkeyManager.Current.AddOrReplace("ViewClipboard", showClipboard, ModifierKeys.Windows, async(n, h) =>
                {
                    var textLister = KexContainer.Resolve <TextLister>();
                    _workspace.Open(textLister);
                    textLister.Path = textLister.PathName = textLister.Title = "Clipboard";
                    textLister.Text = Clipboard.GetText();
                    await textLister.Refresh();
                    _mainWindow.Activate();
                    _mainWindow.WindowState = WindowState.Normal;
                });
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }
Exemple #5
0
        public async void Execute(object parameter)
        {
            var lister = KexContainer.Resolve <KeyCommandsLister>();

            _workspace.Open(lister);
            await lister.Refresh().ConfigureAwait(false);
        }
Exemple #6
0
        protected override async void ItemSelected(DriveItem selectedItem)
        {
            if (selectedItem == null)
            {
                return;
            }
            if (!selectedItem.IsReady)
            {
                Workspace.NotificationHost.AddError(string.Format("Drive {0} ist not ready", selectedItem.DriveLetter));
                return;
            }

            IsOpen = false;
            if (Workspace.ActiveLister is FileLister)
            {
                Workspace.ActiveLister.Path = selectedItem.Path;
                await Workspace.ActiveLister.Refresh();
            }
            else
            {
                var lister = KexContainer.Resolve <FileLister>();
                Workspace.Open(lister);
                await lister.Refresh();
            }

            base.ItemSelected(selectedItem);
        }
        public async void Execute(object parameter)
        {
            var notifications = KexContainer.Resolve <NotificationLister>();

            _workspace.Open(notifications);
            await notifications.Refresh().ConfigureAwait(false);
        }
        public async void Execute(object parameter)
        {
            var network = KexContainer.Resolve <NetworkLister>();

            _workspace.Open(network);
            await network.Refresh().ConfigureAwait(false);
        }
Exemple #9
0
        public void Execute(object parameter)
        {
            var drives = KexContainer.Resolve <DriveLister>();

            _workspace.ReplaceCurrentLister(drives);
            _workspace.ActiveLister.Refresh();
        }
Exemple #10
0
        public void Execute(object parameter)
        {
            if (!(_workspace.CurrentItem is FileItem item))
            {
                return;
            }

            var    searchLister = KexContainer.Resolve <SearchLister>();
            string target;

            if (item.IsLink())
            {
                target = new FileItemTargetResolver(item).TargetPath;
            }
            else if (item.ItemType == ItemType.Item)
            {
                target = _workspace.ActiveLister.Path;
            }
            else
            {
                target = item.Path;
            }

            searchLister.Path          = target;
            searchLister.SearchPattern = "";
            searchLister.MaxItems      = 20;
            _workspace.Open(searchLister);
            searchLister.GotView += SearchLister_GotView;
        }
Exemple #11
0
        private async void OpenFavorites()
        {
            var fileLister = KexContainer.Resolve <FileLister>();

            fileLister.Path = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
            Workspace.Open(fileLister);
            await fileLister.Refresh().ConfigureAwait(false);
        }
Exemple #12
0
        public override async void DoAction(NetworkItem item)
        {
            var lister = KexContainer.Resolve <FileLister>();

            lister.Path = @"\\" + item.DisplayName;
            Workspace.ReplaceCurrentLister(lister);
            await lister.Refresh();
        }
Exemple #13
0
        public void Execute(object parameter)
        {
            var viewer = KexContainer.Resolve <ViewFileLister>();

            viewer.Path = _workspace.CurrentItem.Path;
            _workspace.Open(viewer);
            _workspace.ActiveLister.Refresh();
        }
Exemple #14
0
        public override async void DoAction(DriveItem item)
        {
            var fi = KexContainer.Resolve <FileLister>();

            fi.Path = item?.Path;
            Workspace.ReplaceCurrentLister(fi);
            await fi.Refresh().ConfigureAwait(false);
        }
Exemple #15
0
 public async void Execute(object parameter)
 {
     if (_workspace.CurrentItem is FileItem fileItem)
     {
         var processLister = KexContainer.Resolve <ProcessLister>();
         _workspace.Open(processLister);
         await processLister.Refresh().ConfigureAwait(false);
     }
 }
 public async void Execute(object parameter)
 {
     if (_workspace.CurrentItem is FileItem fileItem)
     {
         var referenceLister = KexContainer.Resolve <ReferenceLister>();
         referenceLister.Path = fileItem.GetPathResolved();
         _workspace.Open(referenceLister);
         await referenceLister.Refresh().ConfigureAwait(false);
     }
 }
        public async void Execute(object parameter)
        {
            var favoriteLocation = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
            var fileLister       = KexContainer.Resolve <FileLister>();

            fileLister.Path = favoriteLocation;
            await fileLister.Refresh();

            _workspace.Open(fileLister);
        }
Exemple #18
0
 public void Execute(object parameter)
 {
     if (_workspace.CurrentItem is FileItem fileItem)
     {
         var securityLister = KexContainer.Resolve <SecurityLister>();
         securityLister.Path = fileItem.Path;
         _workspace.Open(securityLister);
         _workspace.ActiveLister.Refresh();
     }
 }
Exemple #19
0
        private async void OpenFileLister(ProcessItem item)
        {
            var fileLister = KexContainer.Resolve <FileLister>();

            fileLister.Path = System.IO.Path.GetDirectoryName(item.FileName);
            await fileLister.Refresh();

            _processItem        = item;
            fileLister.GotView += FileLister_GotView;
            Workspace.Open(fileLister);
        }
Exemple #20
0
        public void Execute(object parameter)
        {
            if (!(_workspace.ActiveLister is FileLister))
            {
                var l = KexContainer.Resolve <FileLister>();
                _workspace.ReplaceCurrentLister(l);
            }
            var favoriteLocation = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);

            _workspace.ActiveLister.Path = favoriteLocation;
            _workspace.ActiveLister.Refresh();
        }
Exemple #21
0
        private async Task ShowFileContent(FileItem fileItem)
        {
            if (_viewFileLister == null) //TODO: Inject
            {
                _viewFileLister = KexContainer.Resolve <ViewFileLister>();
            }

            var targetResolver = new FileItemTargetResolver(fileItem);

            _viewFileLister.Path = targetResolver.TargetPath;

            await _viewFileLister.Refresh().ConfigureAwait(false);

            Items = _viewFileLister.Items;
        }
Exemple #22
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            Assembly.Load("Kexi.Extensions");
            _workspace = KexContainer.Resolve <Workspace>();

            var mainWindow = new MainWindow(_workspace);

            _workspace.DockingMananger    = new DockingSerializer(_workspace, mainWindow.DockManager.DockingManager);
            DispatcherUnhandledException += App_DispatcherUnhandledException;
            mainWindow.Show();
            if (!_workspace.Options.IsInitialized)
            {
                new ShowSetupWindowCommand(_workspace).Execute(null);
            }
        }
Exemple #23
0
        public async void Execute(object parameter)
        {
            if (!(_workspace.CurrentItem is FileItem currentFileItem))
            {
                return;
            }

            var fileLister = KexContainer.Resolve <FileLister>();

            if (currentFileItem.TargetType() == ItemType.Item)
            {
                var path = currentFileItem.GetPathResolved();
                fileLister.Path = Path.GetDirectoryName(path) ?? path;
            }
            else
            {
                var path = currentFileItem.GetPathResolved();
                fileLister.Path = path;
            }

            _workspace.Open(fileLister);
            await fileLister.Refresh().ConfigureAwait(false);
        }
Exemple #24
0
        /// <summary>
        /// Coerce visibility
        /// </summary>
        /// <param name="dependencyObject">Dependency object</param>
        /// <param name="baseValue">Base value</param>
        /// <returns>Coerced value</returns>
        private static object CoerceVisibility(
            DependencyObject dependencyObject,
            object baseValue)
        {
            // Make sure object is a framework element
            FrameworkElement frameworkElement = dependencyObject as FrameworkElement;

            if (frameworkElement == null)
            {
                return(baseValue);
            }

            // Cast to type safe value
            Visibility visibility = (Visibility)baseValue;

            // If Visibility value hasn't change, do nothing.
            // This can happen if the Visibility property is set using data binding
            // and the binding source has changed but the new visibility value Hidden
            // hasn't changed.
            if (visibility == frameworkElement.Visibility)
            {
                return(baseValue);
            }

            // If element is not hooked by our attached property, stop here
            if (!IsHookedElement(frameworkElement))
            {
                return(baseValue);
            }

            // Update animation flag
            // If animation already started, don't restart it (otherwise, infinite loop)
            if (UpdateAnimationStartedFlag(frameworkElement))
            {
                return(baseValue);
            }



            // If we get here, it means we have to start fade in or fade out animation.
            // In any case return value of this method will be Visibility.Visible,
            // to allow the animation.
            var doubleAnimation = new DoubleAnimation
            {
                Duration = new Duration(TimeSpan.FromMilliseconds(AnimationDuration))
            };

            var thicknessAnimation = GetThicknessAnimation(visibility, frameworkElement);

            // When animation completes, set the visibility value to the requested
            // value (baseValue)
            doubleAnimation.Completed += (sender, eventArgs) =>
            {
                if (visibility == Visibility.Visible)
                {
                    // In case we change into Visibility.Visible, the correct value
                    // is already set, so just update the animation started flag
                    UpdateAnimationStartedFlag(frameworkElement);
                }
                else
                {
                    // This will trigger value coercion again
                    // but UpdateAnimationStartedFlag() function will return true
                    // this time, thus animation will not be triggered.
                    if (BindingOperations.IsDataBound(frameworkElement,
                                                      UIElement.VisibilityProperty))
                    {
                        // Set visibility using bounded value
                        Binding bindingValue =
                            BindingOperations.GetBinding(frameworkElement,
                                                         UIElement.VisibilityProperty);
                        BindingOperations.SetBinding(frameworkElement,
                                                     UIElement.VisibilityProperty, bindingValue);
                    }
                    else
                    {
                        // No binding, just assign the value
                        frameworkElement.Visibility = visibility;
                    }
                }
            };



            if (visibility == Visibility.Collapsed || visibility == Visibility.Hidden)
            {
                var workspace = KexContainer.Resolve <Workspace>();
                if (workspace.Options.PopupAnimation == PopupAnimation.None)
                {
                    return(baseValue);
                }
                // Fade out by animating opacity
                doubleAnimation.From = frameworkElement.Opacity;
                doubleAnimation.To   = 0.0;
            }
            else
            {
                // Fade in by animating opacity
                doubleAnimation.From = frameworkElement.Opacity;
                doubleAnimation.To   = 1.0;
            }

            // Start animation
            if (doubleAnimation != null)
            {
                frameworkElement.BeginAnimation(UIElement.OpacityProperty, doubleAnimation);
            }
            if (thicknessAnimation != null)
            {
                frameworkElement.BeginAnimation(FrameworkElement.MarginProperty, thicknessAnimation);
            }

            // Make sure the element remains visible during the animation
            // The original requested value will be set in the completed event of
            // the animation
            return(Visibility.Visible);
        }