Esempio n. 1
0
        private async void ExecuteDeleteProjectCommand(ProjectViewModel arg)
        {
            ConfirmationServiceArgs args = new ConfirmationServiceArgs(Strings.Confirm, string.Format(Strings.DoYouReallyWantToDeleteProjectXXX, arg.Model.Name), Strings.Yes, Strings.No);

            if (!await ViewServices.Execute <IConfirmationService, bool>(args))
            {
                return;
            }

            arg.CurrentChanged -= Proj_CurrentChanged;

            Projects.Remove(arg);
            ProjectRepo.Delete(arg.Model);

            if (!Projects.Contains(CurrentProject))
            {
                CurrentProject = Projects.FirstOrDefault();
                if (CurrentProject != null)
                {
                    CurrentProject.IsCurrent = true;
                }
            }

            MessengerInstance.Send(new NotificationMessage(Strings.ProjectDeleted));
        }
Esempio n. 2
0
        private async void ExecuteDeleteEntryCommand()
        {
            ConfirmationServiceArgs args = new ConfirmationServiceArgs(Strings.Confirm, Strings.DoYouReallyWantToDeleteThisEntry, Strings.Yes, Strings.No);

            if (!await ViewServices.Execute <IConfirmationService, bool>(args))
            {
                return;
            }

            DeleteRequested?.Invoke(this, EventArgs.Empty);
        }
        public void ConstructorSetsCorrectProperties()
        {
            // Arrange

            // Act
            var csa = new ConfirmationServiceArgs("title", "message", "ok", "cancel");

            // Assert
            Assert.AreEqual("title", csa.Title);
            Assert.AreEqual("message", csa.Message);
            Assert.AreEqual("ok", csa.OkText);
            Assert.AreEqual("cancel", csa.CancelText);
        }
Esempio n. 4
0
        private async void ExecuteDeleteTagCommand(TagViewModel arg)
        {
            ConfirmationServiceArgs args = new ConfirmationServiceArgs(Strings.Confirm,
                                                                       string.Format(Strings.DoYouReallyWantToDeleteTagXXX, arg.Model.Name),
                                                                       Strings.Yes, Strings.No);

            if (!await ViewServices.Execute <IConfirmationService, bool>(args))
            {
                return;
            }

            TagRepo.Delete(arg.Model);
            Tags.Remove(arg);

            MessengerInstance.Send(new TagRemovedMessage(arg.Model));
            MessengerInstance.Send(new NotificationMessage(Strings.TagDeleted));
            ReadTagNames();
        }