2021-06-29 13:06:12 +03:00
|
|
|
|
// Copyright (c) Microsoft Corporation
|
|
|
|
|
|
// The Microsoft Corporation licenses this file to you under the MIT license.
|
|
|
|
|
|
// See the LICENSE file in the project root for more information.
|
|
|
|
|
|
|
2021-07-23 16:59:22 +03:00
|
|
|
|
using System;
|
2023-03-21 22:59:45 +00:00
|
|
|
|
using System.Runtime.InteropServices;
|
2021-07-23 16:59:22 +03:00
|
|
|
|
using System.Threading.Tasks;
|
2023-01-31 00:00:11 +01:00
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Helpers;
|
2021-06-29 13:06:12 +03:00
|
|
|
|
using Microsoft.PowerToys.Settings.UI.Library;
|
|
|
|
|
|
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
2022-04-19 22:00:28 +02:00
|
|
|
|
using Microsoft.UI.Xaml.Controls;
|
2021-06-29 13:06:12 +03:00
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.PowerToys.Settings.UI.Views
|
|
|
|
|
|
{
|
2023-01-31 00:00:11 +01:00
|
|
|
|
public sealed partial class VideoConferencePage : Page, IRefreshablePage
|
2021-06-29 13:06:12 +03:00
|
|
|
|
{
|
|
|
|
|
|
private VideoConferenceViewModel ViewModel { get; set; }
|
|
|
|
|
|
|
2023-03-21 22:59:45 +00:00
|
|
|
|
private static string PickFileDialog()
|
2021-07-23 16:59:22 +03:00
|
|
|
|
{
|
2023-03-21 22:59:45 +00:00
|
|
|
|
// this code was changed to solve the problem with WinUI3 that prevents to select a file
|
|
|
|
|
|
// while running elevated, when the issue is solved in WinUI3 it should be changed back
|
|
|
|
|
|
OpenFileName openFileName = new OpenFileName();
|
|
|
|
|
|
openFileName.StructSize = Marshal.SizeOf(openFileName);
|
|
|
|
|
|
openFileName.Filter = "Images(*.jpg,*.jpeg,*.png)\0*.jpg;*.jpeg;*.png\0";
|
|
|
|
|
|
|
|
|
|
|
|
// make buffer 65k bytes big as the MAX_PATH can be ~32k chars if long path is enable
|
|
|
|
|
|
// and unicode uses 2 bytes per character
|
|
|
|
|
|
openFileName.File = new string(new char[65000]);
|
|
|
|
|
|
openFileName.MaxFile = openFileName.File.Length;
|
|
|
|
|
|
openFileName.FileTitle = new string(new char[65000]);
|
|
|
|
|
|
openFileName.MaxFileTitle = openFileName.FileTitle.Length;
|
|
|
|
|
|
openFileName.InitialDir = null;
|
|
|
|
|
|
openFileName.Title = string.Empty;
|
|
|
|
|
|
openFileName.DefExt = null;
|
|
|
|
|
|
|
|
|
|
|
|
bool result = NativeMethods.GetOpenFileName(openFileName);
|
|
|
|
|
|
if (result)
|
|
|
|
|
|
{
|
|
|
|
|
|
return openFileName.File;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
2021-07-23 16:59:22 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
2021-06-29 13:06:12 +03:00
|
|
|
|
public VideoConferencePage()
|
|
|
|
|
|
{
|
|
|
|
|
|
var settingsUtils = new SettingsUtils();
|
2022-10-13 09:46:30 +02:00
|
|
|
|
ViewModel = new VideoConferenceViewModel(
|
|
|
|
|
|
settingsUtils,
|
|
|
|
|
|
SettingsRepository<GeneralSettings>.GetInstance(settingsUtils),
|
|
|
|
|
|
SettingsRepository<VideoConferenceSettings>.GetInstance(settingsUtils),
|
|
|
|
|
|
ShellPage.SendDefaultIPCMessage,
|
|
|
|
|
|
PickFileDialog);
|
2021-06-29 13:06:12 +03:00
|
|
|
|
DataContext = ViewModel;
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
2023-01-31 00:00:11 +01:00
|
|
|
|
|
|
|
|
|
|
public void RefreshEnabledState()
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewModel.RefreshEnabledState();
|
|
|
|
|
|
}
|
2021-06-29 13:06:12 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|