Skip to content

Commit a7dc0e2

Browse files
committed
Refactoring
1 parent 4dba252 commit a7dc0e2

File tree

3 files changed

+29
-60
lines changed

3 files changed

+29
-60
lines changed

Telegram/Common/MessageDialogExtensions.cs

Lines changed: 0 additions & 59 deletions
This file was deleted.

Telegram/Controls/ContentPopup.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,5 +781,34 @@ private static void OnBlockedClosing(ContentDialog sender, ContentDialogClosingE
781781
{
782782
args.Cancel = sender.Tag != null;
783783
}
784+
785+
[ThreadStatic]
786+
private static TaskCompletionSource<ContentDialog> _currentDialogShowRequest;
787+
788+
public async Task<ContentDialogResult> ShowQueuedAsync(XamlRoot xamlRoot)
789+
{
790+
while (_currentDialogShowRequest != null)
791+
{
792+
await _currentDialogShowRequest.Task;
793+
}
794+
795+
var dialog = this;
796+
Logger.Info(dialog.GetType().Name);
797+
798+
if (dialog is ContentPopup popup)
799+
{
800+
popup.OnCreate();
801+
}
802+
803+
dialog.XamlRoot = xamlRoot;
804+
805+
var request = _currentDialogShowRequest = new TaskCompletionSource<ContentDialog>();
806+
var result = await dialog.ShowAsync();
807+
_currentDialogShowRequest = null;
808+
request.SetResult(dialog);
809+
810+
Logger.Info(dialog.GetType().Name + ", closed");
811+
return result;
812+
}
784813
}
785814
}

Telegram/Telegram.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,6 @@
765765
<Compile Include="Common\ThemeColorizer.cs" />
766766
<Compile Include="Common\InactivityHelper.cs" />
767767
<Compile Include="Common\Locale.cs" />
768-
<Compile Include="Common\MessageDialogExtensions.cs" />
769768
<Compile Include="Common\PhoneNumber.cs" />
770769
<Compile Include="Common\PlaceholderHelper.cs" />
771770
<Compile Include="Td\Api\TdExtensions.cs" />

0 commit comments

Comments
 (0)