Added history filter for own shipcalls only, added wait cursor for longer reloading ops
This commit is contained in:
parent
9f80f2cf5f
commit
f58688499a
@ -16,6 +16,17 @@
|
|||||||
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" Margin="2">
|
<ScrollViewer Grid.Row="0" VerticalScrollBarVisibility="Auto" Margin="2">
|
||||||
<StackPanel x:Name="stackPanel"/>
|
<StackPanel x:Name="stackPanel"/>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
<Button x:Name="buttonClose" Click="buttonClose_Click" Content="{x:Static p:Resources.textClose}" Width="80" Margin="2" Grid.Row="1" HorizontalAlignment="Right" />
|
<Grid Grid.Row="1" Grid.Column="0" >
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="22" />
|
||||||
|
<ColumnDefinition Width="80" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width=".2*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<CheckBox x:Name="checkboxMyOwnOnly" VerticalContentAlignment="Center" Grid.Column="0" Margin="2" Checked="checkboxMyOwnOnly_Checked" Unchecked="checkboxMyOwnOnly_Checked" />
|
||||||
|
<Label Content="{x:Static p:Resources.textMineOnly}" Grid.Column="1" />
|
||||||
|
<Button x:Name="buttonClose" Click="buttonClose_Click" Content="{x:Static p:Resources.textClose}" Width="80" Margin="2" Grid.Row="0" Grid.Column="3" HorizontalAlignment="Right" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@ -9,6 +9,7 @@ using System.Collections.Concurrent;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Printing;
|
using System.Printing;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace BreCalClient
|
namespace BreCalClient
|
||||||
{
|
{
|
||||||
@ -45,6 +46,7 @@ namespace BreCalClient
|
|||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Mouse.OverrideCursor = Cursors.Wait;
|
||||||
RefreshHistory();
|
RefreshHistory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +55,12 @@ namespace BreCalClient
|
|||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkboxMyOwnOnly_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Mouse.OverrideCursor = Cursors.Wait;
|
||||||
|
RefreshHistory();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region private methods
|
#region private methods
|
||||||
@ -60,6 +68,8 @@ namespace BreCalClient
|
|||||||
private async void RefreshHistory()
|
private async void RefreshHistory()
|
||||||
{
|
{
|
||||||
List<History> allHistories = new();
|
List<History> allHistories = new();
|
||||||
|
this.stackPanel.Children.Clear();
|
||||||
|
|
||||||
foreach (int shipcall_id in _shipcalls.Keys)
|
foreach (int shipcall_id in _shipcalls.Keys)
|
||||||
{
|
{
|
||||||
List<History> shipcallHistory = await _staticApi.HistoryGetAsync(shipcall_id);
|
List<History> shipcallHistory = await _staticApi.HistoryGetAsync(shipcall_id);
|
||||||
@ -75,6 +85,7 @@ namespace BreCalClient
|
|||||||
// create controls for all entries
|
// create controls for all entries
|
||||||
foreach (History history in allHistories)
|
foreach (History history in allHistories)
|
||||||
{
|
{
|
||||||
|
if (FilterShipcall(history.ShipcallId)) continue;
|
||||||
string shipname = "";
|
string shipname = "";
|
||||||
Ship? ship = this._shipcalls[history.ShipcallId].Ship;
|
Ship? ship = this._shipcalls[history.ShipcallId].Ship;
|
||||||
if (ship != null)
|
if (ship != null)
|
||||||
@ -94,10 +105,32 @@ namespace BreCalClient
|
|||||||
hc.HistorySelected += (x) => { HistoryItemSelected?.Invoke(x); }; // bubble event
|
hc.HistorySelected += (x) => { HistoryItemSelected?.Invoke(x); }; // bubble event
|
||||||
this.stackPanel.Children.Add(hc);
|
this.stackPanel.Children.Add(hc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FilterShipcall(int shipcallId)
|
||||||
|
{
|
||||||
|
bool result = true;
|
||||||
|
if (shipcallId < 0) return result;
|
||||||
|
if(_shipcalls.TryGetValue(shipcallId, out ShipcallControlModel? scm))
|
||||||
|
{
|
||||||
|
if(this.checkboxMyOwnOnly.IsChecked ?? false)
|
||||||
|
{
|
||||||
|
foreach(ParticipantAssignment p in scm.AssignedParticipants.Values)
|
||||||
|
{
|
||||||
|
if (p.ParticipantId.Equals(App.Participant.Id)) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ using Newtonsoft.Json;
|
|||||||
using Polly;
|
using Polly;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
|
||||||
namespace BreCalClient
|
namespace BreCalClient
|
||||||
@ -160,6 +161,7 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
if (_loginResult.Id > 0)
|
if (_loginResult.Id > 0)
|
||||||
{
|
{
|
||||||
|
Mouse.OverrideCursor = Cursors.Wait;
|
||||||
this.busyIndicator.IsBusy = false;
|
this.busyIndicator.IsBusy = false;
|
||||||
this._userApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
this._userApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||||
this._shipcallApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
this._shipcallApi.Configuration.ApiKey["Authorization"] = _loginResult.Token;
|
||||||
@ -380,6 +382,7 @@ namespace BreCalClient
|
|||||||
{
|
{
|
||||||
_refreshImmediately = true; // set flag to avoid timer loop termination
|
_refreshImmediately = true; // set flag to avoid timer loop termination
|
||||||
_tokenSource.Cancel(); // force timer loop end
|
_tokenSource.Cancel(); // force timer loop end
|
||||||
|
Mouse.OverrideCursor = Cursors.Wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -492,7 +495,7 @@ namespace BreCalClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.FilterShipcalls();
|
this.FilterShipcalls();
|
||||||
this.UpdateUI();
|
this.UpdateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -778,6 +781,7 @@ namespace BreCalClient
|
|||||||
_uiUpdateRunning = 0;
|
_uiUpdateRunning = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mouse.OverrideCursor = null;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user