コード例 #1
0
 private async Task EditAccountAsync()
 {
     try
     {
         await ButtonSpinner.SpinAsync(async() =>
         {
             await EmployeeService.EditPersonalAccountAsync(PersonalAccount);
             RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(PersonalAccount.EmployeeId));
             await ToastService.ShowToastAsync("Account updated.", ToastType.Success);
             await ModalDialogClose();
         });
     }
     catch (HESException ex) when(ex.Code == HESCode.AccountExist)
     {
         ValidationErrorMessage.DisplayError(nameof(Account.Name), ex.Message);
     }
     catch (HESException ex) when(ex.Code == HESCode.IncorrectUrl)
     {
         ValidationErrorMessage.DisplayError(nameof(Account.Urls), ex.Message);
     }
     catch (Exception ex)
     {
         Logger.LogError(ex.Message);
         await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
         await ModalDialogCancel();
     }
 }
コード例 #2
0
 private async Task FilterAsync()
 {
     await ButtonSpinner.SpinAsync(async() =>
     {
         await FilterChanged.Invoke(Filter);
     });
 }
コード例 #3
0
        private void MinButtonSpinner_Spin(object sender, SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;

            System.Windows.Controls.TextBox txtBox = (System.Windows.Controls.TextBox)spinner.Content;

            int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);

            if (e.Direction == SpinDirection.Increase)
            {
                value++;
                if (value > 60)
                {
                    value = 0;
                }
            }
            else
            {
                value--;
                if (value < 0)
                {
                    value = 60;
                }
            }
            txtBox.Text = value.ToString();
            min         = value;
        }
コード例 #4
0
        private async Task EditAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await OrgStructureService.EditDepartmentAsync(Department);
                    await ToastService.ShowToastAsync("Department updated.", ToastType.Success);
                    await Refresh.InvokeAsync(this);
                    await SynchronizationService.UpdateOrgSructureCompanies(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (AlreadyExistException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(Department.Name), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
コード例 #5
0
        private async Task EditAccountOtpAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await EmployeeService.EditPersonalAccountOtpAsync(Account, _accountOtp);
                    RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(Account.EmployeeId));
                    await ToastService.ShowToastAsync("Account OTP updated.", ToastType.Success);
                    await SynchronizationService.UpdateEmployeeDetails(ExceptPageId, Account.EmployeeId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (IncorrectOtpException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(AccountOtp.OtpSecret), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
コード例 #6
0
        private async Task EditAccoountOtpAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    var vaults = await SharedAccountService.EditSharedAccountOtpAsync(Account, AccountOtp);
                    RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(vaults);
                    await SynchronizationService.UpdateSharedAccounts(ExceptPageId);
                    await ToastService.ShowToastAsync("Account OTP updated.", ToastType.Success);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (IncorrectOtpException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.OtpSecret), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
コード例 #7
0
        private async Task CreateAccountAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await SharedAccountService.CreateSharedAccountAsync(SharedAccount);
                    await ToastService.ShowToastAsync("Account created.", ToastType.Success);
                    await SynchronizationService.UpdateSharedAccounts(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (AlreadyExistException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.Name), ex.Message);
            }
            catch (IncorrectUrlException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.Urls), ex.Message);
            }
            catch (IncorrectOtpException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(SharedAccount.OtpSecret), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
コード例 #8
0
        private async Task EditAccountPasswordAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    using (TransactionScope transactionScope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
                    {
                        await EmployeeService.EditPersonalAccountPwdAsync(Account, AccountPassword);

                        if (AccountPassword.UpdateActiveDirectoryPassword)
                        {
                            await LdapService.SetUserPasswordAsync(Account.EmployeeId, AccountPassword.Password, LdapSettings);
                        }

                        transactionScope.Complete();
                    }

                    RemoteDeviceConnectionsService.StartUpdateHardwareVaultAccounts(await EmployeeService.GetEmployeeVaultIdsAsync(Account.EmployeeId));
                    await ToastService.ShowToastAsync("Account password updated.", ToastType.Success);
                    await ModalDialogClose();
                });
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
                await ModalDialogClose();
            }
        }
