コード例 #1
0
        public void EditHours()
        {
            var dialog    = EditSingleValueViewModel.Create("Expire Hours");
            var OkCommand = new UICommand
            {
                Id        = MessageBoxResult.OK,
                Caption   = "Modify",
                IsCancel  = false,
                IsDefault = true,
                Command   = new DelegateCommand <CancelEventArgs>(EditHours, CanEditHours, true)
            };

            void EditHours(CancelEventArgs ar)
            {
                SplashScreenManagerService.Show();
                foreach (var license in SelectedLicenses)
                {
                    license.APILicense.ModifyHours(int.Parse(dialog.Input));
                    license.UpdateLicense(license.APILicense.RefreshData());
                }

                SplashScreenManagerService.Close();
            }

            bool CanEditHours(CancelEventArgs ar)
            {
                if (string.IsNullOrEmpty(dialog.Input))
                {
                    return(false);
                }

                if (int.TryParse(dialog.Input, out var hours))
                {
                    return(hours > 0 && hours < 99999);
                }

                return(false);
            }

            var CancelCommand = new UICommand
            {
                Id = MessageBoxResult.Cancel, Caption = "Cancel", IsCancel = true, IsDefault = false
            };

            EditDialogService.ShowDialog(
                new List <UICommand> {
                OkCommand, CancelCommand
            },
                "Edit Hours Dialog",
                dialog);
        }
コード例 #2
0
        public void EditCustomData()
        {
            var dialog    = EditSingleValueViewModel.Create("Modified Custom Data");
            var OkCommand = new UICommand
            {
                Id        = MessageBoxResult.OK,
                Caption   = "Modify",
                IsCancel  = false,
                IsDefault = true,
                Command   = new DelegateCommand <CancelEventArgs>(ModifyComment)
            };

            void ModifyComment(CancelEventArgs ar)
            {
                SplashScreenManagerService.Show();
                foreach (var license in SelectedLicenses)
                {
                    license.APILicense.ModifyCustomData(dialog.Input);
                    license.UpdateLicense(license.APILicense.RefreshData());
                }

                SplashScreenManagerService.Close();
            }

            var CancelCommand = new UICommand
            {
                Id = MessageBoxResult.Cancel, Caption = "Cancel", IsCancel = true, IsDefault = false
            };

            EditDialogService.ShowDialog(
                new List <UICommand> {
                OkCommand, CancelCommand
            },
                "Edit Custom Data Dialog Dialog",
                dialog);
        }