only open dialog if there are no popups already open
This commit is contained in:
@@ -8,7 +8,6 @@ using PolyChat.Models;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System;
|
using System;
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ using System.Collections.ObjectModel;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading.Tasks;
|
using Windows.Foundation;
|
||||||
using Windows.UI.Core;
|
using Windows.UI.Core;
|
||||||
using Windows.UI.Xaml;
|
using Windows.UI.Xaml;
|
||||||
using Windows.UI.Xaml.Controls;
|
using Windows.UI.Xaml.Controls;
|
||||||
using Windows.UI.Xaml.Data;
|
using Windows.UI.Xaml.Media;
|
||||||
|
|
||||||
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ namespace PolyChat
|
|||||||
public async void OnOpenNewChatDialog(object sender = null, RoutedEventArgs e = null)
|
public async void OnOpenNewChatDialog(object sender = null, RoutedEventArgs e = null)
|
||||||
{
|
{
|
||||||
NewChatDialog dialog = new NewChatDialog();
|
NewChatDialog dialog = new NewChatDialog();
|
||||||
var result = await dialog.ShowAsync();
|
var result = await SafelyOpenDialog(dialog);
|
||||||
if (result == ContentDialogResult.Primary)
|
if (result == ContentDialogResult.Primary)
|
||||||
{
|
{
|
||||||
string ip = IP.GetIPFromCode(dialog.getValue());
|
string ip = IP.GetIPFromCode(dialog.getValue());
|
||||||
@@ -97,7 +97,7 @@ namespace PolyChat
|
|||||||
public async void OnOpenEditUsernameDialog(object sender = null, RoutedEventArgs e = null)
|
public async void OnOpenEditUsernameDialog(object sender = null, RoutedEventArgs e = null)
|
||||||
{
|
{
|
||||||
EditUsernameDialog dialog = new EditUsernameDialog(username);
|
EditUsernameDialog dialog = new EditUsernameDialog(username);
|
||||||
var result = await dialog.ShowAsync();
|
var result = await SafelyOpenDialog(dialog);
|
||||||
if (result == ContentDialogResult.Primary)
|
if (result == ContentDialogResult.Primary)
|
||||||
{
|
{
|
||||||
username = dialog.getValue();
|
username = dialog.getValue();
|
||||||
@@ -204,6 +204,27 @@ namespace PolyChat
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IAsyncOperation<ContentDialogResult> SafelyOpenDialog(Dialog d)
|
||||||
|
{
|
||||||
|
if(VisualTreeHelper.GetOpenPopups(Window.Current).Count == 0)
|
||||||
|
return d.ShowAsync();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IAsyncOperation<ContentDialogResult> SafelyOpenDialog(NewChatDialog d)
|
||||||
|
{
|
||||||
|
if (VisualTreeHelper.GetOpenPopups(Window.Current).Count == 0)
|
||||||
|
return d.ShowAsync();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IAsyncOperation<ContentDialogResult> SafelyOpenDialog(EditUsernameDialog d)
|
||||||
|
{
|
||||||
|
if (VisualTreeHelper.GetOpenPopups(Window.Current).Count == 0)
|
||||||
|
return d.ShowAsync();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// UPDATE FUNCTIONS FOR UI PLACEHOLDERS
|
// UPDATE FUNCTIONS FOR UI PLACEHOLDERS
|
||||||
|
|
||||||
private void updateNoChatsPlaceholder()
|
private void updateNoChatsPlaceholder()
|
||||||
|
|||||||
@@ -203,9 +203,6 @@
|
|||||||
<Version>5.0.2</Version>
|
<Version>5.0.2</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Include="PolyChat_TemporaryKey.pfx" />
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using PolyChat.Util;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
using Windows.Foundation;
|
using Windows.Foundation;
|
||||||
using Windows.UI.Core;
|
using Windows.UI.Core;
|
||||||
using Windows.UI.Popups;
|
using Windows.UI.Popups;
|
||||||
@@ -34,7 +35,7 @@ namespace PolyChat.Views
|
|||||||
Primary = primary.Action;
|
Primary = primary.Action;
|
||||||
Secondary = secondary.Action;
|
Secondary = secondary.Action;
|
||||||
// show
|
// show
|
||||||
ShowDialogAsync();
|
MainPage.SafelyOpenDialog(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setType(string type, string message)
|
private void setType(string type, string message)
|
||||||
|
|||||||
Reference in New Issue
Block a user