BetterExplorer.MainWindow.miCreateSymlink_Click C# (CSharp) Метод

miCreateSymlink_Click() приватный Метод

private miCreateSymlink_Click ( object sender, RoutedEventArgs e ) : void
sender object
e RoutedEventArgs
Результат void
    private void miCreateSymlink_Click(object sender, RoutedEventArgs e) {
      var items = new IListItemEx[0];
      items = Clipboards.ContainsData("Shell IDList Array") ? Clipboards.GetDataObject().ToShellItemArray().ToArray().Select(s => FileSystemListItem.InitializeWithIShellItem(this._ShellListView.LVHandle, s)).ToArray() : Clipboards.GetFileDropList().OfType<string>().ToArray().Select(s => FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, s)).ToArray();
      var pathForDrop = _ShellListView.CurrentFolder.ParsingName.Replace(@"\\", @"\");
      var exePath = Utilities.AppDirectoryItem("BetterExplorerOperations.exe");
      var linkItems = items.Select(s => new LinkItem() {
        IsDirectory = s.IsFolder,
        DestinationData = pathForDrop + @"\" + s.DisplayName,
        SourceData = s.ParsingName
      }).ToArray();

      Task.Run(() => {
        using (var proc = new Process()) {
          proc.StartInfo = new ProcessStartInfo {
            FileName = exePath,
            Verb = "runas",
            UseShellExecute = true,
            Arguments = $"/env /user:Administrator \"{exePath}\""
          };

          proc.Start();
          ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3;
          var address = new EndpointAddress(new Uri("net.tcp://localhost:60000/BEComChannel"));
          var binding = new NetTcpBinding() { MaxReceivedMessageSize = 4000000, MaxBufferPoolSize = 4000000, MaxBufferSize = 4000000 };
          binding.Security = new NetTcpSecurity() { Mode = SecurityMode.Message };
          var factory = new ChannelFactory<IBetterExplorerCommunication>(binding, address);
          var beSvc = factory.CreateChannel();
          try {
            beSvc.CreateLink(new LinkData() { Items = linkItems });
          } finally {
            Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => this._ShellListView.UnvalidateDirectory()));
          }

          proc.WaitForExit();
          if (proc.ExitCode == 1)
            MessageBox.Show("Error in creating symlink", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
          else {
            Thread.Sleep(1000);
            Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() => this._ShellListView.UnvalidateDirectory()));
          }
        }
      });

    }
MainWindow