diff --git a/ClipCMD/MainWindow.xaml b/ClipCMD/MainWindow.xaml
index 1b066eb..5f7ade2 100644
--- a/ClipCMD/MainWindow.xaml
+++ b/ClipCMD/MainWindow.xaml
@@ -48,7 +48,7 @@
-
+
@@ -59,7 +59,16 @@
-
+
+
+
+
+
+
+
+
+
+
diff --git a/ClipCMD/MainWindow.xaml.cs b/ClipCMD/MainWindow.xaml.cs
index b8198e2..5a509cb 100644
--- a/ClipCMD/MainWindow.xaml.cs
+++ b/ClipCMD/MainWindow.xaml.cs
@@ -83,7 +83,7 @@ public partial class MainWindow : Window
RuntimeData.Errors.Add($"[{commandNames}]\n{error}");
}
- private void CancelAutoType_Click(object sender, RoutedEventArgs e)
+ private void CancelAutoTypeButton_Click(object sender, RoutedEventArgs e)
{
RuntimeData.AutoTypeRunning = false;
}
@@ -187,6 +187,12 @@ public partial class MainWindow : Window
}
}
+ private void CopyToClipboardButton_Click(object sender, RoutedEventArgs e)
+ {
+ Clipboard.SetText(RuntimeData.CommandsText);
+ _ = MessageBox.Show($"Successfully copied {commands.Count - 1} command(s) to clipboard!", "Success!", MessageBoxButton.OK, MessageBoxImage.Information);
+ }
+
private void NotifyIcon_Click(object? sender, EventArgs e)
{
Show();
@@ -221,6 +227,8 @@ public partial class MainWindow : Window
RuntimeData.Errors.Clear();
commands.Clear();
+ RuntimeData.CommandsInfo = $"Lines: {lines.Length} Commands: {commands.Count} Errors: {RuntimeData.Errors.Count}";
+
foreach (string l in lines)
{
string line = l.Trim('\n', '\r');
@@ -243,11 +251,15 @@ public partial class MainWindow : Window
{
if (string.IsNullOrWhiteSpace(commandName))
{
- AddError(commandNames, "Command \"{commandName}\" is empty!");
+ AddError(commandNames, $"Command \"{commandName}\" is empty!");
+ }
+ else if (commandName.Any(char.IsWhiteSpace))
+ {
+ AddError(commandNames, $"Command \"{commandName}\" can't contain white spaces!");
}
else if (!commands.TryAdd(commandName.Trim(), script.ToString()))
{
- AddError(commandNames, "Command \"{commandName}\" already exists!");
+ AddError(commandNames, $"Command \"{commandName}\" already exists!");
}
}
}
@@ -269,6 +281,8 @@ public partial class MainWindow : Window
}
}
+ RuntimeData.CommandsInfo = $"Lines: {lines.Length} Commands: {commands.Count} Errors: {RuntimeData.Errors.Count}";
+
_ = commands.TryAdd("list", $"\"{string.Join(", ", commands.Keys)}\"");
File.WriteAllText(commandsPath, RuntimeData.CommandsText);
diff --git a/ClipCMD/RuntimeData.cs b/ClipCMD/RuntimeData.cs
index fb89884..87bd772 100644
--- a/ClipCMD/RuntimeData.cs
+++ b/ClipCMD/RuntimeData.cs
@@ -12,6 +12,7 @@ public class RuntimeData : INotifyPropertyChanged
public event PropertyChangedEventHandler? PropertyChanged;
private bool autoTypeRunning = false;
+ private string commandsInfo = string.Empty;
private string commandsText = string.Empty;
private Visibility errorPanelVisible = Visibility.Collapsed;
private Visibility logPanelVisible = Visibility.Visible;
@@ -26,6 +27,16 @@ public class RuntimeData : INotifyPropertyChanged
}
}
+ public string CommandsInfo
+ {
+ get => commandsInfo;
+ set
+ {
+ commandsInfo = value;
+ OnPropertyChanged();
+ }
+ }
+
public string CommandsText
{
get => commandsText;
@@ -36,7 +47,7 @@ public class RuntimeData : INotifyPropertyChanged
}
}
- public Color CommandsTextColor => Errors.Count > 0 ? Colors.Red : Colors.Black;
+ public Brush CommandsTextColor => Errors.Count > 0 ? Brushes.Red : Brushes.Black;
public Visibility ErrorPanelVisible
{
@@ -68,6 +79,7 @@ public class RuntimeData : INotifyPropertyChanged
{
ErrorPanelVisible = Errors.Any() ? Visibility.Visible : Visibility.Collapsed;
LogPanelVisible = Errors.Any() ? Visibility.Collapsed : Visibility.Visible;
+ OnPropertyChanged(nameof(CommandsTextColor));
};
}