diff --git a/DS4Windows/DS4Forms/AutoProfiles.xaml b/DS4Windows/DS4Forms/AutoProfiles.xaml index 6fc2e90..6ca166c 100644 --- a/DS4Windows/DS4Forms/AutoProfiles.xaml +++ b/DS4Windows/DS4Forms/AutoProfiles.xaml @@ -116,8 +116,8 @@ - - + + @@ -152,10 +152,16 @@ - + - + + + + + + + diff --git a/DS4Windows/DS4Forms/AutoProfiles.xaml.cs b/DS4Windows/DS4Forms/AutoProfiles.xaml.cs index bd99a40..6aa8134 100644 --- a/DS4Windows/DS4Forms/AutoProfiles.xaml.cs +++ b/DS4Windows/DS4Forms/AutoProfiles.xaml.cs @@ -66,7 +66,7 @@ namespace DS4WinWPF.DS4Forms autoProfVM = new AutoProfilesViewModel(autoProfileHolder, profileList); programListLV.DataContext = autoProfVM; programListLV.ItemsSource = autoProfVM.ProgramColl; - + revertDefaultProfileOnUnknownCk.DataContext = autoProfVM; autoProfVM.SearchFinished += AutoProfVM_SearchFinished; @@ -277,5 +277,14 @@ namespace DS4WinWPF.DS4Forms this.IsEnabled = true; } } + + private void MoveUpDownAutoBtn_Click(object sender, RoutedEventArgs e) + { + if (autoProfVM.SelectedItem != null && sender != null) + { + if(autoProfVM.MoveItemUpDown(autoProfVM.SelectedItem, ((sender as MenuItem).Name == "MoveUp") ? -1 : 1)) + autoProfVM.AutoProfileHolder.Save(DS4Windows.Global.appdatapath + @"\Auto Profiles.xml"); + } + } } } diff --git a/DS4Windows/DS4Forms/ViewModels/AutoProfilesViewModel.cs b/DS4Windows/DS4Forms/ViewModels/AutoProfilesViewModel.cs index c9107c4..b64376b 100644 --- a/DS4Windows/DS4Forms/ViewModels/AutoProfilesViewModel.cs +++ b/DS4Windows/DS4Forms/ViewModels/AutoProfilesViewModel.cs @@ -326,6 +326,28 @@ namespace DS4WinWPF.DS4Forms.ViewModels return result; } + + public bool MoveItemUpDown(ProgramItem item, int moveDirection) + { + // Move autoprofile item up (-1) or down (1) both in listView (programColl) and in autoProfileHolder data structure (will be written into AutoProfiles.xml file) + bool itemMoved = true; + int oldIdx = programColl.IndexOf(item); + + if (moveDirection == -1 && oldIdx > 0 && oldIdx < autoProfileHolder.AutoProfileColl.Count) + { + programColl.Move(oldIdx, oldIdx - 1); + autoProfileHolder.AutoProfileColl.Move(oldIdx, oldIdx - 1); + } + else if (moveDirection == 1 && oldIdx >= 0 && oldIdx < programColl.Count - 1 && oldIdx < autoProfileHolder.AutoProfileColl.Count - 1) + { + programColl.Move(oldIdx, oldIdx + 1); + autoProfileHolder.AutoProfileColl.Move(oldIdx, oldIdx + 1); + } + else + itemMoved = false; + + return itemMoved; + } } public class ProgramItem diff --git a/DS4Windows/Translations/Strings.Designer.cs b/DS4Windows/Translations/Strings.Designer.cs index ab4fc7e..37be829 100644 --- a/DS4Windows/Translations/Strings.Designer.cs +++ b/DS4Windows/Translations/Strings.Designer.cs @@ -132,6 +132,24 @@ namespace DS4WinWPF.Translations { } } + /// + /// Looks up a localized string similar to Process path. ^ABC = Match at the beginning of string (^) | ABC$ = Match at the end of string ($) | *ABC =Contains a string (*). + /// + public static string AutoProfPathTip { + get { + return ResourceManager.GetString("AutoProfPathTip", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Window title. ^ABC = Match at the beginning of string (^) | ABC$ = Match at the end of string ($) | *ABC =Contains a string (*). + /// + public static string AutoProfTitleTip { + get { + return ResourceManager.GetString("AutoProfTitleTip", resourceCulture); + } + } + /// /// Looks up a localized string similar to Battery. /// @@ -375,6 +393,24 @@ namespace DS4WinWPF.Translations { } } + /// + /// Looks up a localized string similar to Move Down. + /// + public static string MoveDown { + get { + return ResourceManager.GetString("MoveDown", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Move Up. + /// + public static string MoveUp { + get { + return ResourceManager.GetString("MoveUp", resourceCulture); + } + } + /// /// Looks up a localized string similar to Name. /// @@ -644,5 +680,14 @@ namespace DS4WinWPF.Translations { return ResourceManager.GetString("WarningsOnly", resourceCulture); } } + + /// + /// Looks up a localized string similar to Window Title. + /// + public static string WindowTitle { + get { + return ResourceManager.GetString("WindowTitle", resourceCulture); + } + } } } diff --git a/DS4Windows/Translations/Strings.resx b/DS4Windows/Translations/Strings.resx index 907d910..6186cb8 100644 --- a/DS4Windows/Translations/Strings.resx +++ b/DS4Windows/Translations/Strings.resx @@ -312,4 +312,19 @@ Auto stop rumble in secs (0=auto stop disabled) + + Window Title + + + Move Up + + + Move Down + + + Process path. ^ABC = Match at the beginning of string (^) | ABC$ = Match at the end of string ($) | *ABC =Contains a string (*) + + + Window title. ^ABC = Match at the beginning of string (^) | ABC$ = Match at the end of string ($) | *ABC =Contains a string (*) + \ No newline at end of file