Exemplo n.º 1
0
 public AlarmCountDown(string sender)
 {
     InitializeComponent();
     Current          = this;
     device           = sender;
     activatedBy.Text = "El sensor de la habitación \"" + device + "\" ha detectado una intrusión. La alarma se activará en 10 segundos.";
 }
Exemplo n.º 2
0
        public static async void OpenDialog(string sender, string type)
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,
                                                                                                        async() =>
            {
                var dialogs     = VisualTreeHelper.GetOpenPopups(Window.Current);
                int encountered = 0;
                foreach (var dialog in dialogs)
                {
                    if (dialog.Child is AlarmCountDown || dialog.Child is AlarmTriggered)
                    {
                        encountered++;
                    }
                }

                if (encountered == 0)
                {
                    ContentDialog contentDialog = null;
                    switch (type)
                    {
                    case "countdown":
                        Devices.AlarmTriggered = true;
                        contentDialog          = new AlarmCountDown(sender);
                        break;

                    case "alarm":
                        Devices.IsAlarmRinging = true;
                        contentDialog          = new AlarmTriggered(sender);
                        break;
                    }

                    if (Devices.AlarmCountDownFirstTime == true)
                    {
                        Devices.AlarmCountDownFirstTime = false;
                    }
                    await contentDialog.ShowAsync();
                }
            });
        }