Skip to content

Commit

Permalink
browser listing in ui
Browse files Browse the repository at this point in the history
works okay, not fancy databinding
Code cleanup
  • Loading branch information
Neurofibromin committed Jun 12, 2024
1 parent 0a21f20 commit ca28d7d
Show file tree
Hide file tree
Showing 7 changed files with 265 additions and 252 deletions.
473 changes: 245 additions & 228 deletions AutoImport.cs

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion CoreLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

//TODO: Migrate from Newtonsoft.Json to System.Text.Json


namespace bookmark_dlp
{
public class CoreLogic
Expand Down
16 changes: 3 additions & 13 deletions Methods.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
using System;
using System.IO;
using System.Linq;
using bookmark_dlp;
using Microsoft.Data.Sqlite;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using bookmark_dlp;
using System.ComponentModel;
using System.Text;
using System.Threading;
using Microsoft.Data.Sqlite;
using Avalonia.Automation.Peers;
using SkiaSharp;

internal class Methods
{
Expand Down
2 changes: 0 additions & 2 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Avalonia;
using System;
using System.Security.Cryptography.X509Certificates;



Expand Down
1 change: 0 additions & 1 deletion ViewLocator.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using bookmark_dlp.ViewModels;
using System;

namespace bookmark_dlp
{
Expand Down
20 changes: 15 additions & 5 deletions ViewModels/StartPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ namespace bookmark_dlp.ViewModels
{
public partial class StartPageViewModel : ViewModelBase
{
[ObservableProperty]
public List<string> availableBrowserBookmarkPaths; //= (List<string>)(from browser in AutoImport.FindBrowserBookmarkFilesPaths() select browser.foundFiles)



[ObservableProperty]
public string[] browserlist = { "Firefox", "Chrome", "Safari" };
[ObservableProperty]
Expand All @@ -45,16 +45,26 @@ public partial class StartPageViewModel : ViewModelBase



public StartPageViewModel() {
if (Methods.Yt_dlp_pathfinder(Directory.GetCurrentDirectory()) != null) { AppSettings._settings.Ytdlp_executable_not_found = false; }
public StartPageViewModel()
{
List<string> temp = new List<string>();
foreach (BrowserLocations browser in AutoImport.FindBrowserBookmarkFilesPaths())
{
foreach (string path in browser.foundFiles)
{
temp.Add(path);
}
}
AvailableBrowserBookmarkPaths = temp;
if (Methods.Yt_dlp_pathfinder(Directory.GetCurrentDirectory()) != null) { AppSettings._settings.Ytdlp_executable_not_found = false; }
ActiveSettings = new SettingsStruct(AppSettings._settings);
}

public void ReBindSettings()
{
ActiveSettings = new SettingsStruct(AppSettings._settings);
}

public async Task SaveActiveSettings()

Check warning on line 68 in ViewModels/StartPageViewModel.cs

View workflow job for this annotation

GitHub Actions / pupnet (ubuntu-latest, 8.0.x)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 68 in ViewModels/StartPageViewModel.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 8.0.x)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

Check warning on line 68 in ViewModels/StartPageViewModel.cs

View workflow job for this annotation

GitHub Actions / release (ubuntu-latest, 8.0.x)

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
{
AppSettings._settings = new SettingsStruct(ActiveSettings);
Expand Down
4 changes: 2 additions & 2 deletions Views/StartPageView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
Name="browsers"
Grid.Column="1"
Margin="0"
Background="Fuchsia"
ItemsSource="{Binding Browserlist}"
Background="LightGoldenrodYellow"
ItemsSource="{Binding AvailableBrowserBookmarkPaths, Mode=OneWay}"
SelectedItem="{Binding ChosenBrowser}"
SelectionMode="Single,Toggle" />
</Grid>
Expand Down

0 comments on commit ca28d7d

Please sign in to comment.