Noah
Noah
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
Writing an installer (will be built unpacked obviously) and I want it to do this
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
FilePicker doesn’t have that because filepicker can pick the protected folders, the problem comes in the next step when the application tries to write to it and can’t as it doesn’t have privileges
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
because of an arbitrary limitation that microsoft can’t be bothered fixing
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
because some people like using program files, i don’t want to just make some folders off limits
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
unless I use an elevated command line etc to move the files AFTER extraction to the temp folder
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
It needs to copy the files to the users selected folder, which could end up being a protected folder such as program files
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
For an installer
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
To write to program files
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
and neither do any of the alternatives for some reason
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
The FilePicker/FolderPicker function doesn’t work when the app is opened as admin
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
it would be nice to just launch the file picker as unelevated while the rest of the program is
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
so am I
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
I've got 2 options then: - Don't allow install to program files - Only install to program files
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
none of the fixes even work wtf is this
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
common microsoft L
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
The FolderPicker is a part of WinUI
c#
public async void PickFolderButton_Click(object sender, RoutedEventArgs e)
{
// Clear previous returned file name, if it exists, between iterations of this scenario
PickFolderOutputTextBlock.Text = "";

// Create a folder picker
FolderPicker openPicker = new Windows.Storage.Pickers.FolderPicker();

// See the sample code below for how to make the window accessible from the App class.
var window = App.CurrentWindow;

// Retrieve the window handle (HWND) of the current WinUI 3 window.
var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(window);

// Initialize the folder picker with the window handle (HWND).
WinRT.Interop.InitializeWithWindow.Initialize(openPicker, hWnd);

// Set options for your folder picker
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add("*");

// Open the picker for the user to pick a folder
StorageFolder folder = await openPicker.PickSingleFolderAsync();
if (folder != null)
{
PickFolderOutputTextBlock.Text = folder.Path + @"\suyu";
}
else
{
PickFolderOutputTextBlock.Text = "No folder selected.";
}
}
c#
public async void PickFolderButton_Click(object sender, RoutedEventArgs e)
{
// Clear previous returned file name, if it exists, between iterations of this scenario
PickFolderOutputTextBlock.Text = "";

// Create a folder picker
FolderPicker openPicker = new Windows.Storage.Pickers.FolderPicker();

// See the sample code below for how to make the window accessible from the App class.
var window = App.CurrentWindow;

// Retrieve the window handle (HWND) of the current WinUI 3 window.
var hWnd = WinRT.Interop.WindowNative.GetWindowHandle(window);

// Initialize the folder picker with the window handle (HWND).
WinRT.Interop.InitializeWithWindow.Initialize(openPicker, hWnd);

// Set options for your folder picker
openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add("*");

// Open the picker for the user to pick a folder
StorageFolder folder = await openPicker.PickSingleFolderAsync();
if (folder != null)
{
PickFolderOutputTextBlock.Text = folder.Path + @"\suyu";
}
else
{
PickFolderOutputTextBlock.Text = "No folder selected.";
}
}
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
@Stefanidze I don't like pinging because people have lives outside of helping people on Discord, but you've been so helpful and clearly know what you're talking about so hopefully this is a quick fix
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
Oops back again, if I want the installer to be able to write to program files, I need to run it as adminstrator, but this then breaks the FolderPicker on the previous page meaning it can't install anywhere
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
Thanks! :)
177 replies
CC#
Created by Noah on 3/23/2024 in #help
Downloading and extracting a .7z file from within a WinUI application
so hopefully I can take it from here 🤞
177 replies