diff --git a/UnityLauncherPro/GetProjects.cs b/UnityLauncherPro/GetProjects.cs index 19f1a17..caabb2e 100644 --- a/UnityLauncherPro/GetProjects.cs +++ b/UnityLauncherPro/GetProjects.cs @@ -117,7 +117,6 @@ public static List Scan(bool getGitBranch = false, bool getPlasticBranc //Console.WriteLine("Trimming projects list to " + MainWindow.maxProjectCount + " projects"); projectsFound.RemoveRange(MainWindow.maxProjectCount, projectsFound.Count - MainWindow.maxProjectCount); } - return projectsFound; } // Scan() diff --git a/UnityLauncherPro/MainWindow.xaml.cs b/UnityLauncherPro/MainWindow.xaml.cs index dd31b86..0d8dd52 100644 --- a/UnityLauncherPro/MainWindow.xaml.cs +++ b/UnityLauncherPro/MainWindow.xaml.cs @@ -1068,6 +1068,35 @@ private void OnWindowKeyDown(object sender, KeyEventArgs e) } + private void RemoveProjectFromList(bool confirm = false) + { + var proj = GetSelectedProject(); + if (proj == null) return; + + if (confirm == true) + { + // streamer mode, show first char and last 3 chars, rest as * + var cleantitle = proj.Title[0] + new string('*', proj.Title.Length - 1); + var title = chkStreamerMode.IsChecked == true ? cleantitle : proj.Title; + var result = MessageBox.Show("Are you sure you want to remove project from list?\n\n" + title, "Remove project", MessageBoxButton.YesNo, MessageBoxImage.Question); + if (result == MessageBoxResult.No) return; + } + + if (GetProjects.RemoveRecentProject(proj.Path)) + { + RefreshRecentProjects(); + } + else + { + // we had added this project manually, without opening yet, just remove item + projectsSource.Remove(proj); + gridRecent.Items.Refresh(); + Tools.SetFocusToGrid(gridRecent); + gridRecent.SelectedIndex = 0; + } + + } + private async void OnTabSelectionChanged(object sender, SelectionChangedEventArgs e) { // if going into updates tab, fetch list (first time only) @@ -1378,6 +1407,7 @@ private void GridRecent_PreviewKeyDown(object sender, KeyEventArgs e) // // if edit mode, dont override keys if (IsEditingCell(gridRecent) == true) return; e.Handled = true; + RemoveProjectFromList(confirm: true); // MenuRemoveProject_Click(null, null); break; default: @@ -3020,22 +3050,7 @@ private void BtnThemeEditor_Click(object sender, RoutedEventArgs e) private void MenuRemoveProject_Click(object sender, RoutedEventArgs e) { - // delete if enabled in settings - var proj = GetSelectedProject(); - if (proj == null) return; - - if (GetProjects.RemoveRecentProject(proj.Path)) - { - RefreshRecentProjects(); - } - else - { - // we had added this project manually, without opening yet, just remove item - projectsSource.Remove(proj); - gridRecent.Items.Refresh(); - Tools.SetFocusToGrid(gridRecent); - gridRecent.SelectedIndex = 0; - } + RemoveProjectFromList(); } private void MenuItemDownloadAndroidModule_Click(object sender, RoutedEventArgs e) @@ -3394,7 +3409,7 @@ private void Window_MouseDown(object sender, MouseButtonEventArgs e) public void SetStatus(string msg, MessageType messageType = MessageType.Info) { - Console.WriteLine(messageType); + //Console.WriteLine(messageType); switch (messageType) { case MessageType.Info: @@ -3772,7 +3787,7 @@ private void OnPipeConnection(IAsyncResult result) private void CheckCustomIcon() { string customIconPath = Path.Combine(Environment.CurrentDirectory, "icon.ico"); - Console.WriteLine(customIconPath); + //Console.WriteLine(customIconPath); if (File.Exists(customIconPath)) {