Merge branch 'mika-n-jay' into jay

This commit is contained in:
Travis Nickles 2020-01-16 04:58:50 -06:00
commit fd8281209b
5 changed files with 102 additions and 5 deletions

View File

@ -116,8 +116,8 @@
</Grid> </Grid>
<CheckBox Content="Turn Off DS4Window Temporarily" Margin="{StaticResource spaceMargin}" <CheckBox Content="Turn Off DS4Window Temporarily" Margin="{StaticResource spaceMargin}"
IsChecked="{Binding Turnoff}" /> IsChecked="{Binding Turnoff}" />
<TextBox Text="{Binding Path}" Margin="{StaticResource spaceMargin}" /> <TextBox Text="{Binding Path}" Margin="{StaticResource spaceMargin}" ToolTip="{lex:Loc AutoProfPathTip}"/>
<TextBox Text="{Binding Title, UpdateSourceTrigger=LostFocus}" Margin="{StaticResource spaceMargin}" /> <TextBox Text="{Binding Title, UpdateSourceTrigger=LostFocus}" Margin="{StaticResource spaceMargin}" ToolTip="{lex:Loc AutoProfTitleTip}"/>
<Border Height="4" Background="#FFDADADA" Margin="0,10,0,0" /> <Border Height="4" Background="#FFDADADA" Margin="0,10,0,0" />
</StackPanel> </StackPanel>
<CheckBox x:Name="revertDefaultProfileOnUnknownCk" Content="Revert to default profile on unknown" Margin="0,10,0,0" IsChecked="{Binding RevertDefaultProfileOnUnknown}" /> <CheckBox x:Name="revertDefaultProfileOnUnknownCk" Content="Revert to default profile on unknown" Margin="0,10,0,0" IsChecked="{Binding RevertDefaultProfileOnUnknown}" />
@ -152,9 +152,15 @@
</GridViewColumn.CellTemplate> </GridViewColumn.CellTemplate>
</GridViewColumn> </GridViewColumn>
<GridViewColumn Header="{lex:Loc Path}" Width="600" DisplayMemberBinding="{Binding Path}"/> <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> </GridView>
</ListView.View> </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> </ListView>
</DockPanel> </DockPanel>
</DockPanel> </DockPanel>

View File

@ -277,5 +277,14 @@ namespace DS4WinWPF.DS4Forms
this.IsEnabled = true; 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");
}
}
} }
} }

View File

@ -326,6 +326,28 @@ namespace DS4WinWPF.DS4Forms.ViewModels
return result; 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 public class ProgramItem

View File

@ -132,6 +132,24 @@ namespace DS4WinWPF.Translations {
} }
} }
/// <summary>
/// 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 (*).
/// </summary>
public static string AutoProfPathTip {
get {
return ResourceManager.GetString("AutoProfPathTip", resourceCulture);
}
}
/// <summary>
/// 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 (*).
/// </summary>
public static string AutoProfTitleTip {
get {
return ResourceManager.GetString("AutoProfTitleTip", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Battery. /// Looks up a localized string similar to Battery.
/// </summary> /// </summary>
@ -375,6 +393,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> /// <summary>
/// Looks up a localized string similar to Name. /// Looks up a localized string similar to Name.
/// </summary> /// </summary>
@ -644,5 +680,14 @@ namespace DS4WinWPF.Translations {
return ResourceManager.GetString("WarningsOnly", resourceCulture); 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);
}
}
} }
} }

View File

@ -312,4 +312,19 @@
<data name="RumbleMaxSecsTip" xml:space="preserve"> <data name="RumbleMaxSecsTip" xml:space="preserve">
<value>Auto stop rumble in secs (0=auto stop disabled)</value> <value>Auto stop rumble in secs (0=auto stop disabled)</value>
</data> </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>
<data name="AutoProfPathTip" xml:space="preserve">
<value>Process path. ^ABC = Match at the beginning of string (^) | ABC$ = Match at the end of string ($) | *ABC =Contains a string (*)</value>
</data>
<data name="AutoProfTitleTip" xml:space="preserve">
<value>Window title. ^ABC = Match at the beginning of string (^) | ABC$ = Match at the end of string ($) | *ABC =Contains a string (*)</value>
</data>
</root> </root>