Skip to content

Commit

Permalink
Fixed janky mod loading on main mod [ages
Browse files Browse the repository at this point in the history
  • Loading branch information
BigSpice committed Jan 26, 2024
1 parent 1e900d2 commit 7e9f7c1
Show file tree
Hide file tree
Showing 17 changed files with 265 additions and 283 deletions.
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 not shown.
11 changes: 2 additions & 9 deletions VTOL_2.0.0/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,7 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<hc:Badge x:Name="VTOL_UPDATE_BADGE" Margin="0,460,0,204" BadgeMargin="32,4,10,0" Status="Processing" ToolTip="Update For VTOL Available" BorderBrush="#FF00FF84" HorizontalAlignment="Right" Width="52" Visibility="Hidden">
<hc:Badge.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF00FF9C" Offset="0.005"/>
<GradientStop Color="#FF00A455" Offset="1"/>
</LinearGradientBrush>
</hc:Badge.Background>
</hc:Badge>
<hc:Badge x:Name="VTOL_UPDATE_BADGE" Margin="0,399,0,265" BadgeMargin="32,4,10,0" Status="Processing" ToolTip="Update For VTOL Available" BorderBrush="#FF5EFFC6" HorizontalAlignment="Center" Width="52" Visibility="Hidden" Background="#FF5EFFC6" Foreground="#FFFDFDFD"/>
<ui:NotifyIcon
Icon="/Resources/Icons/Main_UI/VTOL_multires.ico"
MenuOnRightClick="True"
Expand Down Expand Up @@ -200,7 +193,7 @@
x:Name="mask"
CornerRadius="8" Background="#FF0E0E0E"
/>

<Frame x:Name="RootFrame" GotFocus="RootFrame_GotFocus">
<Frame.OpacityMask>
<VisualBrush Visual="{Binding ElementName=mask}"/>
Expand Down
2 changes: 1 addition & 1 deletion VTOL_2.0.0/Pages/Page_Mods.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
xmlns:parallax="clr-namespace:Parallax.WPF"
xmlns:I="http://schemas.microsoft.com/xaml/behaviors"
d:DesignHeight="670" d:DesignWidth="1148"
Title="Page_Mods" KeepAlive="True" Unloaded="Page_Unloaded">
Title="Page_Mods" KeepAlive="True" Unloaded="Page_Unloaded" Initialized="Page_Initialized" Loaded="Page_Loaded">
<Page.Resources>
<Style TargetType="Image">

Expand Down
99 changes: 50 additions & 49 deletions VTOL_2.0.0/Pages/Page_Mods.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,8 @@ public Page_Mods()
InitializeComponent();
User_Settings_Vars = Main.User_Settings_Vars;
Snackbar = Main.Snackbar;

BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
{
// Call_Mods_From_Folder();
Check_Reverse(false);
};

worker.RunWorkerAsync();





Expand Down Expand Up @@ -576,10 +566,7 @@ public async Task Call_Mods_From_Folder()
}
catch (Exception ex)
{
Console.WriteLine(ex);

Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}");


}
}
Main.loaded_mods = true;
Expand All @@ -604,7 +591,6 @@ public async Task Call_Mods_From_Folder()
}
catch (Exception ex)
{
Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}");
}


Expand Down Expand Up @@ -932,29 +918,26 @@ private void ApplyDataBinding()
try
{
Mod_List_Box.ItemsSource = null;
_Completed_Mod_call = true;
var sorted = Keep_List_State(false, Reverse_);
Mod_List_Box.ItemsSource = sorted;
_Completed_Mod_call = true;

if (Search_Bar_Suggest_Mods.Text.Trim() != "" && Search_Bar_Suggest_Mods.Text.Trim() != "~Search")
{
var sorted = Keep_List_State(true, Reverse_);
Mod_List_Box.ItemsSource = sorted;
_Completed_Mod_call = true;
sorted = Keep_List_State(true, Reverse_);

}
else
{
Mod_List_Box.Refresh();


var sorted = Keep_List_State(false, Reverse_);
Mod_List_Box.ItemsSource = sorted;

_Completed_Mod_call = true;


}

Mod_List_Box.Refresh();
}
catch (Exception ex)
{
Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}");

}
}
Expand Down Expand Up @@ -2108,23 +2091,18 @@ protected virtual void Delete_Action(object sender, RoutedEventArgs e)
}

string delete_mod_path = Dialog.Tag.ToString();
if (!Directory.Exists(temp_Dir))
if (Directory.Exists(temp_Dir))
{
Dialog.Hide();

//Send_Success_Notif("Successfully Deleted - " + Mod);
Call_Mods_From_Folder();
}
else
{
TryDeleteDirectory(temp_Dir, true);

Dialog.Hide();
}

//Send_Error_Notif("Could not Delete! - " + Mod);
Call_Mods_From_Folder();

}
Dialog.Hide();

Call_Mods_From_Folder();

temp_Dir = null;
}
catch (Exception ex)
Expand Down Expand Up @@ -2266,16 +2244,7 @@ private void CardControl_MouseMove(object sender, MouseEventArgs e)

private void Mod_Grid_Loaded(object sender, RoutedEventArgs e)
{
try
{
Call_Mods_From_Folder();
}
catch (Exception ex)
{

Log.Error(ex, $"A crash happened at {DateTime.Now.ToString("yyyy - MM - dd HH - mm - ss.ff", CultureInfo.InvariantCulture)}{Environment.NewLine}");

}

}

private void Mod_Grid_Unloaded(object sender, RoutedEventArgs e)
Expand Down Expand Up @@ -2749,5 +2718,37 @@ private void INFO_VERSION_MOD_SET_LayoutUpdated(object sender, EventArgs e)
{

}

private void Page_Initialized(object sender, EventArgs e)
{

}

private void Page_Loaded(object sender, RoutedEventArgs e)
{
try
{
BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += (sender, e) =>
{
Call_Mods_From_Folder();
Check_Reverse(false);
GC.Collect();
};

worker.RunWorkerAsync();

}
catch (Exception ex)
{

}
}
}
}
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 @@ -10,7 +10,7 @@
xmlns:cntrls="clr-namespace:VTOL"

d:DesignHeight="670" d:DesignWidth="1148"
Title="Page_Thunderstore" UseLayoutRounding="True" Loaded="Page_Loaded_1" Unloaded="Page_Unloaded">
Title="Page_Thunderstore" UseLayoutRounding="True" Loaded="Page_Loaded_1" Unloaded="Page_Unloaded" >
<Page.Resources>
<local:NegatingConverter x:Key="NegatingConverter" />
<Storyboard x:Key="slide">
Expand Down
Loading

0 comments on commit 7e9f7c1

Please sign in to comment.