Exemple #1
0
        public void UpdateEntryObject()
        {
            A6WDay?day = GetSelectedA6wDay();

            if (day == null)
            {
                throw new ArgumentNullException("You have to selected day number first");
            }
            entry.DayNumber = day.Value.DayNumber;
            entry.Completed = rbCompleted.Checked;
            entry.Comment   = txtComment.Text;
            usrReportStatus1.Save(entry);
            if (!entry.Completed)
            {
                usrA6WPartialCompleted1.Save(entry);
            }
            else
            {
                entry.Set1 = entry.Set2 = entry.Set3 = null;
            }
            if (entry.DayNumber == A6WManager.LastDay.DayNumber && entry.MyTraining.TrainingEnd == TrainingEnd.NotEnded)
            {
                entry.MyTraining.Complete();
                FMMessageBox.ShowInfo(A6WEntryStrings.TrainingCompletedText);
            }
        }
Exemple #2
0
        private void changeLanguage(string lang)
        {
            Log.WriteVerbose("changeLanguage: {0}", lang);
            var language = new CultureInfo(lang);

            Thread.CurrentThread.CurrentUICulture  = language;
            UserContext.Settings.GuiState.Language = lang;
            FMMessageBox.ShowInfo(ApplicationStrings.InfoChangeLanguageRestart);
        }
        public void GoToTheFirstEntry()
        {
            WorkoutDayGetOperation operation = new WorkoutDayGetOperation();

            operation.UserId    = User.Id;
            operation.Operation = GetOperation.First;
            TrainingDayDTO day = ServiceManager.GetTrainingDay(operation);

            if (day != null)
            {
                SetActiveMonth(day.TrainingDate);
            }
            else
            {
                FMMessageBox.ShowInfo(ApplicationStrings.InfoNoTrainingDayEntires);
            }
        }
        private void okButton1_Click(object sender, EventArgs e)
        {
            bool restartRequired = false;

            foreach (XtraTabPage tabPage in xtraTabControl1.TabPages)
            {
                IOptionsControl optionsControl = (IOptionsControl)tabPage.Controls[0];
                optionsControl.Save();
                if (optionsControl.RestartRequired)
                {
                    restartRequired = true;
                }
            }

            UserContext.Settings.GuiState.Save();
            if (restartRequired)
            {
                FMMessageBox.ShowInfo(ApplicationStrings.OptionsRestartRequiredMsg);
            }
        }
Exemple #5
0
        private void lblRegister_Click(object sender, EventArgs e)
        {
            CreateProfileWindow dlg = new CreateProfileWindow();

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                loggedSessionData = dlg.CreatedSessionData;
                if (loggedSessionData != null)
                {//we allow to login without activation
                    UserContext.CreateUserContext(loggedSessionData);
                    DialogResult = DialogResult.OK;
                    Close();
                }
                else
                {
                    lblSendActivationEmail.Visible = true;
                    FMMessageBox.ShowInfo(ApplicationStrings.ErrorMustActivateProfile);
                }
            }
        }
Exemple #6
0
        public void Fill(EntryObjectDTO entry)
        {
            this.entry = (A6WEntryDTO)entry;
            usrReportStatus1.Fill(entry);
            if (this.entry.MyTraining.Id == Constants.UnsavedObjectId)
            {
                FMMessageBox.ShowInfo(A6WEntryStrings.StartNewTrainingText);
            }

            if (entry.Id != Constants.UnsavedObjectId)
            {
                rbCompleted.Checked        = this.entry.Completed;
                rbPartialCompleted.Checked = !this.entry.Completed;
            }
            ReadOnly        = ReadOnly || this.entry.MyTraining.TrainingEnd != TrainingEnd.NotEnded;
            txtComment.Text = entry.Comment;
            fillDaysCombo();
            usrMyTrainingStatus1.Fill(this.entry.MyTraining);
            usrA6WPartialCompleted1.Fill(this.entry);
            lvA6W.Items[this.entry.DayNumber - 1].BackColor = selectedDayColor;
        }
 private void usrProgressIndicatorButtons1_OkClick(object sender, CancellationSourceEventArgs e)
 {
     try
     {
         ServiceManager.AccountOperation(textEdit1.Text, restorePassword?AccountOperationType.RestorePassword:AccountOperationType.SendActivationEmail);
         string message = restorePassword
                              ? ApplicationStrings.ForgotPasswordWindow_PasswordChangedInfo
                              :ApplicationStrings.ForgotPasswordWindow_ActivatedEmailSent;
         FMMessageBox.ShowInfo(message);
         ThreadSafeClose();
     }
     catch (ProfileIsNotActivatedException ex)
     {
         TasksManager.SetException(ex);
         this.SynchronizationContext.Send(delegate
         {
             ExceptionHandler.Default.Process(ex, ApplicationStrings.ErrorProfileIsActivated, ErrorWindow.MessageBox);
         }, null);
     }
     catch (EMailSendException ex)
     {
         TasksManager.SetException(ex);
         this.SynchronizationContext.Send(delegate
         {
             ExceptionHandler.Default.Process(ex, ApplicationStrings.ErrProblemWithSendingEmail, ErrorWindow.MessageBox);
         }, null);
     }
     catch (ObjectNotFoundException ex)
     {
         TasksManager.SetException(ex);
         this.SynchronizationContext.Send(delegate
         {
             ExceptionHandler.Default.Process(ex, ApplicationStrings.ForgotPasswordWindow_ProfileNotFoundError, ErrorWindow.MessageBox);
         }, null);
     }
 }
Exemple #8
0
        //private void previousNextEntry(TrainingDayDTO currentDay,string limitMessage)
        //{
        //    if (currentDay != null)
        //    {
        //        CurrentDay = currentDay;
        //        Fill(day);
        //    }
        //    else
        //    {
        //        FMMessageBox.ShowInfo(limitMessage);
        //    }
        //}

        private void previousNextEntry(TrainingDayDTO currentDay, GetOperation operationType, string limitMessage)
        {
            CancelEventArgs e = new CancelEventArgs();

            onTrainingDayChanging(e);
            if (e.Cancel)
            {
                return;
            }
            ParentWindow.RunAsynchronousOperation(delegate(OperationContext context)
            {
                WorkoutDayGetOperation operation = new WorkoutDayGetOperation();
                operation.Operation       = operationType;
                operation.UserId          = User.Id;
                operation.WorkoutDateTime = currentDay.TrainingDate;
                var day = ServiceManager.GetTrainingDay(operation);
                context.CancellatioToken.ThrowIfCancellationRequested();
                ParentWindow.SynchronizationContext.Send(delegate
                {
                    if (day != null)
                    {
                        DateTime oldDate = CurrentDay.TrainingDate;
                        CurrentDay       = day;
                        Fill(day, User);
                        onTrainingDayChanged(new TrainingDayChangedEventArgs(oldDate, CurrentDay.TrainingDate));
                    }
                    else
                    {
                        FMMessageBox.ShowInfo(limitMessage);//ApplicationStrings.InfoNextEntryLimit);
                    }
                }, null);
            }, delegate(OperationContext ctx)
            {
                tsbNext.Enabled = tsbPrevious.Enabled = ctx.State != OperationState.Started;
            });
        }