Beispiel #1
0
 public bool ValuesEquals(TrainingSetTemplate compareTo)
 {
     return
         (this.Credits == compareTo.Credits &&
          this.Description == compareTo.Description &&
          this.Duration == compareTo.Duration &&
          this.EffortType.Equals(compareTo.EffortType) &&
          this.Title == compareTo.Title &&
          IntervalsAreEqual(this.Intervals, compareTo.Intervals) &&
          VideoTextIsEqual(this.VideoText, compareTo.VideoText));
 }
Beispiel #2
0
        public void BeginEdit()
        {
            backupValues             = new TrainingSetTemplate();
            backupValues.Credits     = this.Credits;
            backupValues.Description = this.Description;
            backupValues.Duration    = this.Duration;
            backupValues.EffortType  = this.EffortType;
            var backupIntervals = new List <Interval>();

            backupIntervals.AddRange(this.Intervals.Select(x => x.Clone()));
            backupValues.Intervals = backupIntervals;
            backupValues.Title     = this.Title;
        }
        public ApplicationUser AddTemplateToLibrary(TrainingSetTemplate template, Action complete)
        {
            var userService = IoC.Resolve <IApplicationUserService>();

            userService.AddTemplateError += (sender, e) =>
            {
                complete();
                throw e.Value;
            };
            userService.AddTemplateCompleted += (sender, e) =>
            {
                var dialogFacade = IoC.Resolve <IDialogFacade>();
                switch (e.Value.AddTemplateStatus)
                {
                case AddTemplateStatus.Success:
                    ApplicationUser.CurrentUser.Templates.Add(template);
                    break;

                case AddTemplateStatus.InsufficientCredits:
                    dialogFacade.Alert(ApplicationResources.InsufficientCredits);
                    break;

                case AddTemplateStatus.TemplateAlreadyAdded:
                    dialogFacade.Alert(ApplicationResources.TemplateAlreadyAdded);
                    break;

                case AddTemplateStatus.Error:
                    dialogFacade.Alert(e.Value.Message);
                    break;

                default:
                    break;
                }
                complete();
            };
            userService.AddTemplateToLibrary(template);
            return(this);
        }
Beispiel #4
0
 public void AcceptChanges()
 {
     IsTelemetryLoaded = false;
     backupValues      = null;
 }