mirror of
https://github.com/ReneLergner/WPinternals.git
synced 2026-06-14 03:16:40 +10:00
Add the ability to add Secure WIMs to the store
This commit is contained in:
@@ -41,7 +41,6 @@ namespace WPinternals
|
||||
internal class DownloadsViewModel : ContextViewModel
|
||||
{
|
||||
private readonly PhoneNotifierViewModel Notifier;
|
||||
private readonly Timer SpeedTimer;
|
||||
private bool IsSearching = false;
|
||||
|
||||
internal DownloadsViewModel(PhoneNotifierViewModel Notifier)
|
||||
@@ -56,8 +55,6 @@ namespace WPinternals
|
||||
DownloadFolder = (string)Key.GetValue("DownloadFolder", @"C:\ProgramData\WPinternals\Repository");
|
||||
Key.Close();
|
||||
|
||||
SpeedTimer = new Timer(TimerCallback, this, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1));
|
||||
|
||||
AddFFUCommand = new DelegateCommand(() =>
|
||||
{
|
||||
string FFUPath = null;
|
||||
@@ -77,20 +74,20 @@ namespace WPinternals
|
||||
{
|
||||
App.Config.AddFfuToRepository(FFUPath);
|
||||
App.Config.WriteConfig();
|
||||
LastStatusText = $"File \"{FFUFile}\" was added to the repository.";
|
||||
LastFFUStatusText = $"File \"{FFUFile}\" was added to the repository.";
|
||||
}
|
||||
catch (WPinternalsException Ex)
|
||||
{
|
||||
LastStatusText = $"Error: {Ex.Message}. File \"{FFUFile}\" was not added.";
|
||||
LastFFUStatusText = $"Error: {Ex.Message}. File \"{FFUFile}\" was not added.";
|
||||
}
|
||||
catch
|
||||
{
|
||||
LastStatusText = $"Error: File \"{FFUFile}\" was not added.";
|
||||
LastFFUStatusText = $"Error: File \"{FFUFile}\" was not added.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LastStatusText = null;
|
||||
LastFFUStatusText = null;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -113,35 +110,49 @@ namespace WPinternals
|
||||
{
|
||||
App.Config.AddSecWimToRepository(SecWIMPath, FirmwareVersion);
|
||||
App.Config.WriteConfig();
|
||||
LastStatusText = $"File \"{SecWIMFile}\" was added to the repository.";
|
||||
LastSecWIMStatusText = $"File \"{SecWIMFile}\" was added to the repository.";
|
||||
}
|
||||
catch (WPinternalsException Ex)
|
||||
{
|
||||
LastStatusText = $"Error: {Ex.Message}. File \"{SecWIMFile}\" was not added.";
|
||||
LastSecWIMStatusText = $"Error: {Ex.Message}. File \"{SecWIMFile}\" was not added.";
|
||||
}
|
||||
catch
|
||||
{
|
||||
LastStatusText = $"Error: File \"{SecWIMFile}\" was not added.";
|
||||
LastSecWIMStatusText = $"Error: File \"{SecWIMFile}\" was not added.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LastStatusText = null;
|
||||
LastSecWIMStatusText = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private string _LastStatusText = null;
|
||||
public string LastStatusText
|
||||
private string _LastFFUStatusText = null;
|
||||
public string LastFFUStatusText
|
||||
{
|
||||
get
|
||||
{
|
||||
return _LastStatusText;
|
||||
return _LastFFUStatusText;
|
||||
}
|
||||
set
|
||||
{
|
||||
_LastStatusText = value;
|
||||
OnPropertyChanged(nameof(LastStatusText));
|
||||
_LastFFUStatusText = value;
|
||||
OnPropertyChanged(nameof(LastFFUStatusText));
|
||||
}
|
||||
}
|
||||
|
||||
private string _LastSecWIMStatusText = null;
|
||||
public string LastSecWIMStatusText
|
||||
{
|
||||
get
|
||||
{
|
||||
return _LastSecWIMStatusText;
|
||||
}
|
||||
set
|
||||
{
|
||||
_LastSecWIMStatusText = value;
|
||||
OnPropertyChanged(nameof(LastSecWIMStatusText));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
</helpers:Paragraph>
|
||||
</FlowDocument>
|
||||
</helpers:FlowDocumentScrollViewerNoMouseWheel>
|
||||
<helpers:FlowDocumentScrollViewerNoMouseWheel Grid.Column="1" Margin="20,-15,20,0" VerticalScrollBarVisibility="Auto" Visibility="{Binding Path=LastStatusText, Converter={StaticResource ObjectToVisibilityConverter}}">
|
||||
<helpers:FlowDocumentScrollViewerNoMouseWheel Grid.Column="1" Margin="20,-15,20,0" VerticalScrollBarVisibility="Auto" Visibility="{Binding Path=LastFFUStatusText, Converter={StaticResource ObjectToVisibilityConverter}}">
|
||||
<FlowDocument FontFamily="Segoe UI" FontSize="12" Loaded="Document_Loaded" TextAlignment="Left">
|
||||
<FlowDocument.Resources>
|
||||
<!-- This style is used to set the margins for all paragraphs in the FlowDocument to 0. -->
|
||||
@@ -233,11 +233,28 @@ DEALINGS IN THE SOFTWARE.
|
||||
</Style>
|
||||
</FlowDocument.Resources>
|
||||
<helpers:Paragraph>
|
||||
<Run Text="{Binding Path=LastStatusText}" />
|
||||
<Run Text="{Binding Path=LastFFUStatusText}" />
|
||||
</helpers:Paragraph>
|
||||
</FlowDocument>
|
||||
</helpers:FlowDocumentScrollViewerNoMouseWheel>
|
||||
<Button Height="30" Width="Auto" Content="Add existing FFU-file..." Padding="20,5,20,5" HorizontalAlignment="Right" Margin="0,0,36,20" Command="{Binding Path=AddFFUCommand}"/>
|
||||
<helpers:FlowDocumentScrollViewerNoMouseWheel Grid.Column="1" Margin="20,-15,20,0" VerticalScrollBarVisibility="Auto" Visibility="{Binding Path=LastSecWIMStatusText, Converter={StaticResource ObjectToVisibilityConverter}}">
|
||||
<FlowDocument FontFamily="Segoe UI" FontSize="12" Loaded="Document_Loaded" TextAlignment="Left">
|
||||
<FlowDocument.Resources>
|
||||
<!-- This style is used to set the margins for all paragraphs in the FlowDocument to 0. -->
|
||||
<Style TargetType="{x:Type Paragraph}">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type Section}">
|
||||
<Setter Property="Margin" Value="0"/>
|
||||
</Style>
|
||||
</FlowDocument.Resources>
|
||||
<helpers:Paragraph>
|
||||
<Run Text="{Binding Path=LastSecWIMStatusText}" />
|
||||
</helpers:Paragraph>
|
||||
</FlowDocument>
|
||||
</helpers:FlowDocumentScrollViewerNoMouseWheel>
|
||||
<Button Height="30" Width="Auto" Content="Add existing Secure WIM-file..." Padding="20,5,20,5" HorizontalAlignment="Right" Margin="0,0,36,20" Command="{Binding Path=AddSecWIMCommand}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
Reference in New Issue
Block a user