Skip to content

Commit

Permalink
Added option to look ahead/back a certain amount of minutes
Browse files Browse the repository at this point in the history
When searching for connections, the app now looks ahead/back _n_ minutes. The parameter _n_ can be changed in the app settings (default: 5).
  • Loading branch information
mbeer committed May 14, 2019
1 parent da2df70 commit 0298e12
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
8 changes: 4 additions & 4 deletions OutlookSwissPTTimetable/PlanJourneyWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ private async void GetConnectionsAsync(Dir dir)

if (dir == Dir.In)
{
time = Appointment.Start.AddMinutes((double)LocationDistanceUpDown.Value * (-1));
time = Appointment.Start.AddMinutes((double)LocationDistanceUpDown.Value * (-1) + Convert.ToDouble(Properties.Settings.Default.LookaheadLookbackMinutes));
from = InConnComboBox.Text.ToString();
to = LocationComboBox.Text.ToString();
isArrivalTime = true;
}
else
{
time = Appointment.End.AddMinutes((double)LocationDistanceUpDown.Value);
time = Appointment.End.AddMinutes((double)LocationDistanceUpDown.Value - Convert.ToDouble(Properties.Settings.Default.LookaheadLookbackMinutes));
to = OutConnComboBox.Text.ToString();
from = LocationComboBox.Text.ToString();
isArrivalTime = false;
Expand Down Expand Up @@ -197,7 +197,7 @@ private async void GetConnectionsAsync(Dir dir)
InConnQryButton.IsEnabled = true;
if (n > 1)
{
InConnDataGrid.SelectedIndex = n - 2;
InConnDataGrid.SelectedIndex = n - 1;
}
}
else
Expand All @@ -209,7 +209,7 @@ private async void GetConnectionsAsync(Dir dir)
OutConnQryButton.IsEnabled = true;
if (n > 1)
{
OutConnDataGrid.SelectedIndex = n - 2;
OutConnDataGrid.SelectedIndex = 0;
}
}

Expand Down
14 changes: 13 additions & 1 deletion OutlookSwissPTTimetable/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions OutlookSwissPTTimetable/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@
<Setting Name="BusyStatus" Type="System.UInt16" Scope="User">
<Value Profile="(Default)">2</Value>
</Setting>
<Setting Name="LookaheadLookbackMinutes" Type="System.String" Scope="User">
<Value Profile="(Default)">5</Value>
</Setting>
</Settings>
</SettingsFile>
7 changes: 5 additions & 2 deletions OutlookSwissPTTimetable/SettingsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Content="Anzahl Verbindungen"/>
<Controls:NumericUpDown Grid.Column="1" Minimum="1" Value="{Binding Source={x:Static Properties:Settings.Default}, Path=ConnectionsLimit}" Maximum="6" HasDecimals="False" />
<Label Content="Verbindung anzeigen als" Grid.Row="1"/>
<ComboBox SelectedValuePath="Tag" SelectedValue="{Binding Source={x:Static Properties:Settings.Default}, Path=BusyStatus, Mode=TwoWay}" Grid.Column="1" Grid.Row="1">
<Label Content="Anzahl Minuten Vor-/Rückschau" Grid.Row="1"/>
<Controls:NumericUpDown Grid.Row="1" Grid.Column="1" Minimum="0" Value="{Binding Source={x:Static Properties:Settings.Default}, Path=LookaheadLookbackMinutes}" Maximum="60" HasDecimals="False" />
<Label Content="Verbindung anzeigen als" Grid.Row="2"/>
<ComboBox SelectedValuePath="Tag" SelectedValue="{Binding Source={x:Static Properties:Settings.Default}, Path=BusyStatus, Mode=TwoWay}" Grid.Column="1" Grid.Row="2">
<ComboBoxItem Content="Frei" Tag="0"/>
<ComboBoxItem Content="An anderem Ort tätig" Tag="4"/>
<ComboBoxItem Content="Mit Vorbehalt" Tag="1"/>
Expand Down
3 changes: 3 additions & 0 deletions OutlookSwissPTTimetable/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<setting name="BusyStatus" serializeAs="String">
<value>2</value>
</setting>
<setting name="LookaheadLookbackMinutes" serializeAs="String">
<value>5</value>
</setting>
</OutlookSwissPTTimetable.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit 0298e12

Please sign in to comment.