예제 #1
0
        public override bool CanCloseWindowConfirmation()
        {
            bool canclose = false;

            ShowDialogMessage sdm = new ShowDialogMessage();

            sdm.Title   = "Kilépés a Rendszerből";
            sdm.Text    = "Amennyiben kilép a rendszerből a jelenlegi teszt végrehajtás megszakad.\nBiztosan kilép?";
            sdm.Buttons = new DialogButton[] {
                new DialogButton {
                    Title = "Kilépek", IsDefault = false, ReturnValue = true
                },
                new DialogButton {
                    Title = "Maradok", IsDefault = true, ReturnValue = false
                },
            };
            sdm.ExecuteIfTrue = () => {
                try {
                    _DataService.CancelTest((int)App.Current.Properties["CurrentTestID"], _DataService.LoggedInUser.PersonID);
                }
                catch (SessionExpiredException) {
                    // hm... what to do?
                }
                _DataService.ClearSession();
                canclose = true;
            };
            sdm.ExecuteIfFalse = () => {
                canclose = false;
            };

            MessengerInstance.Send <ShowDialogMessage>(sdm);

            return(canclose);
        }
예제 #2
0
        public static void HandleMessage(ShowDialogMessage message)
        {
            if (message == null)
            {
                return;
            }

            if (!dialogMapping.ContainsKey(message.DialogType))
            {
                Trace.TraceError(String.Format("Dialog type {0} is not registed.", message.DialogType));
                return;
            }

            var window = Activator.CreateInstance(dialogMapping[message.DialogType]) as Window;

            window.Owner = Window.GetWindow(message.Source as DependencyObject ?? Application.Current.MainWindow);
            if (message.Data != null)
            {
                window.DataContext = message.Data;
            }
            if (message.ModuleDialog)
            {
                message.HandlingResult = window.ShowDialog();
            }
            else
            {
                window.Show();
            }
        }
예제 #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Messenger.Default.Register <DisplayToolbarMessage>(this, (action) => HandleToolbarMessage(action));
            Messenger.Default.Register <ShowWindowMessage>(this, HandleShowWindowMessage);
            Messenger.Default.Register <ShowDialogMessage>(this, "MainWindow", HandleShowDialogMessage);
            Messenger.Default.Register <SelectTabMessage>(this, HandleSelectTabMessage);
            Messenger.Default.Register <AppExitMessage>(this, HandleAppExitMessage);
            Messenger.Default.Register <CloseTabMessage>(this, HandleCloseTabMessage);
            Messenger.Default.Register <ShowFileDialogMessage>(this, HandleShowFileDialogMessage);

            if ((this.DataContext as MainViewModel).StoreSources.Count == 0)
            {
                var msg = new ShowDialogMessage(
                    Strings.NoConnectionsTitle,
                    Strings.NoConnectionsMessage,
                    MessageBoxImage.Information,
                    MessageBoxButton.YesNo,
                    (result) =>
                {
                    if (result == MessageBoxResult.Yes)
                    {
                        var showWindowMessage = new ShowWindowMessage {
                            Name = "NewConnection"
                        };
                        Messenger.Default.Send(showWindowMessage);
                    }
                });
                Messenger.Default.Send(msg, "MainWindow");
            }
        }
예제 #4
0
        private async void ShowDialog(ShowDialogMessage m)
        {
            var d = new MessageDialog(MessageText, TitleText);

            if (m.Yes != null)
            {
                d.Commands.Add(new UICommand(YesText, command => m.Yes.Execute(null)));
            }

            if (m.No != null)
            {
                d.Commands.Add(new UICommand(NoText, command => m.No.Execute(null)));
            }

            if (m.Cancel != null)
            {
                d.Commands.Add(new UICommand(CancelText, command => m.Cancel.Execute(null)));
            }

            if (m.Cancel != null)
            {
                d.CancelCommandIndex = (uint)d.Commands.Count - 1;
            }

            await d.ShowAsync();
        }
예제 #5
0
        public virtual bool CanCloseWindowConfirmation()
        {
            bool canclose = false;

            ShowDialogMessage sdm = new ShowDialogMessage();

            sdm.Title = "Kilépés a Rendszerből";
            sdm.Text  = "Biztosan kilép?";

            sdm.Buttons = new DialogButton[] {
                new DialogButton {
                    Title = "Kilépek", IsDefault = false, ReturnValue = true
                },
                new DialogButton {
                    Title = "Maradok", IsDefault = true, ReturnValue = false
                },
            };
            sdm.ExecuteIfTrue = () => {
                _DataService.ClearSession();

                canclose = true;
            };
            sdm.ExecuteIfFalse = () => {
                canclose = false;
            };

            MessengerInstance.Send <ShowDialogMessage>(sdm);

            return(canclose);
        }