コード例 #9
0
ファイル: Login.razor.cs プロジェクト: EugeneRymarev/HES
        private async Task NextAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    var user = await ApplicationUserService.GetUserByEmailAsync(UserEmailModel.Email);
                    if (user == null)
                    {
                        ValidationErrorMessage.DisplayError(nameof(UserEmailModel.Email), HESException.GetMessage(HESCode.UserNotFound));
                        return;
                    }

                    PasswordSignInModel.Email = UserEmailModel.Email;
                    HasSecurityKey            = (await Fido2Service.GetCredentialsByUserEmail(UserEmailModel.Email)).Count > 0;
                    AuthenticationStep        = AuthenticationStep.EnterPassword;
                });
            }
            catch (HESException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(UserEmailModel.Email), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                SetErrorMessage(ex.Message);
            }
        }
コード例 #10
0
 /// <summary>
 /// Creates a new <see cref="ButtonSpinnerSelectionHandler"/> instance.
 /// </summary>
 /// <param name="Spinner">The spinner to wrap</param>
 public ButtonSpinnerSelectionHandler(ButtonSpinner Spinner)
 {
     this.Spinner  = Spinner;
     ContentBlock  = (TextBlock)Spinner.Content;
     Spinner.Spin += SelectionSpinner_Spin;
     Spinner.ValidSpinDirection = ValidSpinDirections.None;
 }
コード例 #11
0
        private void kolicina_MouseDown(object sender, Xceed.Wpf.Toolkit.SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBlock     txtBox  = (TextBlock)spinner.Content;

            int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);

            if (e.Direction == SpinDirection.Increase)
            {
                value++;
            }
            else
            {
                value--;
            }
            txtBox.Text = value.ToString();

            Grid      grid  = spinner.Parent as Grid;
            Grid      grid1 = grid.Parent as Grid;
            int       id    = 0;
            TextBlock t     = grid1.FindName("skrivenId") as TextBlock;

            id = Convert.ToInt32(t.Text);
            for (int i = 0; i < this.korpa.Count; i++)
            {
                if ((this.korpa[i] as Oprema).IdOprema == id)
                {
                    Oprema tmp = (this.korpa[i] as Oprema);
                    tmp.IzabranaKolicina = value;
                    tmp.SumCena          = (this.korpa[i] as Oprema).IzabranaKolicina * (this.korpa[i] as Oprema).Cena;
                    // this.ukupnaCenaUKorpi += tmp.SumCena;
                    if (value == tmp.KolicinaNaLageru)
                    {
                        spinner.ValidSpinDirection = ValidSpinDirections.Decrease;
                    }
                    else if (value == 1)
                    {
                        spinner.ValidSpinDirection = ValidSpinDirections.Increase;
                    }
                    else
                    {
                        ButtonSpinner b = new ButtonSpinner();
                        spinner.ValidSpinDirection = b.ValidSpinDirection;
                        b = null;
                    }
                }
            }


            //foreach (var item in this.Korpa)
            //{
            //    UkupnaCenaUKorpi += (item as Oprema).SumCena;
            //}
            this.refreshujUkupnuCenu();
            //Xceed.Wpf.Toolkit.MessageBox.Show(this.ukupnaCenaUKorpi.ToString());


            //TextBlock textBlockUkunaCena = this.gridDugmici.FindName("txbUkupnaCena") as TextBlock;
            //textBlockUkunaCena.Text = "Ukupna cena u korpi: " + this.UkupnaCenaUKorpi.ToString();
        }
コード例 #12
0
        private void ButtonSpinner_Spin(object sender, SpinEventArgs e)
        {
            String[] names = (String[])this.Resources["Names"];

            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox       txtBox  = (TextBox)spinner.Content;

            int value = Array.IndexOf(names, txtBox.Text);

            if (e.Direction == SpinDirection.Increase)
            {
                value++;
            }
            else
            {
                value--;
            }

            if (value < 0)
            {
                value = names.Length - 1;
            }
            else if (value >= names.Length)
            {
                value = 0;
            }

            txtBox.Text = names[value];
        }
