Skip to content

Commit

Permalink
win 10 fix and thunderstore changes
Browse files Browse the repository at this point in the history
  • Loading branch information
BigSpice committed Oct 24, 2023
1 parent 81fc656 commit 95b256d
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 32 deletions.
Binary file modified VTOL_2.0.0/.vs/ProjectEvaluation/vtol.metadata.v7.bin
Binary file not shown.
Binary file modified VTOL_2.0.0/.vs/ProjectEvaluation/vtol.projects.v7.bin
Binary file not shown.
Binary file modified VTOL_2.0.0/.vs/VTOL/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified VTOL_2.0.0/.vs/VTOL/v17/.futdcache.v2
Binary file not shown.
28 changes: 22 additions & 6 deletions VTOL_2.0.0/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Eventing.Reader;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -144,13 +145,28 @@ private void UserInterfaceCustomScale(double customScale)
public MainWindow()
{
InitializeComponent();

try
{
IntPtr hWnd = new WindowInteropHelper(GetWindow(this)).EnsureHandle();
var attribute = DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE;
var preference = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND;
DwmSetWindowAttribute(hWnd, attribute, ref preference, sizeof(uint));

//win 10
if (Environment.OSVersion.Platform == PlatformID.Win32NT && (Environment.OSVersion.Version.Build < 22000) ){

Main_Win_Control.AllowsTransparency = true;
Main_Win_Control.WindowStyle = WindowStyle.None;
Main_Win_Control.BorderThickness = new Thickness(0);
}
else
//win 11
{
IntPtr hWnd = new WindowInteropHelper(GetWindow(this)).EnsureHandle();
var attribute = DWMWINDOWATTRIBUTE.DWMWA_WINDOW_CORNER_PREFERENCE;
var preference = DWM_WINDOW_CORNER_PREFERENCE.DWMWCP_ROUND;
DwmSetWindowAttribute(hWnd, attribute, ref preference, sizeof(uint));
Main_Win_Control.BorderThickness = new Thickness(1);

}


NotificationManager = new NotificationManager();
minimize_to_tray = Properties.Settings.Default.Minimize_to_Tray;
Expand Down Expand Up @@ -308,7 +324,7 @@ public MainWindow()

Send_Danger_Notif("Could Not Read User Settings, Please Run as Admin or Repair/Clean your Installation", 10000);

}
}//todo update tools

Wpf.Ui.Appearance.Theme.Apply(
Wpf.Ui.Appearance.ThemeType.Unknown,
Expand Down
2 changes: 1 addition & 1 deletion VTOL_2.0.0/Pages/Page_Thunderstore.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

</Image>

<ui:VirtualizingItemsControl x:Name="Thunderstore_List" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel" ItemsSource="{Binding itemsList}" Margin="35,174,35,0" ScrollViewer.CanContentScroll="True" Foreground="White" Width="1078" Height="445" CacheLengthUnit="Pixel" UseLayoutRounding="True" ScrollViewer.VerticalScrollBarVisibility="Visible" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Top" Background="#E85A5A5A" >
<ui:VirtualizingItemsControl x:Name="Thunderstore_List" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling" VirtualizingPanel.ScrollUnit="Pixel" ItemsSource="{Binding itemsList}" Margin="35,174,35,0" ScrollViewer.CanContentScroll="True" Foreground="White" Width="1078" Height="445" CacheLengthUnit="Pixel" UseLayoutRounding="True" ScrollViewer.VerticalScrollBarVisibility="Visible" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Top" Background="#E85A5A5A" SourceUpdated="Thunderstore_List_SourceUpdated" >
<!--<ui:CardExpander
HorizontalContentAlignment="Center"
Expand Down
112 changes: 87 additions & 25 deletions VTOL_2.0.0/Pages/Page_Thunderstore.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ public partial class Page_Thunderstore : Page
public Page_Thunderstore()
{
InitializeComponent();
InfoChangeEvent += new SomeInfoChangeDelegate(OnInfoChanged);
Check_Reverse(false);
User_Settings_Vars = Main.User_Settings_Vars;
DocumentsFolder = Main.AppDataFolder;
Expand Down Expand Up @@ -1168,7 +1169,45 @@ private void Grid_MouseLeave(object sender, MouseEventArgs e)
});
}

public delegate void SomeInfoChangeDelegate(object o);
public event SomeInfoChangeDelegate InfoChangeEvent = null;
void OnInfoChanged(object o)
{
DispatchIfNecessary(async () =>
{
itemsList = Thunderstore_List.Items.Cast<Grid_>().ToList();
// Thunderstore_List.ItemsSource = List;
Loading_Ring.Visibility = Visibility.Hidden;
Thunderstore_List.Items.Refresh();
});
}