예제 #6
0
        private void HandleShowDialogMessage(ShowDialogMessage msg)
        {
            var result = MessageBox.Show(this, msg.Content, msg.Title, msg.Button, msg.Icon);

            if (msg.Callback != null)
            {
                msg.Callback(result);
            }
        }
예제 #7
0
        private void OnLibraryUpdateRequest(LibraryUpdateRequest message)
        {
            var progressBarViewModel    = new ProgressBarViewModel(_messenger, "Populating Library", false);
            var startProgressBarMessage = new ShowDialogMessage(progressBarViewModel);

            OnPopulateLibraryAsync(progressBarViewModel);

            _messenger.Send(startProgressBarMessage);
        }
예제 #8
0
        public override void OnShow(Track track)
        {
            var progressBarViewModel    = new ProgressBarViewModel(_messenger, "Populating Archive", true);
            var startProgressBarMessage = new ShowDialogMessage(progressBarViewModel);

            GetTracks(progressBarViewModel);

            _messenger.Send(startProgressBarMessage);
        }
        //private void backgroundTask()
        //{
        //    if (client == null) return;

        //    Task.Run(async () =>
        //    {
        //        while (true)
        //        {
        //            // long length = client.ReadStream.Length;
        //            byte[] buffer = new byte[1];
        //            await client.ReadStream.ReadAsync(buffer, 0, 1);
        //            this.SocketData = buffer.Length;
        //        }
        //    });
        //}

        private void PrintCommandExecute()
        {
            ShowDialogMessage msg = new ShowDialogMessage();

            msg.Title   = "PDF Ok!";
            msg.Message = "Report generato!";
            Messenger.Default.Send(msg);

            // this.MessengerInstance.Send(msg);
        }
예제 #10
0
    private void ShowDialog(ShowDialogMessage param) {
      DialogWindow dw = new DialogWindow(param);
      Nullable<bool> dw_return = dw.ShowDialog();

      if (dw_return != null)
        if((bool)dw_return) 
          param.ExecuteIfTrue();
        else
          param.ExecuteIfFalse();
    }
예제 #11
0
        private void DeleteArtist(OldSchoolArtist artist)
        {
            var dialogMessage = new ShowDialogMessage();

            dialogMessage.Yes = this.ExecuteDelteCommand;
            dialogMessage.No  = this.CancelCommand;


            Messenger.Default.Send <ShowDialogMessage>(dialogMessage, MessagingIdentifiers.DELETE_CONFIRM_MESSAGE);
        }
예제 #12
0
        public DialogWindow(ShowDialogMessage contents)
        {
            InitializeComponent();

            _MsgContents = contents;

            this.Title           = contents.Title;
            this.txtMessage.Text = contents.Text;

            this.cmdDefault.Content   = contents.Buttons.First(b => b.IsDefault).Title;
            this.cmdDefault.IsDefault = contents.Buttons.First(b => b.IsDefault).IsDefault;
            this.cmdCancel.Content    = contents.Buttons.First(b => !b.IsDefault).Title;
            this.cmdCancel.IsCancel   = contents.Buttons.First(b => !b.IsDefault).IsDefault;
        }
예제 #13
0
 private void ShowDialog(ShowDialogMessage message)
 {
     _synchronizationContext.Send(state =>
     {
         Dialog dialog;
         if (!_dialogs.TryGetValue(message.ViewModel.Guid, out dialog))
         {
             dialog = new Dialog
             {
                 DataContext = message.ViewModel
             };
             _dialogs.Add(message.ViewModel.Guid, dialog);
             dialog.ShowDialog();
         }
     }
                                  , null);
 }
예제 #14
0
        private void OnShowDialog(ShowDialogMessage msg)
        {
            if (msg == null)
            {
                return;
            }

            if (!Container.Children.OfType <ContentControl>().Any(x => x.Content == msg.Content))
            {
                _contentList.Add(msg.Content);
                Container.Children.Add(
                    new ContentControl
                {
                    Content = msg.Content
                });
            }
        }