コード例 #13
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var color = UIColor.FromRGB(64, 64, 64);

            View.BackgroundColor = color;
            ButtonBack.SetImage(UIImage.FromBundle("arrow_left").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);

            ViewTop.BackgroundColor = UIColor.Clear;
            //ViewTop.Layer.MasksToBounds = false;
            //ViewTop.Layer.ShadowOpacity = 1f;
            //ViewTop.Layer.ShadowOffset = new CGSize(0, 2);
            //ViewTop.Layer.ShadowColor = UIColor.Gray.CGColor;
            //ViewTop.Layer.CornerRadius = 0;

            ButtonSpinner.BackgroundColor = UIColor.Clear;
            ButtonSpinner.Font            = UIFont.SystemFontOfSize(13);
            ButtonSpinner.SetTitle("Select album", UIControlState.Normal);
            ButtonSpinner.Layer.CornerRadius = 3;
            ButtonSpinner.Layer.BorderColor  = UIColor.White.CGColor;
            ButtonSpinner.Layer.BorderWidth  = 1f;

            galleryCollectionSource = new GalleryCollectionSource(assets, this);

            CollectionGallery.RegisterNibForCell(UINib.FromName("GalleryItemPhotoViewCell", NSBundle.MainBundle), "GalleryItemPhotoViewCell");
            CollectionGallery.DataSource = galleryCollectionSource;
            CollectionGallery.SetCollectionViewLayout(GetLayoutWhenOrientaion(), true);

            ViewBottom.BackgroundColor       = color.ColorWithAlpha(0.7f);
            ButtonDone.Layer.BackgroundColor = UIColor.FromRGB(42, 131, 193).CGColor;
            ButtonDone.Layer.CornerRadius    = 12;
            ButtonDone.SetTitle("Done", UIControlState.Normal);

            ButtonBack.TouchUpInside += (object sender, EventArgs e) =>
            {
                OnPicked?.Invoke(new List <PhotoSetNative>());
                //DismissViewController(true, null);
            };

            ButtonDone.TouchUpInside += (object sender, EventArgs e) =>
            {
                OnPicked?.Invoke(GetCurrentSelected());
                //MessagingCenter.Send<SupportGalleryPickerController, List<PhotoSetNative>>(this, Utils.SubscribeImageFromGallery, GetCurrentSelected());
                //DismissModalViewController(true);
            };

            ButtonSpinner.TouchUpInside += (sender, e) => {
                ShowData();
            };

            InitShowDialog();
            FeetchAddPhotos();
        }
コード例 #14
0
        private void btnVrednostPoena_Spin(object sender, Xceed.Wpf.Toolkit.SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox       txtBox  = (TextBox)spinner.Content;

            int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);

            if (e.Direction == SpinDirection.Increase && value < tmpKorisnik.BrojOstvarenihPoena && value < this.tmpKorisnik.BrojPoenaZaPopust)
            {
                value = value + 1;
            }
            else
            {
                if (value > 0)
                {
                    value = value - 1;
                }
            }
            txtBox.Text = value.ToString();

            Grid grid = spinner.Parent as Grid;

            int       id = 0;
            TextBlock t  = grid.FindName("skrivenId") as TextBlock;

            id = Convert.ToInt32(t.Text);

            if (value >= tmpKorisnik.BrojPoenaZaPopust || value >= tmpKorisnik.BrojOstvarenihPoena)
            {
                spinner.ValidSpinDirection = ValidSpinDirections.Decrease;
            }
            else if (value == 0)
            {
                spinner.ValidSpinDirection = ValidSpinDirections.Increase;
            }
            else
            {
                ButtonSpinner b = new ButtonSpinner();
                spinner.ValidSpinDirection = b.ValidSpinDirection;
                b = null;
            }
            tmpKorisnik.IzabranBrojPoenaZaPopust = value;
            if (tmpKorisnik != null)
            {
                UkupnaCenaSaPopustom = UkupnaCena - (10 * TmpKorisnik.IzabranBrojPoenaZaPopust);
            }
            else
            {
                UkupnaCenaSaPopustom = UkupnaCena;
            }
        }
コード例 #15
0
        public void IF_ItemSelectd(int position)
        {
            CurrentParent = position;

            HideData();

            assets.Clear();
            var xx = galleryDirectories[position];

            ButtonSpinner.SetTitle(xx.Collection.LocalizedTitle, UIControlState.Normal);

            assets.AddRange(xx.Images);

            collectionView.ReloadData();
        }
