private async void AddBoilerplate(RoutedEventArgs obj)
        {
            _boilerplate_dialog = new View.BoilerplateDialog();
            BoilerplateEditorViewModel bpdc = new BoilerplateEditorViewModel()
            {
                Text = "", Title = "", Context = this, Dialog = _boilerplate_dialog
            };

            _boilerplate_dialog.DataContext = bpdc;
            await _dialogCoordinator.ShowMetroDialogAsync(this, _boilerplate_dialog);
        }
        private async void OpenOfferSettingsDialog(Action <CompanyInfoDialogViewModel> closeHandler, Action <CompanyInfoDialogViewModel> completionHandler)
        {
            IsLoading = true;
            var dialogViewModel = new CompanyInfoDialogViewModel(closeHandler, completionHandler);

            dialogViewModel.LoadDataFromDatabase();
            IsLoading             = false;
            _customDialog.Content = new CompanyInfoDialogView {
                DataContext = dialogViewModel
            };

            await _dialogCoordinator.ShowMetroDialogAsync(this, _customDialog);
        }
Exemple #3
0
        private void ExecuteAdd()
        {
            string selectedJob;

            //Present a dialog for the user to select the type of job they want to add
            var dialog = new CustomDialog {
                Title = "Add New Job"
            };
            var panel = new StackPanel();

            panel.Children.Add(new RadioButton {
                Content = "Data Update", Margin = new Thickness(5), IsChecked = true
            });
            panel.Children.Add(new RadioButton {
                Content = "Economic Release Update", Margin = new Thickness(5), IsChecked = false
            });
            panel.Children.Add(new RadioButton {
                Content = "Dividend Update", Margin = new Thickness(5), IsChecked = false
            });

            var addBtn = new Button {
                Content = "Add"
            };

            addBtn.Click += (s, e) =>
            {
                DialogCoordinator.HideMetroDialogAsync(this, dialog);
                selectedJob = (string)panel.Children.OfType <RadioButton>().FirstOrDefault(r => r.IsChecked.HasValue && r.IsChecked.Value)?.Content;
                AddJob(selectedJob);
            };
            panel.Children.Add(addBtn);
            dialog.Content = panel;

            DialogCoordinator.ShowMetroDialogAsync(this, dialog);
        }
Exemple #4
0
        /// <summary>
        /// Open signin modal
        /// </summary>
        /// <returns>Task</returns>
        private async Task OpenSigninModal()
        {
            var signinDialog = new SigninDialog(new SigninDialogSettings());
            await DialogCoordinator.ShowMetroDialogAsync(this, signinDialog);

            var signinDialogResult = await signinDialog.WaitForButtonPressAsync();

            await DialogCoordinator.HideMetroDialogAsync(this, signinDialog);

            if (signinDialogResult == null)
            {
                return;
            }

            if (signinDialogResult.ShouldSignup)
            {
                var user = await OpenSignupModal();

                if (user == null)
                {
                    return;
                }
                await Signin(user);
            }
            else
            {
                var user = new Models.Account.User
                {
                    Username = signinDialogResult.Username,
                    Password = signinDialogResult.Password
                };

                await Signin(user);
            }
        }
Exemple #5
0
        /// <summary>
        /// Open signup modal
        /// </summary>
        /// <returns>User</returns>
        private async Task <Models.Account.User> OpenSignupModal()
        {
            var signupDialog = new SignupDialog(new SignupDialogSettings());
            await DialogCoordinator.ShowMetroDialogAsync(this, signupDialog);

            var signupDialogResult = await signupDialog.WaitForButtonPressAsync();

            await DialogCoordinator.HideMetroDialogAsync(this, signupDialog);

            if (signupDialogResult == null)
            {
                return(null);
            }
            return(await
                   UserService.CreateUser(signupDialogResult.Username, signupDialogResult.FirstName,
                                          signupDialogResult.LastName, signupDialogResult.Password, signupDialogResult.Email,
                                          new CancellationToken()));
        }
Exemple #6
0
        /// <summary>
        /// Manage an exception
        /// </summary>
        /// <param name="exception">The exception</param>
        private void ManageException(Exception exception)
        {
            if (IsManagingException)
            {
                return;
            }

            IsManagingException = true;
            if (exception is WebException || exception is SocketException)
            {
                IsConnectionInError = true;
            }

            DispatcherHelper.CheckBeginInvokeOnUI(async() =>
            {
                var exceptionDialog = new ExceptionDialog(new ExceptionDialogSettings(LocalizationProviderHelper.GetLocalizedValue <string>("EmbarrassingError"), exception.Message));
                await DialogCoordinator.ShowMetroDialogAsync(this, exceptionDialog);
                await exceptionDialog.WaitForButtonPressAsync();
                IsManagingException = false;
                await DialogCoordinator.HideMetroDialogAsync(this, exceptionDialog);
            });
        }
Exemple #7
0
 /// <summary>
 /// カスタムダイアログを表示します。
 /// </summary>
 /// <param name="dialog">カスタムダイアログのインスタンス</param>
 /// <param name="settings">設定情報</param>
 /// <returns><code>Task</code></returns>
 public Task ShowMetroDialogAsync(BaseMetroDialog dialog, MetroDialogSettings settings = null)
 {
     return(DialogCoordinator.ShowMetroDialogAsync(this, dialog, settings));
 }