예제 #15
0
        protected override void LoginCommandExecute()
        {
            var plainPassword = this.convertToUNSecureString(this.Password);
            this.LoginOK = (this.Username == "user" && plainPassword == "pwd");

            var msg = new ShowDialogMessage();

            if (this.LoginOK == true)
            {
                msg.Title = Vocabulary.LoginSuccessfulTitle;
                msg.Content = Vocabulary.LoginSuccessfulText;
                msg.Icon = "Information";
            }
            else
            {
                msg.Title = Vocabulary.LoginFailedTitle;
                msg.Content = Vocabulary.LoginFailedText;
            }

            Messenger.Default.Send<ShowDialogMessage>(msg);
        }
        public TaxiDetailViewModel()
        {
            this.CurrentUser = ApplicationContext.Instance.CurrentUser;

            this.GetPositionCommand = new RelayCommand(GetPositionCommandExecute, GetPositionCommandCanExecute);
            this.CancelGpsCommand   = new RelayCommand(() =>
            {
                tokenSource.Cancel();
            }, () => { return(this.IsBusy); });

            this.PrintCommand    = new RelayCommand(PrintCommandExecute);
            this.DownloadCommand = new RelayCommand(() =>
            {
                ShowDialogMessage msg = new ShowDialogMessage();
                msg.Title             = "Download in corso...";
                msg.Message           = "...prego attendere...";
                Messenger.Default.Send(msg);
            });
            this.ConnectCommand = new RelayCommand(ConnectCommandExecute);
            this.SendCommand    = new RelayCommand(SendCommandExecute);
        }
예제 #17
0
        private void showAutista()
        {
            if (this.SelectedTaxi == null)
            {
                return;
            }

            var msg = new QuestionMessage();

            msg.Title   = "Info taxi";
            msg.Message = $"Vuoi vedere il dettaglio di {this.SelectedTaxi.Autista} ?";
            msg.No      = () => { Messenger.Default.Send(ShowDialogMessage.OperationCanceled()); };
            msg.Yes     = () =>
            {
                Messenger.Default.Send(new OpenViewMessage()
                {
                    NewPage   = "TaxiDetailPage",
                    Parameter = this.SelectedTaxi
                });
            };

            Messenger.Default.Send(msg);
        }
예제 #18
0
        public async Task <bool> Login()
        {
            // This sample uses the Facebook provider.
            var provider = "MicrosoftAccount";

            // Use the PasswordVault to securely store and access credentials.
            PasswordVault      vault      = new PasswordVault();
            PasswordCredential credential = null;

            var dialogMessage = new ShowDialogMessage()
            {
            };


            while (credential == null)
            {
                try {
                    // Try to get an existing credential from the vault.
                    credential = vault.FindAllByResource(provider).FirstOrDefault();
                }

                catch (Exception) {
                    // When there is no matching resource an error occurs, which we ignore.
                }

                if (credential != null)
                {
                    // Create a user from the stored credentials.
                    MobUser = new MobileServiceUser(credential.UserName);
                    credential.RetrievePassword();
                    MobUser.MobileServiceAuthenticationToken = credential.Password;

                    // Set the user from the stored credentials.
                    App.MobileService.CurrentUser = MobUser;
                }

                else
                {
                    try {
                        // Login with the identity provider.
                        MobUser = await App.MobileService
                                  .LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount);

                        // Create and store the user credentials.
                        credential = new PasswordCredential(provider,
                                                            MobUser.UserId, MobUser.MobileServiceAuthenticationToken);
                        vault.Add(credential);
                    }

                    catch (MobileServiceInvalidOperationException ex) {
                        Messenger.Default.Send <ShowDialogMessage>(dialogMessage, MessagingIdentifiers.LOGIN_ERROR_MESSAGE);
                    }
                }

                this.MobUser = App.MobileService.CurrentUser;

                Messenger.Default.Send <ShowDialogMessage>(dialogMessage, MessagingIdentifiers.LOGIN_SUCCESS_MESSAGE);
            }

            return(true);
        }
예제 #19
0
 private async void showMsg(ShowDialogMessage msg)
 {
     await this.MainPage.DisplayAlert
         (msg.Title, msg.Message, msg.Caption);
 }
예제 #20
0
        private void showDialogMessage(ShowDialogMessage obj)
        {
            MessageBoxImage icon = (MessageBoxImage)Enum.Parse(typeof(MessageBoxImage), obj.Icon);

            MessageBox.Show(obj.Content, obj.Title, MessageBoxButton.OK, icon);
        }
예제 #21
0
 private void OnShowDialogMessage(string message)
 {
     ShowDialogMessage?.Invoke(message);
 }