Skip to content

Commit

Permalink
Removed paging elements + DataGrid update fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hen676 committed Sep 17, 2022
1 parent fccc6ce commit d746b50
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 38 deletions.
9 changes: 5 additions & 4 deletions FadedVanguardLogUploader/ViewModels/ListViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace FadedVanguardLogUploader.ViewModels
{
public class ListViewModel : ViewModelBase
{
public List<ListItem> Items { get; set; } = new();
public ObservableCollection<ListItem> Items { get; } = new();
public int FileCount
{
get => fileCount;
Expand Down Expand Up @@ -102,7 +102,7 @@ private async void UploadAsync()
if (file.UploadUrl == string.Empty)
continue;

if (lastboss == Encounter.Empty || lastboss != file.Encounter)
if (lastboss == Encounter.Empty || lastboss != file.Encounter)
{
clipborad.Add($"{file.Encounter}");
lastboss = file.Encounter;
Expand All @@ -126,9 +126,9 @@ public void UpdateFolder()
if (App.Settings.Path == "")
return;
IEnumerable<string> files = Directory.EnumerateFiles(App.Settings.Path, "*evtc*", SearchOption.AllDirectories)
.Where(s =>
.Where(s =>
(s.ToLower().EndsWith(".evtc") ||
s.ToLower().EndsWith(".evtc.zip") ||
s.ToLower().EndsWith(".evtc.zip") ||
s.ToLower().EndsWith(".zevtc")) &&
!StoredItems.Any(val => s.Equals(val.FullPath)));
if (!files.Any())
Expand Down Expand Up @@ -220,6 +220,7 @@ public void Sort()
});
break;
}
Items.Clear();
Items.AddRange(FilteredItems);
}

Expand Down
2 changes: 2 additions & 0 deletions FadedVanguardLogUploader/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ private void NameSort()
List.Filter();
}

// TODO: Force restart for change
private void ChangeLanguage(string code)
{
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfoByIetfLanguageTag(code);
Expand Down Expand Up @@ -174,6 +175,7 @@ private void ErrorHidden()
List.Filter();
}

// TODO: Force restart for change
private void Mode()
{
ModeToggle = !ModeToggle;
Expand Down
34 changes: 4 additions & 30 deletions FadedVanguardLogUploader/Views/ListView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,14 @@
<Grid DockPanel.Dock="Bottom" Margin="0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>

<Button Grid.Column="0"
DockPanel.Dock="Bottom"
Command="{Binding PageDownCommand}"
IsEnabled="{Binding EnabledDown}">&lt;</Button>
<TextBlock Grid.Column="1"
VerticalAlignment="Center"
TextAlignment="Right"
Width="30"
Text="{Binding Page, Mode=OneWay,
Converter={StaticResource pageConverter}}"></TextBlock>
<TextBlock Grid.Column="2"
Padding="0,0,0,0"
VerticalAlignment="Center">/</TextBlock>
<TextBlock Grid.Column="3"
VerticalAlignment="Center"
Width="30"
Text="{Binding PageMax}"
Padding="1,0,8,0"></TextBlock>
<Button Grid.Column="4"
DockPanel.Dock="Bottom"
Command="{Binding PageUpCommand}"
IsEnabled="{Binding EnabledUp}">&gt;</Button>
<ProgressBar Grid.Column="5"
<ProgressBar Grid.Column="0"
Value="{Binding ProgressBarValue}"
Maximum="{Binding ProgressBarMax}"
ToolTip.Tip="{x:Static p:Resources.LNG_List_Bar_Tooltip}"/>
<Button Grid.Column="6"
<Button Grid.Column="1"
HorizontalAlignment="Right"
DockPanel.Dock="Bottom"
Command="{Binding UploadCommand}"
Expand All @@ -66,7 +39,8 @@
<DataGrid Items="{Binding Items}"
AutoGenerateColumns="False"
CanUserReorderColumns="True"
CanUserResizeColumns="True">
CanUserResizeColumns="True"
Name="Test">
<DataGrid.Columns>
<DataGridCheckBoxColumn Header=""
Binding="{Binding IsSelected}"/>
Expand Down
12 changes: 8 additions & 4 deletions FadedVanguardLogUploader/Views/ListView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ private void OnInitialized(object? sender, System.EventArgs e)
{
if (DataContext != null && DataContext is ListViewModel model)
{
Thread thread = new Thread(() => model.Load());
thread.Start();
// TODO: Redo threading
//Thread thread = new Thread(() => model.Load());
//thread.Start();
model.Load();
}
}

private async Task DoShowDialogAsync(InteractionContext<PopupViewModel, bool> interaction)
{
Popup dialog = new();
dialog.DataContext = interaction.Input;
Popup dialog = new()
{
DataContext = interaction.Input
};
if (Application.Current == null)
return;
if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
Expand Down

0 comments on commit d746b50

Please sign in to comment.