mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-22 09:19:18 +01:00
MoveUp and MoveDown context menu (right mouse button) in AutoProfiler list view to move items up or down. If there are wildchars in path or wndTitle search keywords then the order of auto-profile rules is significant. Now it is possible to modify the order of rules through the GUI and not just by editing AutoProfiles.xml file via text editor.
This commit is contained in:
parent
2b25e55611
commit
3a482eca13
@ -152,9 +152,15 @@
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{lex:Loc Path}" Width="600" DisplayMemberBinding="{Binding Path}"/>
|
||||
<GridViewColumn Header="Window Title" Width="Auto" DisplayMemberBinding="{Binding Title}"/>
|
||||
<GridViewColumn Header="{lex:Loc WindowTitle}" Width="Auto" DisplayMemberBinding="{Binding Title}"/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<ListView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{lex:Loc MoveUp}" Name="MoveUp" Click="MoveUpDownAutoBtn_Click"/>
|
||||
<MenuItem Header="{lex:Loc MoveDown}" Name="MoveDown" Click="MoveUpDownAutoBtn_Click"/>
|
||||
</ContextMenu>
|
||||
</ListView.ContextMenu>
|
||||
</ListView>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
27
DS4Windows/Translations/Strings.Designer.cs
generated
27
DS4Windows/Translations/Strings.Designer.cs
generated
@ -375,6 +375,24 @@ namespace DS4WinWPF.Translations {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Move Down.
|
||||
/// </summary>
|
||||
public static string MoveDown {
|
||||
get {
|
||||
return ResourceManager.GetString("MoveDown", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Move Up.
|
||||
/// </summary>
|
||||
public static string MoveUp {
|
||||
get {
|
||||
return ResourceManager.GetString("MoveUp", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Name.
|
||||
/// </summary>
|
||||
@ -644,5 +662,14 @@ namespace DS4WinWPF.Translations {
|
||||
return ResourceManager.GetString("WarningsOnly", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Window Title.
|
||||
/// </summary>
|
||||
public static string WindowTitle {
|
||||
get {
|
||||
return ResourceManager.GetString("WindowTitle", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -312,4 +312,13 @@
|
||||
<data name="RumbleMaxSecsTip" xml:space="preserve">
|
||||
<value>Auto stop rumble in secs (0=auto stop disabled)</value>
|
||||
</data>
|
||||
<data name="WindowTitle" xml:space="preserve">
|
||||
<value>Window Title</value>
|
||||
</data>
|
||||
<data name="MoveUp" xml:space="preserve">
|
||||
<value>Move Up</value>
|
||||
</data>
|
||||
<data name="MoveDown" xml:space="preserve">
|
||||
<value>Move Down</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user