diff --git a/OpenSpaceToolbox/Properties/AssemblyInfo.cs b/OpenSpaceToolbox/Properties/AssemblyInfo.cs index 6348193..c88e502 100644 --- a/OpenSpaceToolbox/Properties/AssemblyInfo.cs +++ b/OpenSpaceToolbox/Properties/AssemblyInfo.cs @@ -49,5 +49,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.2.0.0")] -[assembly: AssemblyFileVersion("3.2.0.0")] +[assembly: AssemblyVersion("3.3.0.0")] +[assembly: AssemblyFileVersion("3.3.0.0")] diff --git a/OpenSpaceToolbox/ViewModels/Bookmarks/BookmarkItemViewModel.cs b/OpenSpaceToolbox/ViewModels/Bookmarks/BookmarkItemViewModel.cs index 0b08fb7..2a67c1f 100644 --- a/OpenSpaceToolbox/ViewModels/Bookmarks/BookmarkItemViewModel.cs +++ b/OpenSpaceToolbox/ViewModels/Bookmarks/BookmarkItemViewModel.cs @@ -41,17 +41,17 @@ public BookmarkItemViewModel(string level, string name, float x, float y, float /// /// The X position /// - public float X { get; } + public float X { get; set; } /// /// The Y position /// - public float Y { get; } + public float Y { get; set; } /// /// The Z position /// - public float Z { get; } + public float Z { get; set; } #endregion diff --git a/OpenSpaceToolbox/ViewModels/Bookmarks/BookmarksViewModel.cs b/OpenSpaceToolbox/ViewModels/Bookmarks/BookmarksViewModel.cs index 406bc87..35d4c0c 100644 --- a/OpenSpaceToolbox/ViewModels/Bookmarks/BookmarksViewModel.cs +++ b/OpenSpaceToolbox/ViewModels/Bookmarks/BookmarksViewModel.cs @@ -63,6 +63,8 @@ public BookmarksViewModel(GenericGameManager gameManager) private string _currentLevel; + #endregion + #region Private Methods /// @@ -82,16 +84,14 @@ private void LoadBookmarks() var bookmark = element.Element("Bookmark"); AllBookmarkItems.Add(new BookmarkItemViewModel(element.Name.LocalName, bookmark.Element("Name").Value, - Single.Parse(bookmark.Element("X").Value, CultureInfo.InvariantCulture.NumberFormat), - Single.Parse(bookmark.Element("Y").Value, CultureInfo.InvariantCulture.NumberFormat), - Single.Parse(bookmark.Element("Z").Value, CultureInfo.InvariantCulture.NumberFormat))); + float.Parse(bookmark.Element("X").Value, CultureInfo.InvariantCulture.NumberFormat), + float.Parse(bookmark.Element("Y").Value, CultureInfo.InvariantCulture.NumberFormat), + float.Parse(bookmark.Element("Z").Value, CultureInfo.InvariantCulture.NumberFormat))); } } #endregion - #endregion - #region Public Properties /// @@ -258,31 +258,34 @@ public void RenameBookmark() if (SelectedBookmark == null) return; - RenameDialog rename = new RenameDialog - { - Owner = Application.Current.MainWindow, - WindowStartupLocation = WindowStartupLocation.CenterOwner, - txtbox_name = + RenameDialog rename = + new RenameDialog(SelectedBookmark.Name, SelectedBookmark.X, SelectedBookmark.Y, SelectedBookmark.Z) { - Text = SelectedBookmark.Name - } - }; + Owner = Application.Current.MainWindow, + WindowStartupLocation = WindowStartupLocation.CenterOwner + }; rename.ShowDialog(); - // Get the result - string renameBookmarkName = rename.Result; + if (!rename.Result) return; - if (String.IsNullOrEmpty(renameBookmarkName) || SelectedBookmark.Name == renameBookmarkName) - return; + string newName; - if (AllBookmarkItems.Any(x => x.Name == renameBookmarkName)) + if (rename.BookmarkName != SelectedBookmark.Name && AllBookmarkItems.Any(x => x.Name == rename.BookmarkName)) { - MessageBox.Show("A bookmark with that name already exists!"); - return; + int i = 1; + do + { + newName = rename.BookmarkName + $" ({i})"; + i++; + } while (AllBookmarkItems.Any(x => x.Name == newName)); } + else newName = rename.BookmarkName; - SelectedBookmark.Name = renameBookmarkName; + SelectedBookmark.Name = newName; + SelectedBookmark.X = rename.X; + SelectedBookmark.Y = rename.Y; + SelectedBookmark.Z = rename.Z; } /// diff --git a/OpenSpaceToolbox/Views/GameManagerFullView.xaml b/OpenSpaceToolbox/Views/GameManagerFullView.xaml index 5dcfc05..e3986e9 100644 --- a/OpenSpaceToolbox/Views/GameManagerFullView.xaml +++ b/OpenSpaceToolbox/Views/GameManagerFullView.xaml @@ -214,7 +214,7 @@ Margin="0 0 3 3" Command="{Binding Path=BookmarksVm.AddBookmarkCommand}" /> -