Ejemplo n.º 1
0
        public MainViewModel()
        {
            DialogStack = new List <BaseDialog>();

            ErrorDialog = new MessageDialog()
            {
                Title           = "ERROR",
                MessageSeverity = MessageSeverity.Error
            };

            ShowDialogCommand = new RelayCommand(() =>
            {
                ShowDialog();

                IsFlyoutOpen = false;
            });

            CloseCurrentDialogCommand = new RelayCommand(() =>
            {
                if (DialogStack.Count > 0)
                {
                    var lastIndex  = DialogStack.Count - 1;
                    var lastDialog = DialogStack[lastIndex];

                    DialogStack.RemoveAt(lastIndex);
                    DialogManager.CloseDialogAsync(lastDialog);
                }
            });

            OpenLinkCommand = new RelayCommand <Uri>((uri) =>
            {
                Process.Start(new ProcessStartInfo(uri.AbsoluteUri));
            });

            ShowFlyoutCommand = new RelayCommand(() =>
            {
                IsFlyoutOpen = true;
            });
        }