From d5a18dd454de7ad8431af0ddd9ca592aeddfccc6 Mon Sep 17 00:00:00 2001 From: Roberto <107645954+intcooper@users.noreply.github.com> Date: Mon, 20 May 2024 08:47:10 +0200 Subject: [PATCH] Remove unused using directives and NuGet packages --- MMExNotifier/MMExNotifier.csproj | 1 - MMExNotifier/Views/MainWindow.xaml | 4 +-- MMExNotifier/Views/MainWindow.xaml.cs | 38 +-------------------------- 3 files changed, 2 insertions(+), 41 deletions(-) diff --git a/MMExNotifier/MMExNotifier.csproj b/MMExNotifier/MMExNotifier.csproj index cfa741f..7cb3071 100644 --- a/MMExNotifier/MMExNotifier.csproj +++ b/MMExNotifier/MMExNotifier.csproj @@ -19,7 +19,6 @@ - diff --git a/MMExNotifier/Views/MainWindow.xaml b/MMExNotifier/Views/MainWindow.xaml index fc205a2..c71c05c 100644 --- a/MMExNotifier/Views/MainWindow.xaml +++ b/MMExNotifier/Views/MainWindow.xaml @@ -278,10 +278,8 @@ + IsChecked="{Binding Path=AppSettings.RunAtLogon}" /> diff --git a/MMExNotifier/Views/MainWindow.xaml.cs b/MMExNotifier/Views/MainWindow.xaml.cs index 02e7fea..83e6d2a 100644 --- a/MMExNotifier/Views/MainWindow.xaml.cs +++ b/MMExNotifier/Views/MainWindow.xaml.cs @@ -1,16 +1,8 @@ -using System; -using System.Windows; -using System.Windows.Input; -using Microsoft.Win32; -using Microsoft.Win32.TaskScheduler; -using System.Security.Principal; +using System.Windows; using System.IO; using Drawing = System.Drawing; using System.Reflection; using WpfUi = Wpf.Ui.Controls; -using static System.Windows.Forms.VisualStyles.VisualStyleElement; -using System.Windows.Forms; -using Windows.UI.ApplicationSettings; namespace MMExNotifier { @@ -51,34 +43,6 @@ private void SettingsPanelClose_Click(object sender, RoutedEventArgs e) settingsPanel.Visibility = Visibility.Collapsed; } - - private void RunOnLogon_Checked(object sender, RoutedEventArgs e) - { - using TaskService taskService = new(); - TaskDefinition taskDefinition = taskService.NewTask(); - - // Set the task settings - taskDefinition.RegistrationInfo.Description = "MMExNotifier"; - var userId = WindowsIdentity.GetCurrent().Name; - - // Set the trigger to run on logon - LogonTrigger logonTrigger = new() { UserId = userId }; - taskDefinition.Triggers.Add(logonTrigger); - - // Set the action to run the executable that creates the task - string executablePath = Environment.ProcessPath ?? ""; - taskDefinition.Actions.Add(new ExecAction(executablePath)); - - // Register the task in the Windows Task Scheduler - taskService.RootFolder.RegisterTaskDefinition("MMExNotifier", taskDefinition); - } - - private void RunOnLogon_Unchecked(object sender, RoutedEventArgs e) - { - using TaskService taskService = new(); - taskService.RootFolder.DeleteTask("MMExNotifier", false); - } - private void OpenFile_Click(object sender, RoutedEventArgs e) { var openFileDialog = new Microsoft.Win32.OpenFileDialog