コード例 #16
0
        public pScrollValue(string InstanceName)
        {
            //Set Element info setup
            Element      = new ButtonSpinner();
            Element.Name = InstanceName;
            Type         = "ScrollValue";


            Element.Spin -= (o, e) => { Element.Content = ValueSet[CapValue(e.Direction == SpinDirection.Increase)]; };
            Element.Spin += (o, e) => { Element.Content = ValueSet[CapValue(e.Direction == SpinDirection.Increase)]; };

            //Set "Clear" appearance to all elements
            Element.Background      = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            Element.BorderBrush     = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            Element.BorderThickness = new Thickness(0);
        }
コード例 #17
0
        private async Task EditRenewLicenseOrderAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    if (_renewLicenseOrder.EndDate < DateTime.Now)
                    {
                        ValidationErrorMessage.DisplayError(nameof(RenewLicenseOrder.EndDate), $"End Date must not be less than Start Date.");
                        return;
                    }

                    if (!_renewLicenseOrder.HardwareVaults.Where(x => x.Checked).Any())
                    {
                        ValidationErrorMessage.DisplayError(nameof(RenewLicenseOrder.HardwareVaults), $"Select at least one hardware vault.");
                        return;
                    }

                    var checkedHardwareVaults = _renewLicenseOrder.HardwareVaults.Where(x => x.Checked).ToList();
                    var maxEndDate            = checkedHardwareVaults.Select(x => x.LicenseEndDate).Max();

                    if (_renewLicenseOrder.EndDate < maxEndDate)
                    {
                        ValidationErrorMessage.DisplayError(nameof(RenewLicenseOrder.HardwareVaults), $"The selected End Date less than max end date for selected hardware vaults.");
                        return;
                    }

                    LicenseOrder.ContactEmail            = _renewLicenseOrder.ContactEmail;
                    LicenseOrder.Note                    = _renewLicenseOrder.Note;
                    LicenseOrder.ProlongExistingLicenses = true;
                    LicenseOrder.StartDate               = null;
                    LicenseOrder.EndDate                 = _renewLicenseOrder.EndDate.Date;

                    await LicenseService.EditOrderAsync(LicenseOrder, checkedHardwareVaults);
                    await SynchronizationService.UpdateLicenses(ExceptPageId);
                    await ToastService.ShowToastAsync("Order created.", ToastType.Success);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
コード例 #18
0
ファイル: EditRfid.razor.cs プロジェクト: minkione/HES
 private async Task EditAsync()
 {
     try
     {
         await ButtonSpinner.SpinAsync(async() =>
         {
             await HardwareVaultService.UpdateRfidAsync(HardwareVault);
             await ToastService.ShowToastAsync("RFID updated.", ToastType.Success);
             await ModalDialogClose();
         });
     }
     catch (Exception ex)
     {
         Logger.LogError(ex.Message);
         await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
         await ModalDialogCancel();
     }
 }
コード例 #19
0
        private void ButtonSpinner_Spin(object sender, SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox       txtBox  = (TextBox)spinner.Content;

            int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);

            if (e.Direction == SpinDirection.Increase)
            {
                value++;
            }
            else
            if (value > 0)
            {
                value--;
            }
            txtBox.Text = value.ToString();
        }
コード例 #20
0
        private async Task UpdateLicensingSettingsAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await AppSettingsService.SetLicensingSettingsAsync(LicensingSettings);
                    await ToastService.ShowToastAsync("License settings updated.", ToastType.Success);
                    await SynchronizationService.UpdateParameters(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CloseAsync();
            }
        }
