示例#1
0
 public ExerciseViewModel(User user)
 {
     currentUser = user;
     trainingRestClient = new TrainingRestClient(user.Id);
     CurrentField = new Bitmap(Properties.Resources.soccer);
     Refresh();
 }
示例#2
0
 public Upload(User currentUser, LibraryViewModel libraryViewModel)
 {
     InitializeComponent();
     trainingRestClient    = new TrainingRestClient(currentUser.Id);
     this.currentUser      = currentUser;
     this.libraryViewModel = libraryViewModel;
 }
 public CommunityViewModel(User user)
 {
     currentUser           = user;
     selectedTrainExercise = new Trainingsexercise();
     SelectedTrainObject   = new Trainingsobject();
     trainingRestClient    = new TrainingRestClient(user.Id);
     Refresh();
 }
示例#4
0
        private void Button_Click_SaveExercise(object sender, RoutedEventArgs e)
        {
            trainingRestClient = new TrainingRestClient(currentUser.Id);
            int parent = -1;

            if (chkEnableUnit.IsChecked == true)
            {
                if (radioButtonNewUnit.IsChecked == true)
                {
                    Trainingsunit trainingsunit = new Trainingsunit();
                    if (radioButtonPrivate.IsChecked == true)
                    {
                        trainingsunit.Accessibility = "private";
                    }
                    else
                    {
                        trainingsunit.Accessibility = "public";
                    }
                    trainingsunit.Description = textBoxDescripUnit.Text;
                    trainingsunit.Name        = textBoxNameUnit.Text;
                    trainingsunit             = trainingRestClient.SaveUnit(trainingsunit);
                }
                else if (radioButtonExisting.IsChecked == true)
                {
                    int id = (int)comboBoxUnits.SelectedValue;
                    parent = id;
                }
            }

            if (trainingRestClient.SaveExercise(GetExercise(parent)))
            {
                if (MessageBoxResult.OK == MessageBox.Show("Übung wurde erfolgreich gespeichert!"))
                {
                    var images = canvas.Children.OfType <Canvas>().ToList();
                    foreach (var image in images)
                    {
                        canvas.Children.Remove(image);
                    }
                    textboxName.Text      = "";
                    textboxProcedure.Text = "";
                    textboxType.Text      = "";
                }
            }
        }
示例#5
0
 public LibraryViewModel(User currentUser)
 {
     trainingRestClient = new TrainingRestClient(currentUser.Id);
     this.currentUser   = currentUser;
     Refresh();
 }