-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Adding service function RealTime Layout Service
for cultures using RTL/LTR
#16514
base: main
Are you sure you want to change the base?
Feature: Adding service function RealTime Layout Service
for cultures using RTL/LTR
#16514
Conversation
fyi @0x5bfa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Does this also work for generated content dialogs such as the add new dialog that is shown when Ctrl+Shift+I entered?
@@ -97,6 +100,9 @@ async Task ActivateAsync() | |||
var userSettingsService = Ioc.Default.GetRequiredService<IUserSettingsService>(); | |||
var isLeaveAppRunning = userSettingsService.GeneralSettingsService.LeaveAppRunning; | |||
|
|||
Ioc.Default.GetRequiredService<IRealTimeLayoutService>().UpdateCulture(new(AppLanguageHelper.PreferredLanguage.Code)); | |||
MainWindow.Instance.InitializeContentLayout(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be called from MainWindow's constructor after InitializeComponent call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For calling, the culture must be already set by realTimeLayoutService.UpdateCulture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean InitializeContentLayout shouldn't be called in MainWindow's constructor as others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I understand, the generator works with the IoC as part of the initialization to implement the service. But the MainWindow constructor is called before the IoC is implemented.
@@ -7,7 +7,7 @@ | |||
|
|||
namespace Files.App.Dialogs | |||
{ | |||
public sealed partial class AddBranchDialog : ContentDialog, IDialog<AddBranchDialogViewModel> | |||
public sealed partial class AddBranchDialog : ContentDialog, IDialog<AddBranchDialogViewModel>, IRealTimeControl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, While this looks somewhat weird just for this but I'm planning to create an all-in-one service for ContentDialog & DynamicDialog to generate every dialog we use. The dialog contents will be Page class derivatives instead of the ContentDialog class.
For example:
IAppDialogService service = new();
var res = service.Show_AddBranchDialog();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IRealTimeControl can be used for all blocks that inherit from FrameworkElement, so also for Page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍
@@ -263,63 +263,68 @@ | |||
</AnimatedIcon> | |||
</ToggleButton> | |||
|
|||
<Button | |||
x:Name="Back" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yaira2 fyi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens without this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arrows are facing each other
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it work to wrap these in a StackPanel (as you've done) and hardcode the FlowDirection of the StackPanel?
Yes it works because it automatically inherits FlowDirection |
Resolved / Related Issues
To prevent extra work, all changes to the Files codebase must link to an approved issue marked as
Ready to build
. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.Microsoft issues
Steps used to test these changes
Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.
Important
This service function is only used to display the layout correctly.
Tests for RTL