コード例 #21
0
        private async Task CreateProfileAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    await HardwareVaultService.CreateProfileAsync(AccessProfile);
                    await ToastService.ShowToastAsync("Hardware vault profile created.", ToastType.Success);
                    await SynchronizationService.UpdateHardwareVaultProfiles(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
コード例 #22
0
ファイル: MainWindow.xaml.cs プロジェクト: jclapis/sedna
        /// <summary>
        /// Creates the main window.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif

            // Set up the logger
            TextBox logBox = this.FindControl <TextBox>("LogBox");
            Logger = new Logger(logBox);

            // Get all of the named components
            CameraSelectionBox = this.FindControl <ComboBox>("CameraSelectionBox");
            ViewfinderImage    = this.FindControl <Image>("ViewfinderImage");
            IsoBox             = this.FindControl <ComboBox>("IsoBox");
            ButtonSpinner exposureSpinner = this.FindControl <ButtonSpinner>("ExposureBox");
            ExposureBox = new ButtonSpinnerSelectionHandler(exposureSpinner);
            ExposureBox.SelectionChanged += ExposureBox_SelectionChanged;
            ImageTabControl        = this.FindControl <TabControl>("ImageTabControl");
            ImageFormatBox         = this.FindControl <ComboBox>("ImageFormatBox");
            CameraOutputBox        = this.FindControl <ComboBox>("CameraOutputBox");
            CaptureToggle          = this.FindControl <CheckBox>("CaptureToggle");
            ViewfinderSpeedSlider  = this.FindControl <Slider>("ViewfinderSpeedSlider");
            ViewfinderSpeedLabel   = this.FindControl <TextBlock>("ViewfinderSpeedLabel");
            VerticalCrosshairBar   = this.FindControl <Rectangle>("VerticalCrosshairBar");
            HorizontalCrosshairBar = this.FindControl <Rectangle>("HorizontalCrosshairBar");
            CrosshairCircle        = this.FindControl <Ellipse>("CrosshairCircle");
            FocusLabel             = this.FindControl <TextBlock>("FocusLabel");

            // Misc other setup
            LiveViewDelay = 50;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                CameraManager = new CameraManager(Logger);
            }

            RefreshCameras();
            LoadHardware();
        }
コード例 #23
0
        /// <summary>
        /// Handles the Spin event of the ButtonSpinner control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="Microsoft.Windows.Controls.SpinEventArgs"/> instance containing the event data.</param>
        private void ButtonSpinner_Spin(object sender, Microsoft.Windows.Controls.SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox       txtBox  = (TextBox)spinner.Content;
            Binding       binding = txtBox.GetBindingExpression(TextBox.TextProperty).ParentBinding;

            int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);

            if (e.Direction == Microsoft.Windows.Controls.SpinDirection.Increase)
            {
                value++;
            }
            else
            {
                value--;
            }
            if (value <= 0)
            {
                value = 1;
            }
            typeof(Settings).GetProperty(binding.Path.Path).SetValue(Settings.Default, Convert.ToUInt32(value), null);
        }
コード例 #24
0
ファイル: EditEmployee.razor.cs プロジェクト: minkione/HES
 private async Task EditAsync()
 {
     try
     {
         await ButtonSpinner.SpinAsync(async() =>
         {
             await EmployeeService.EditEmployeeAsync(Employee);
             await ToastService.ShowToastAsync("Employee updated.", ToastType.Success);
             await ModalDialogClose();
         });
     }
     catch (AlreadyExistException ex)
     {
         ValidationErrorMessage.DisplayError(nameof(Employee.FirstName), ex.Message);
     }
     catch (Exception ex)
     {
         Logger.LogError(ex.Message);
         await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
         await ModalDialogCancel();
     }
 }
コード例 #25
0
        private void ButtonSpinner_Spin(object sender, Xceed.Wpf.Toolkit.SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox       txtBox  = (TextBox)spinner.Content;

            try
            {
                int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);
                if (e.Direction == Xceed.Wpf.Toolkit.SpinDirection.Increase)
                {
                    value++;
                }
                else
                {
                    value--;
                }
                txtBox.Text = value.ToString();
            }
            catch (FormatException) {
                txtBox.Text = "2000";
            }
        }
