mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Remove result logic so this method can be reused
This commit is contained in:
parent
c55edca7cc
commit
f019bb2284
1 changed files with 21 additions and 28 deletions
|
|
@ -1114,37 +1114,30 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
if (string.IsNullOrEmpty(stringToCopy))
|
||||
{
|
||||
var result = Results.SelectedItem?.Result;
|
||||
if (result != null)
|
||||
{
|
||||
string copyText = result.CopyText;
|
||||
var isFile = File.Exists(copyText);
|
||||
var isFolder = Directory.Exists(copyText);
|
||||
if (isFile || isFolder)
|
||||
{
|
||||
var paths = new StringCollection
|
||||
{
|
||||
copyText
|
||||
};
|
||||
|
||||
Clipboard.SetFileDropList(paths);
|
||||
App.API.ShowMsg(
|
||||
$"{App.API.GetTranslation("copy")} {(isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle"))}",
|
||||
App.API.GetTranslation("completedSuccessfully"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Clipboard.SetDataObject(copyText);
|
||||
App.API.ShowMsg(
|
||||
$"{App.API.GetTranslation("copy")} {App.API.GetTranslation("textTitle")}",
|
||||
App.API.GetTranslation("completedSuccessfully"));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
var isFile = File.Exists(stringToCopy);
|
||||
var isFolder = Directory.Exists(stringToCopy);
|
||||
if (isFile || isFolder)
|
||||
{
|
||||
var paths = new StringCollection
|
||||
{
|
||||
stringToCopy
|
||||
};
|
||||
|
||||
Clipboard.SetDataObject(stringToCopy);
|
||||
Clipboard.SetFileDropList(paths);
|
||||
App.API.ShowMsg(
|
||||
$"{App.API.GetTranslation("copy")} {(isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle"))}",
|
||||
App.API.GetTranslation("completedSuccessfully"));
|
||||
}
|
||||
else
|
||||
{
|
||||
Clipboard.SetDataObject(stringToCopy);
|
||||
App.API.ShowMsg(
|
||||
$"{App.API.GetTranslation("copy")} {App.API.GetTranslation("textTitle")}",
|
||||
App.API.GetTranslation("completedSuccessfully"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
Loading…
Reference in a new issue