Skip to content

Commit f019bb2

Browse files
committed
Remove result logic so this method can be reused
1 parent c55edca commit f019bb2

File tree

1 file changed

+21
-28
lines changed

1 file changed

+21
-28
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,37 +1114,30 @@ public void ResultCopy(string stringToCopy)
11141114
{
11151115
if (string.IsNullOrEmpty(stringToCopy))
11161116
{
1117-
var result = Results.SelectedItem?.Result;
1118-
if (result != null)
1119-
{
1120-
string copyText = result.CopyText;
1121-
var isFile = File.Exists(copyText);
1122-
var isFolder = Directory.Exists(copyText);
1123-
if (isFile || isFolder)
1124-
{
1125-
var paths = new StringCollection
1126-
{
1127-
copyText
1128-
};
1129-
1130-
Clipboard.SetFileDropList(paths);
1131-
App.API.ShowMsg(
1132-
$"{App.API.GetTranslation("copy")} {(isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle"))}",
1133-
App.API.GetTranslation("completedSuccessfully"));
1134-
}
1135-
else
1136-
{
1137-
Clipboard.SetDataObject(copyText);
1138-
App.API.ShowMsg(
1139-
$"{App.API.GetTranslation("copy")} {App.API.GetTranslation("textTitle")}",
1140-
App.API.GetTranslation("completedSuccessfully"));
1141-
}
1142-
}
1143-
11441117
return;
11451118
}
1119+
var isFile = File.Exists(stringToCopy);
1120+
var isFolder = Directory.Exists(stringToCopy);
1121+
if (isFile || isFolder)
1122+
{
1123+
var paths = new StringCollection
1124+
{
1125+
stringToCopy
1126+
};
11461127

1147-
Clipboard.SetDataObject(stringToCopy);
1128+
Clipboard.SetFileDropList(paths);
1129+
App.API.ShowMsg(
1130+
$"{App.API.GetTranslation("copy")} {(isFile ? App.API.GetTranslation("fileTitle") : App.API.GetTranslation("folderTitle"))}",
1131+
App.API.GetTranslation("completedSuccessfully"));
1132+
}
1133+
else
1134+
{
1135+
Clipboard.SetDataObject(stringToCopy);
1136+
App.API.ShowMsg(
1137+
$"{App.API.GetTranslation("copy")} {App.API.GetTranslation("textTitle")}",
1138+
App.API.GetTranslation("completedSuccessfully"));
1139+
}
1140+
return;
11481141
}
11491142

11501143
#endregion

0 commit comments

Comments
 (0)