示例#1
0
        private void btn_activateaccount_clicked(object sender, EventArgs e)
        {
            if (Connectivity.NetworkAccess != NetworkAccess.Internet)
            {
                DisplayAlert("Fehler", "Bitte stellen sie sicher das sie mit dem Internet verbunden sind", "Ok");
                return;
            }

            if (txt_code.Text == null)
            {
                DisplayAlert("Fehler", "Bitte füllen sie alle Felder aus", "Ok");
                return;
            }

            switch (TCPCommandManager.ActivateAccount(int.Parse(txt_code.Text)))
            {
                case 201:
                    ControllPanelData.DownloadUserData();
                    Navigation.PushAsync(new JoinorCreateClassPage());
                    Navigation.RemovePage(this);
                    
                    return;
                case 202:
                    DisplayAlert("Fehler", "Dieser Code ist nicht Gültig", "Ok");
                    break;
                case 300:
                    DisplayAlert("Fehler", "Server Fehler bitte versuchen sie es Später erneut", "Ok");
                    break;
            }

        }
示例#2
0
        private void btn_login_clicked(object sender, EventArgs e)
        {
            if (Connectivity.NetworkAccess != NetworkAccess.Internet)
            {
                DisplayAlert("Login Fehlgeschlagen", "Bitte stellen sie sicher das sie mit dem Internet verbunden sind", "Ok");
                return;
            }

            if (txt_email.Text == null || txt_password.Text == null)
            {
                DisplayAlert("Login Fehlgeschlagen", "Bitte füllen sie bitte alle Felder aus", "Ok");
                return;
            }

            if (!Regex.Match(txt_email.Text, @"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$").Success)
            {
                DisplayAlert("Login Fehlgeschlagen", "Bitte geb eine Richtige Email Andresse an", "Ok");
                return;
            }

            if (TCPCommandManager.Login(txt_email.Text, txt_password.Text) == 201)
            {
                ControllPanelData.DownloadUserData();
                if (UserDataSafe.HasActivated)
                {
                    if (UserDataSafe.HasSelected)
                    {
                        Navigation.PushAsync(new ControllPanel());
                        Navigation.RemovePage(this);
                        return;
                    }
                    else
                    {
                        Navigation.PushAsync(new JoinorCreateClassPage());
                        Navigation.RemovePage(this);
                        return;
                    }
                }
                else
                {
                    Navigation.PushAsync(new ActivateAccount());
                    Navigation.RemovePage(this);
                    return;
                }
            }
            else
            {
                DisplayAlert("Anmeldeversuch Fehlgeschlagen", "Ihre E-Mail oder ihr Passwort ist falsch", "Ok");
                return;
            }
        }