コード例 #26
0
ファイル: Login.razor.cs プロジェクト: EugeneRymarev/HES
        private async Task LoginWithPasswordAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    var response = await IdentityApiClient.LoginWithPasswordAsync(PasswordSignInModel);
                    response.ThrowIfFailed();

                    if (response.Succeeded)
                    {
                        NavigationManager.NavigateTo(Routes.Dashboard, true);
                        return;
                    }

                    if (response.RequiresTwoFactor)
                    {
                        NavigationManager.NavigateTo($"{Routes.LoginWith2Fa}?returnUrl={ReturnUrl}", true);
                        return;
                    }

                    if (response.IsLockedOut)
                    {
                        NavigationManager.NavigateTo(Routes.Lockout, true);
                        return;
                    }
                });
            }
            catch (HESException ex) when(ex.Code == HESCode.InvalidLoginAttempt)
            {
                ValidationErrorMessage.DisplayError(nameof(PasswordSignInModel.Password), HESException.GetMessage(ex.Code));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                SetErrorMessage(ex.Message);
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ButtonBack != null)
            {
                ButtonBack.Dispose();
                ButtonBack = null;
            }

            if (ButtonDone != null)
            {
                ButtonDone.Dispose();
                ButtonDone = null;
            }

            if (ButtonSpinner != null)
            {
                ButtonSpinner.Dispose();
                ButtonSpinner = null;
            }

            if (CollectionGallery != null)
            {
                CollectionGallery.Dispose();
                CollectionGallery = null;
            }

            if (ViewBottom != null)
            {
                ViewBottom.Dispose();
                ViewBottom = null;
            }

            if (ViewTop != null)
            {
                ViewTop.Dispose();
                ViewTop = null;
            }
        }
コード例 #28
0
        public virtual void ShouldDisallowSpinsWhenDomainBordersAreReached()
        {
            DomainUpDown dud = new DomainUpDown();

            dud.Items.Add("a");
            dud.Items.Add("b");
            dud.Items.Add("c");

            ButtonSpinner spinner = null;

            // dud changes increment decrement logic

            TestAsync(
                dud,
                () => spinner = ((Panel)VisualTreeHelper.GetChild(dud, 0)).FindName("Spinner") as ButtonSpinner,
                () => Assert.AreEqual(ValidSpinDirections.Decrease, spinner.ValidSpinDirection),
                () => dud.Value = "b",
                () => Assert.IsTrue(spinner.ValidSpinDirection == (ValidSpinDirections.Increase | ValidSpinDirections.Decrease)),
                () => dud.Value = "c",
                () => Assert.AreEqual(ValidSpinDirections.Increase, spinner.ValidSpinDirection),
                () => dud.IsCyclic = true,
                () => Assert.IsTrue(spinner.ValidSpinDirection == (ValidSpinDirections.Increase | ValidSpinDirections.Decrease)));
        }
コード例 #29
0
        public virtual void ShouldDetermineValidSpinDirection()
        {
            NumericUpDown nud = new NumericUpDown();

            nud.Minimum = 5;
            nud.Maximum = 10;

            ButtonSpinner spinner = null;

            TestAsync(
                nud,
                () => spinner = ((Panel)VisualTreeHelper.GetChild(nud, 0)).FindName("Spinner") as ButtonSpinner,
                () => Assert.AreEqual(ValidSpinDirections.Increase, spinner.ValidSpinDirection),
                () => nud.Value = 8,
                () => Assert.IsTrue(spinner.ValidSpinDirection == (ValidSpinDirections.Increase | ValidSpinDirections.Decrease)),
                () => nud.Value = 10,
                () => Assert.AreEqual(ValidSpinDirections.Decrease, spinner.ValidSpinDirection),
                () => nud.Maximum = 11,
                () => Assert.IsTrue(spinner.ValidSpinDirection == (ValidSpinDirections.Increase | ValidSpinDirections.Decrease)),
                () => nud.Value   = 5,
                () => nud.Minimum = 1,
                () => Assert.IsTrue(spinner.ValidSpinDirection == (ValidSpinDirections.Increase | ValidSpinDirections.Decrease)));
        }
コード例 #30
0
        private void ButtonSpinner_Spin(object sender, Microsoft.Windows.Controls.SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox       txtBox  = (TextBox)spinner.Content;

            try
            {
                int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);
                if (e.Direction == Microsoft.Windows.Controls.SpinDirection.Increase)
                {
                    value++;
                }
                else
                {
                    value--;
                }
                txtBox.Text = value.ToString();
            }
            catch
            {
                txtBox.Text = "0";
            }
        }