protected void SomeWorkerThread(object o)
{
//int i = 0;
//while (true)
//{
DispatchIfNecessary(async () =>
{
foreach (var TS_MOD in _updater.Thunderstore)
{
AsyncLoadListViewItem(TS_MOD, false, "#");
}
});
//Legacy Grid_ Card = LoadListViewItem(TS_MOD, Search_, SearchQuery.Replace(" ", "_"));
// if (Card != null)
// {
// Thunderstore_List.Items.Add(Card);
// // ReplaceLoadingCardWithMod(Card);

//}




// }
}
public async Task Call_Ts_Mods()
{

Expand All @@ -1181,8 +1220,8 @@ public async Task Call_Ts_Mods()
List<Grid_> List = null;
_updater = new Updater("https://northstar.thunderstore.io/api/v1/package/");

var NON_UI = new Thread(() =>
{
//var NON_UI = new Thread(() =>
//{
_updater.Download_Cutom_JSON();
if (_updater.Thunderstore != null)
{
Expand All @@ -1191,7 +1230,10 @@ public async Task Call_Ts_Mods()
DispatchIfNecessary(async () =>
{
Thunderstore_List.Items.Clear();
loadConvertItemLazy();
// loadConvertItemLazy();
Thread t = new Thread(new ParameterizedThreadStart(SomeWorkerThread));
t.Start();


}); //if (Search_ == false)
//{
Expand Down Expand Up @@ -1229,18 +1271,27 @@ public async Task Call_Ts_Mods()
}
}

});
NON_UI.IsBackground = true;
//});
//NON_UI.IsBackground = true;

NON_UI.Start();
NON_UI.Join();
DispatchIfNecessary(async () =>
{
itemsList = Thunderstore_List.Items.Cast<Grid_>().ToList();
// Thunderstore_List.ItemsSource = List;
Loading_Ring.Visibility = Visibility.Hidden;
//NON_UI.Start();
//NON_UI.Join();









//DispatchIfNecessary(async () =>
//{
// itemsList = Thunderstore_List.Items.Cast<Grid_>().ToList();
// // Thunderstore_List.ItemsSource = List;
// Loading_Ring.Visibility = Visibility.Hidden;

});
//});



Expand Down Expand Up @@ -1419,7 +1470,7 @@ private void padd_Click(object sender, RoutedEventArgs e)

if (Sort.SelectedItem != null)
{
Thunderstore_List.ItemsSource = null;
// Thunderstore_List.ItemsSource = null;

BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
Expand Down Expand Up @@ -1447,7 +1498,7 @@ private void padd_Click(object sender, RoutedEventArgs e)
worker.RunWorkerCompleted += (sender, eventArgs) =>
{

Thunderstore_List.Refresh();
// Thunderstore_List.Items.Refresh();


};
Expand Down Expand Up @@ -1843,17 +1894,20 @@ public void orderlistitems()


}

foreach (var TS_MOD in List)
DispatchIfNecessary(async () =>
{

if (TS_MOD != null)
foreach (var TS_MOD in List)
{
Thunderstore_List.Items.Add(TS_MOD);

}
if (TS_MOD != null)
{
Thunderstore_List.Items.Add(TS_MOD);
InfoChangeEvent(TS_MOD);
}

}
}
});
}


Expand Down Expand Up @@ -2011,6 +2065,7 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false

Thunderstore_List.Items.Add(Card);

InfoChangeEvent(Card);

}
});
Expand Down Expand Up @@ -2086,6 +2141,7 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false
Button_Color = bg_color,
is_Favourite_ = is_favourite });
Thunderstore_List.Items.Add(Card);
InfoChangeEvent(Card);

}
});
Expand Down Expand Up @@ -2199,6 +2255,7 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false
Button_Color = bg_color,
is_Favourite_ = is_favourite });
Thunderstore_List.Items.Add(Card);
InfoChangeEvent(Card);

}
});
Expand All @@ -2219,7 +2276,6 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false


downloads = (Downloads.Sum()).ToString();
Console.WriteLine("ver- "+Split_Name[0] +"|"+ Split_Name[1] + " [fullname] " + versions.First().FullName);

for (var x = 0; x < versions.First().Dependencies.Count; x++)
{
Expand Down Expand Up @@ -2308,6 +2364,7 @@ private void AsyncLoadListViewItem(Thunderstore_V1 updater, bool Search_ = false
Button_Color = bg_color,
is_Favourite_ = is_favourite });
Thunderstore_List.Items.Add(Card);
InfoChangeEvent(Card);

}
});
Expand Down Expand Up @@ -2387,8 +2444,9 @@ private void loadConvertItemLazy(bool Search_ = false, string SearchQuery = "#")
//}
foreach (var TS_MOD in _updater.Thunderstore)
{
AsyncLoadListViewItem(TS_MOD, Search_, SearchQuery.Replace(" ", "_"));

//Legacy Grid_ Card = LoadListViewItem(TS_MOD, Search_, SearchQuery.Replace(" ", "_"));
AsyncLoadListViewItem(TS_MOD, Search_, SearchQuery.Replace(" ", "_"));
// if (Card != null)
// {
// Thunderstore_List.Items.Add(Card);
Expand Down Expand Up @@ -4584,7 +4642,7 @@ private void Sort_SelectionChanged(object sender, SelectionChangedEventArgs e)
worker.RunWorkerCompleted += (sender, eventArgs) =>
{

Thunderstore_List.Refresh();
Thunderstore_List.Items.Refresh();


};
Expand Down Expand Up @@ -4641,7 +4699,7 @@ private void Grid_Loaded(object sender, RoutedEventArgs e)
worker.RunWorkerCompleted += (sender, eventArgs) =>
{

Thunderstore_List.Refresh();
// Thunderstore_List.Items.Refresh();


};
Expand Down Expand Up @@ -4971,6 +5029,10 @@ private void Search_Bar_Suggest_Mods_TextInput(object sender, TextCompositionEve
{

}

private void Thunderstore_List_SourceUpdated(object sender, DataTransferEventArgs e)
{
}
}

}

0 comments on commit 95b256d

Please sign in to comment.