示例#3
0
        public App()
        {
            InitializeComponent();

            MainPage = new NavigationPage(new LoginPage());


            if (email != null || password_hash != null)
            {
                if (TCPCommandManager.Login(email, password_hash) == 201)
                {
                    ControllPanelData.DownloadUserData();
                    if (UserDataSafe.HasActivated)
                    {
                        if (UserDataSafe.HasSelected)
                        {
                            MainPage = new NavigationPage(new ControllPanel());
                            return;
                        }
                        else
                        {
                            MainPage = new NavigationPage(new JoinorCreateClassPage());
                            return;
                        }
                    }
                    else
                    {
                        MainPage = new NavigationPage(new ActivateAccount());

                        return;
                    }
                }
                else
                {
                    MainPage = new NavigationPage(new LoginPage());
                }
            }
            else
            {
                MainPage = new NavigationPage(new LoginPage());
            }

            NavigationPage.SetHasNavigationBar(this, false);
        }
        private void RefreshData()
        {
            ControllPanelData.DownloadUserData();
            ControllPanelData.DownloadClassData();

            uebersicht_txt_Klassenname.Text  = ClassDataSafe.ClassName;
            uebersicht_txt_Beschreibung.Text = ClassDataSafe.Description;
            uebersicht_txt_Schule.Text       = ClassDataSafe.School;

            profil_txt_email.Text      = TCPCommandManager.getEMail();
            profil_txt_geschlecht.Text = UserDataSafe.Gender;
            profil_txt_vorname.Text    = UserDataSafe.Firstname;
            profil_txt_nachname.Text   = UserDataSafe.Lastname;

            if (ClassDataSafe.Stundenplan != "")
            {
                Stundenplan sp = JsonConvert.DeserializeObject <Stundenplan>(ClassDataSafe.Stundenplan);


                monday_1.Text = sp.stunden[0, 0];
                monday_2.Text = sp.stunden[0, 1];
                monday_3.Text = sp.stunden[0, 2];
                monday_4.Text = sp.stunden[0, 3];
                monday_5.Text = sp.stunden[0, 4];
                monday_6.Text = sp.stunden[0, 5];
                monday_7.Text = sp.stunden[0, 6];
                monday_8.Text = sp.stunden[0, 7];

                tuesday_1.Text = sp.stunden[1, 0];
                tuesday_2.Text = sp.stunden[1, 1];
                tuesday_3.Text = sp.stunden[1, 2];
                tuesday_4.Text = sp.stunden[1, 3];
                tuesday_5.Text = sp.stunden[1, 4];
                tuesday_6.Text = sp.stunden[1, 5];
                tuesday_7.Text = sp.stunden[1, 6];
                tuesday_8.Text = sp.stunden[1, 7];

                wednesday_1.Text = sp.stunden[2, 0];
                wednesday_2.Text = sp.stunden[2, 1];
                wednesday_3.Text = sp.stunden[2, 2];
                wednesday_4.Text = sp.stunden[2, 3];
                wednesday_5.Text = sp.stunden[2, 4];
                wednesday_6.Text = sp.stunden[2, 5];
                wednesday_7.Text = sp.stunden[2, 6];
                wednesday_8.Text = sp.stunden[2, 7];

                thursday_1.Text = sp.stunden[3, 0];
                thursday_2.Text = sp.stunden[3, 1];
                thursday_3.Text = sp.stunden[3, 2];
                thursday_4.Text = sp.stunden[3, 3];
                thursday_5.Text = sp.stunden[3, 4];
                thursday_6.Text = sp.stunden[3, 5];
                thursday_7.Text = sp.stunden[3, 6];
                thursday_8.Text = sp.stunden[3, 7];

                friday_1.Text = sp.stunden[4, 0];
                friday_2.Text = sp.stunden[4, 1];
                friday_3.Text = sp.stunden[4, 2];
                friday_4.Text = sp.stunden[4, 3];
                friday_5.Text = sp.stunden[4, 4];
                friday_6.Text = sp.stunden[4, 5];
                friday_7.Text = sp.stunden[4, 6];
                friday_8.Text = sp.stunden[4, 7];
            }

            aufgabenview.ItemsSource = null;

            aufgabenview.ItemsSource = ControllPanelData.Tasks;

            terminview.ItemsSource = null;

            terminview.ItemsSource = ControllPanelData.Termine;



            //

            if (ClassDataSafe.Creator.Equals(TCPCommandManager.EMAIL, StringComparison.InvariantCultureIgnoreCase) == false)
            {
                profil_btn_einladen.IsVisible = false;
                uebersicht_btn_klassendatenbearbeiten.IsVisible = false;
                uebersicht_btn_rechtebearbeiten.IsVisible       = false;

                if (ClassDataSafe.changeStundenplan == false)
                {
                    stundenplan_btn_edit.IsVisible = false;
                }

                if (ClassDataSafe.createAufgabe == false)
                {
                    btn_newTask.IsVisible = false;
                }

                if (ClassDataSafe.createTermin == false)
                {
                    btn_newTermin.IsVisible = false;
                }
            }
            else
            {
                profil_btn_einladen.IsVisible = true;
                uebersicht_btn_klassendatenbearbeiten.IsVisible = true;
                uebersicht_btn_rechtebearbeiten.IsVisible       = true;
                stundenplan_btn_edit.IsVisible = true;
                btn_newTask.IsVisible          = true;
                btn_newTermin.IsVisible        = true;
            }
        }