Exemplo n.º 1
0
        void OnBrowseCommand(object sender)
        {
            UIService.ShowMessage("Drag folder from explorer");

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

            runner.RunWithoutWaiting(Directory);
        }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 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));
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
        private void OnOpenExplorerCommand(object sender)
        {
            RunExternal runner = new RunExternal("explorer.exe", Directory);

            runner.RunWithoutWaiting(Directory);
        }