Exemple #1
0
        void OnBrowseCommand(object sender)
        {
            UIService.ShowMessage("Drag folder from explorer");

            RunExternal runner = new RunExternal("explorer.exe", ".");

            runner.RunWithoutWaiting(Directory);
        }
 public void OnOpenSelectedFileCommand(object parameter)
 {
     if (_gitRepository.TryGetTarget(out IGitRepository gitRepository) == false)
     {
         return;
     }
     foreach (var item in SelectedModifiedFilePathList)
     {
         string      directory      = gitRepository.GetRepositoryDirectory();
         string      directory_name = System.IO.Path.GetDirectoryName(directory + "\\" + item);
         RunExternal runner         = new RunExternal("explorer.exe", directory_name);
         runner.RunWithoutWaiting(directory + "\\" + item);
     }
 }
 public void OnOpenExplorerSelectedFileCommand(object parameter)
 {
     if (_gitRepository.TryGetTarget(out IGitRepository gitRepository) == false)
     {
         return;
     }
     foreach (var item in SelectedModifiedFilePathList)
     {
         string      full_path      = Path.GetFullPath(Path.Combine(gitRepository.GetRepositoryDirectory(), item));
         string      directory_name = System.IO.Path.GetDirectoryName(full_path);
         RunExternal runner         = new RunExternal("explorer.exe", directory_name);
         runner.RunWithoutWaiting(string.Format("/select, \"{0}\"", full_path));
     }
 }
Exemple #4
0
        public static void AddToolbarButton(PluginData pluginData, ToolBar toolBar, IGitRepository gitRepository)
        {
            Button button = new Button();

            button.Width = 100;
            StackPanel stackPanel = new StackPanel();

            stackPanel.Orientation = Orientation.Vertical;

            BitmapImage bitmapImage = new BitmapImage(new Uri(pluginData.IconPath, UriKind.RelativeOrAbsolute));
            Image       image       = new Image();

            image.Source = bitmapImage;
            image.Width  = 32;
            image.Height = 32;

            TextBlock textBlock = new TextBlock();

            textBlock.HorizontalAlignment = HorizontalAlignment.Center;
            textBlock.Text = pluginData.Title;

            stackPanel.Children.Add(image);
            stackPanel.Children.Add(textBlock);

            button.Content = stackPanel;

            button.Command = new DelegateCommand(async(object parameter) =>
            {
                string workingDirectory = gitRepository.GetRepositoryDirectory();

                switch (pluginData.ExecutionType)
                {
                case ExecutionType.WithoutShellAndNoWaiting:
                    {
                        RunExternal runner = new RunExternal(pluginData.Command, workingDirectory);
                        try
                        {
                            runner.RunWithoutWaiting(pluginData.Argument);
                        }
                        catch (System.Exception exception)
                        {
                            UIService.ShowMessage("Cannot execute. " + exception.Message);
                        }
                        return;
                    }

                case ExecutionType.WimyGitInnerShellAndRefreshRepositoryStatus:
                    {
                        RunExternal runner = new RunExternal(pluginData.Command, workingDirectory);
                        try
                        {
                            runner.RunInConsoleProgressWindow(pluginData.Argument);
                            await gitRepository.Refresh();
                        }
                        catch (System.Exception exception)
                        {
                            UIService.ShowMessage("Cannot execute. " + exception.Message);
                        }
                        return;
                    }
                }
            });

            toolBar.Items.Add(button);
        }
        private void OnOpenExplorerCommand(object sender)
        {
            RunExternal runner = new RunExternal("explorer.exe", Directory);

            runner.RunWithoutWaiting(Directory);
        }