Beispiel #1
0
        private async void ButtonSaveColor_Click(object sender, RoutedEventArgs e)
        {
            string         message;
            string         title;
            InfoDialogType dialogType = InfoDialogType.Info;

            if (Employee != null && !string.IsNullOrEmpty(_color))
            {
                var result = await Proxy.ChangeEmployeeForegroundColor(Employee.EmployeeId, _color);

                if (result)
                {
                    Proxy.UpdateEmployee(Employee);
                    message = "Die Schriftfarbe Deiner Anmeldeinformationsbox wurde geändert";
                    title   = "Erfolg";
                }
                else
                {
                    message    = "Die Schriftfarbe konnte nicht gespeichert werden";
                    title      = "Fehler";
                    dialogType = InfoDialogType.Error;
                }
            }
            else
            {
                message    = "Ein Fehler ist aufgetreten";
                title      = "Fehler";
                dialogType = InfoDialogType.Error;
            }
            var dialog = new InfoDialog(message, title, dialogType);
            await dialog.ShowAsync();
        }
Beispiel #2
0
        public InfoDialog(string message, string title = "Information", InfoDialogType infoDialogType = InfoDialogType.Info, string primaryButtonText = null, string secondaryButtonText = null)
        {
            this.InitializeComponent();
            DialogTitle = title;
            Message     = message;

            if (!string.IsNullOrEmpty(primaryButtonText))
            {
                PrimaryButtonText = primaryButtonText;
            }

            if (!string.IsNullOrEmpty(secondaryButtonText))
            {
                SecondaryButtonText = secondaryButtonText;
            }

            switch (infoDialogType)
            {
            case InfoDialogType.Info:
            default:
            {
                InfoIcon.Visibility  = Visibility.Visible;
                ErrorIcon.Visibility = Visibility.Collapsed;
                break;
            }

            case InfoDialogType.Error:
            {
                InfoIcon.Visibility  = Visibility.Collapsed;
                ErrorIcon.Visibility = Visibility.Visible;
                break;
            }
            }
        }
Beispiel #3
0
        private async void ButtonChangePassword_Click(object sender, RoutedEventArgs e)
        {
            if (!ValidatePassword())
            {
                return;
            }

            string         message;
            string         title;
            InfoDialogType dialogType = InfoDialogType.Info;

            if (Employee != null)
            {
                var password    = PasswordBoxPassword.Password;
                var newPassword = PasswordBoxNewPassword.Password;

                var result = await Proxy.ChangeEmployePassword(Employee.EmployeeId, password, newPassword);

                if (result)
                {
                    Proxy.UpdateEmployee(Employee);
                    message = "Dein Passwort wurde geändert";
                    title   = "Erfolg";
                }
                else
                {
                    message    = "Das eingegebende Passwort war falsch";
                    title      = "Fehler";
                    dialogType = InfoDialogType.Error;
                }
            }
            else
            {
                message    = "Ein Fehler ist aufgetreten";
                title      = "Fehler";
                dialogType = InfoDialogType.Error;
            }

            var dialog = new InfoDialog(message, title, dialogType);
            await dialog.ShowAsync();
        }