Inheritance: MonoBehaviour
        /// <summary>
        /// Perform the method
        /// </summary>
        /// <returns></returns>
        private async Task Login()
        {
            ErrorLabel.Visibility = Visibility.Hidden;
            SetFieldsEnabled(false);
            var credentials = new UsernameCredentials(UsernameField.Text, PasswordField.Password);
            var success     = false;

            try
            {
                success = await session.Authenticate(credentials);
            }
            catch (Session.BadRequestException e)
            {
                logger.LogWarning(e, "Bad login request");
            }
            if (!success)
            {
                ErrorLabel.Visibility = Visibility.Visible;
                ErrorLabel.Focus(); // Makes narrator read the error label
                SetFieldsEnabled(true);
            }
            else
            {
                _ = session.ApplyAllPreferences();
                Close();
            }
        }
Beispiel #2
0
        void ReleaseDesignerOutlets()
        {
            if (AgoraVersionLabel != null)
            {
                AgoraVersionLabel.Dispose();
                AgoraVersionLabel = null;
            }

            if (LoginButton != null)
            {
                LoginButton.Dispose();
                LoginButton = null;
            }

            if (UserNameEdit != null)
            {
                UserNameEdit.Dispose();
                UserNameEdit = null;
            }

            if (ErrorLabel != null)
            {
                ErrorLabel.Dispose();
                ErrorLabel = null;
            }
        }
Beispiel #3
0
        public void LoginButton_Click(object sender, EventArgs e)
        {
            string user = UsernameText.Text;
            string pass = PasswordText.Text;

            con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|/payroll_db.accdb");
            cmd = new OleDbCommand();
            con.Open();
            cmd.Connection  = con;
            cmd.CommandText = "SELECT * FROM login where username='******' AND password='******'";
            dr = cmd.ExecuteReader();
            if (dr.Read())
            {
                id = UsernameText.Text;

                new Form1().Show();
                Hide();
            }
            else
            {
                MessageBox.Show("Username or password is incorrect");
                ErrorLabel.Show();
            }

            con.Close();
        }
Beispiel #4
0
        private void RegistrarInputs()
        {
            nombreInput.DataBindings.Add(new TextBinding(this.Model, "Nombre"));
            Register(ErrorLabel.For(nombreInput, Alignment.Bottom, 2));

            telefonoInput.DataBindings.Add(new TextBinding(this.Model, "Telefono"));
            Register(ErrorLabel.For(telefonoInput, Alignment.Bottom, 2));

            mailInput.DataBindings.Add(new TextBinding(this.Model, "Mail"));
            Register(ErrorLabel.For(mailInput, Alignment.Bottom, 2));

            ciudadInput.DataBindings.Add(new TextBinding(this.Model, "Ciudad"));
            Register(ErrorLabel.For(ciudadInput, Alignment.Bottom, 2));

            calleInput.DataBindings.Add(new TextBinding(this.Model, "Calle"));
            Register(ErrorLabel.For(calleInput, Alignment.Bottom, 2));

            nroInput.DataBindings.Add(new TextBinding(this.Model, "NroCalle"));
            Register(ErrorLabel.For(nroInput, Alignment.Bottom, 2));

            cantidadEstrellasInput.DataBindings.Add(new Binding("Value", this.Model, "CantidadEstrellas"));

            paisCombo.DataSource = paises;
            paisCombo.DataBindings.Add(new Binding("SelectedValue", this.Model, "IdPais"));

            recEstrellasInput.DataBindings.Add(new TextBinding(this.Model, "RecargaEstrellas"));
            Register(ErrorLabel.For(recEstrellasInput, Alignment.Bottom, 2));

            FechaCreacionDtp.DataBindings.Add(new Binding("Value", this.Model, "FechaDeCreacion"));
        }
Beispiel #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            NavigationController.NavigationBarHidden = true;
            PasswordManagerButton.Hidden             = !ViewModel.IsPasswordManagerAvailable;

            UIKeyboard.Notifications.ObserveWillShow(KeyboardWillShow);
            UIKeyboard.Notifications.ObserveWillHide(KeyboardWillHide);

            //Text
            this.Bind(ViewModel.Email, EmailTextField.BindText());
            this.Bind(ViewModel.ErrorMessage, ErrorLabel.BindText());
            this.Bind(ViewModel.Password, PasswordTextField.BindText());
            this.Bind(EmailTextField.Text().Select(Email.From), ViewModel.SetEmail);
            this.Bind(PasswordTextField.Text().Select(Password.From), ViewModel.SetPassword);
            this.Bind(ViewModel.IsLoading.Select(loginButtonTitle), LoginButton.BindAnimatedTitle());

            //Visibility
            this.Bind(ViewModel.HasError, ErrorLabel.BindAnimatedIsVisible());
            this.Bind(ViewModel.IsLoading, ActivityIndicator.BindIsVisibleWithFade());
            this.Bind(ViewModel.IsPasswordMasked.Skip(1), PasswordTextField.BindSecureTextEntry());
            this.Bind(ViewModel.IsShowPasswordButtonVisible, ShowPasswordButton.BindIsVisible());
            this.Bind(PasswordTextField.FirstResponder, ViewModel.SetIsShowPasswordButtonVisible);

            //Commands
            this.Bind(SignupCard.Tapped(), ViewModel.Signup);
            this.BindVoid(LoginButton.Tapped(), ViewModel.Login);
            this.BindVoid(GoogleLoginButton.Tapped(), ViewModel.GoogleLogin);
            this.Bind(ForgotPasswordButton.Tapped(), ViewModel.ForgotPassword);
            this.Bind(PasswordManagerButton.Tapped(), ViewModel.StartPasswordManager);
            this.BindVoid(ShowPasswordButton.Tapped(), ViewModel.TogglePasswordVisibility);

            //Color
            this.Bind(ViewModel.HasError.Select(loginButtonTintColor), LoginButton.BindTintColor());
            this.Bind(ViewModel.LoginEnabled.Select(loginButtonTitleColor), LoginButton.BindTitleColor());

            //Animation
            this.Bind(ViewModel.Shake, shakeTargets =>
            {
                if (shakeTargets.HasFlag(LoginViewModel.ShakeTargets.Email))
                {
                    EmailTextField.Shake();
                }

                if (shakeTargets.HasFlag(LoginViewModel.ShakeTargets.Password))
                {
                    PasswordTextField.Shake();
                }
            });

            prepareViews();

            UIColor loginButtonTintColor(bool hasError)
            => hasError ? UIColor.White : UIColor.Black;

            UIColor loginButtonTitleColor(bool enabled) => enabled
                ? Color.Login.EnabledButtonColor.ToNativeColor()
                : Color.Login.DisabledButtonColor.ToNativeColor();
        }
        void ReleaseDesignerOutlets()
        {
            if (ErrorLabel != null)
            {
                ErrorLabel.Dispose();
                ErrorLabel = null;
            }

            if (LoginButton != null)
            {
                LoginButton.Dispose();
                LoginButton = null;
            }

            if (PasswordTextField != null)
            {
                PasswordTextField.Dispose();
                PasswordTextField = null;
            }

            if (RegisterButton != null)
            {
                RegisterButton.Dispose();
                RegisterButton = null;
            }

            if (UsernameTextField != null)
            {
                UsernameTextField.Dispose();
                UsernameTextField = null;
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ControlButtonsView != null)
            {
                ControlButtonsView.Dispose();
                ControlButtonsView = null;
            }

            if (EndCallButton != null)
            {
                EndCallButton.Dispose();
                EndCallButton = null;
            }

            if (JoinButton != null)
            {
                JoinButton.Dispose();
                JoinButton = null;
            }

            if (MuteButton != null)
            {
                MuteButton.Dispose();
                MuteButton = null;
            }

            if (ErrorLabel != null)
            {
                ErrorLabel.Dispose();
                ErrorLabel = null;
            }
        }
Beispiel #8
0
        public PersonForm()
            : base(model: new Person())
        {
            InitializeComponent();

            // Databind the Person.FirstName property to the FirstNameInput textbox
            FirstNameInput.DataBindings.Add(new TextBinding(this.Model, "FirstName"));
            Register(Label.For(FirstNameInput));
            Register(ErrorLabel.For(FirstNameInput));

            LastNameInput.DataBindings.Add(new TextBinding(this.Model, "LastName"));
            Register(Label.For(LastNameInput));
            Register(ErrorLabel.For(LastNameInput));

            //Works with ComboBoxes too!
            AgeInput.DataBindings.Add(new TextBinding(this.Model, "Age"));
            //Put the label to the right of the input control.
            Register(Label.For(AgeInput, Alignment.Right));
            //Put the validation message under the control, with a little extra padding.
            Register(ErrorLabel.For(AgeInput, Alignment.Bottom, ErrorLabel.DefaultPadding + 5));

            //Register HelloCommand

            this.SayHelloCmdButton.Command = new SayHelloCommand(this.Model as Person);
            this.SayHelloCmdButton.DataBindings.Add(new System.Windows.Forms.Binding("CommandParameter", this.LastNameInput, "Text"));
            //this.SayHelloCmdButton.CommandParameter = "Hola";
        }
Beispiel #9
0
        private void OnSaveCommand()
        {
            try
            {
                var keywords = Keywords.Where(e => e.KeywordID > 0)
                               .Select(e => e.KeywordID).Distinct().ToList();
                var newKeywords = Keywords.Where(e => e.KeywordID < 0)
                                  .Select(e => e.Name).Distinct().ToArray();

                Control.UpdateBindings();
                Entity.Summary = _summaryEditor.Value;

                KbContext.CurrentKb.ManagerKnowledge.Save(Entity, keywords, newKeywords);
                if (newKeywords.Length > 0)
                {
                    AppCore.Workspace.Keywords.Refresh();
                }

                OnSaved();
            }
            catch (ValidationException ex)
            {
                ErrorLabel.ShowException(Control, "Error save knowledge", ex);
            }
            catch (PermissionException ex)
            {
                Messages.ShowSecurityAlert(ex.Message, Entity.CategoryID);
            }
            catch (Exception ex)
            {
                ErrorForm.Show("Error save knowledge", ex);
            }
        }
Beispiel #10
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (InitBox.Text == "0" || InitBox.Text == " " || InitBox.Text == "" || InitBox.Text == null || NameBox.Text == "" || NameBox.Text == " " || NameBox.Text == null)
            {
                ErrorLabel.Text = "There was and invalid input. Try again";
            }
            else
            {
                ErrorLabel.ResetText();

                string init = InitBox.Text;
                float  number;
                bool   success = float.TryParse(init, out number);
                if (success == true)
                {
                    initiatives.Add(new Tuple <string, float>(NameBox.Text, number));
                    initiatives = initiatives.OrderByDescending(t => t.Item2).ToList();

                    WriteToList(initiatives);
                }
                else
                {
                    ErrorLabel.Text = "For some reason decimal , not .";
                }
            }
        }
        void ReleaseDesignerOutlets()
        {
            if (ErrorContainer != null)
            {
                ErrorContainer.Dispose();
                ErrorContainer = null;
            }

            if (ErrorLabel != null)
            {
                ErrorLabel.Dispose();
                ErrorLabel = null;
            }

            if (LoadingContainer != null)
            {
                LoadingContainer.Dispose();
                LoadingContainer = null;
            }

            if (LoadingLabel != null)
            {
                LoadingLabel.Dispose();
                LoadingLabel = null;
            }
        }
Beispiel #12
0
 private void UpdateWindow()
 {
     GoodsLabel.Invoke(new Action(() => GoodsLabel.Content     = Data.Goods));
     PremiumLabel.Invoke(new Action(() => PremiumLabel.Content = Data.Premium));
     SQLabel.Invoke(new Action(() => SQLabel.Content           = Data.SecretQuestion));
     GiftsLabel.Invoke(new Action(() => GiftsLabel.Content     = Data.Gifts));
     ErrorLabel.Invoke(new Action(() => ErrorLabel.Content     = Data.Errors));
 }
Beispiel #13
0
        private void RegistrarInputs()
        {
            usuarioInput.DataBindings.Add(new TextBinding(this.Model, "Nombre"));
            Register(ErrorLabel.For(usuarioInput, Alignment.Bottom, 2));

            contraseniaInput.DataBindings.Add(new TextBinding(this.Model, "Password"));
            Register(ErrorLabel.For(contraseniaInput, Alignment.Bottom, 2));
        }
        private async Task GiveFeedback(string messageString)
        {
            ErrorLabel.Text = messageString;
            await ErrorLabel.FadeTo(1.0, 500);

            await Task.Delay(2000);

            await ErrorLabel.FadeTo(0.0, 500);
        }
        private void regbtn1_Click(object sender, EventArgs e)
        {
            string regpnr       = pnrtextbox1.Text;
            string regfirstname = firstnametextbox1.Text;
            string reglastname  = lastnametextbox1.Text;
            string regpassword  = passwordtextbox1.Text;

            if (string.IsNullOrEmpty(regpnr) && string.IsNullOrEmpty(regfirstname) || string.IsNullOrEmpty(reglastname) || string.IsNullOrEmpty(regpassword))
            {
                ErrorLabel.ForeColor = System.Drawing.Color.Red;
                ErrorLabel.Text      = " Kontrollera att personnummer stämmer och att rutorna är ifyllda!";
                var t1 = new Timer();
                t1.Interval = 7000;
                t1.Tick    += (s, e1) =>
                {
                    ErrorLabel.Hide();
                    t1.Stop();
                };
                t1.Start();

                ErrorLabel.Show();
            }

            else
            {
                if (call.AddCustomer(Convert.ToString(regpnr), regfirstname, reglastname, regpassword))
                {
                    ErrorLabel.ForeColor = System.Drawing.Color.Green;
                    this.ErrorLabel.Text = "Konto skapat!";
                    //Registration reg = new Registration();
                    //this.Hide();
                }
                else
                {
                    ErrorLabel.ForeColor = System.Drawing.Color.Red;
                    ErrorLabel.Text      = "Personnummret finns redan, se till att det är rätt ifyllt! ";
                }
            }

            var t = new Timer();

            t.Interval = 7000;
            t.Tick    += (s, e1) =>
            {
                ErrorLabel.Hide();
                t.Stop();
            };
            t.Start();

            ErrorLabel.Show();

            pnrtextbox1.Clear();
            firstnametextbox1.Clear();
            lastnametextbox1.Clear();
            passwordtextbox1.Clear();
        }
Beispiel #16
0
 public static IControl Create(IValidatedProperty <string> value)
 {
     return(Layout.StackFromTop(
                TextBox.Create(value, foregroundColor: Theme.DefaultText)
                .WithHeight(20)
                .WithOverlay(Shapes.Rectangle(stroke: Theme.FieldStroke))
                .WithBackground(Theme.FieldBackground),                      // TODO Should show full path on mouse over if truncated?
                ErrorLabel.Create(value.ValidationError)
                ));
 }
Beispiel #17
0
        private void RegistrarInputs()
        {
            fechaInicioDtp.DataBindings.Add(new Binding("Text", this.Model, "FechaDesde"));
            Register(ErrorLabel.For(fechaInicioDtp, Alignment.Bottom, 2));

            fechaFinDtp.DataBindings.Add(new Binding("Text", this.Model, "FechaHasta"));
            Register(ErrorLabel.For(fechaFinDtp, Alignment.Bottom, 2));

            motivoInput.DataBindings.Add(new TextBinding(this.Model, "Motivo"));
            Register(ErrorLabel.For(motivoInput, Alignment.Bottom, 2));
        }
Beispiel #18
0
 private void ResetButton_Click(object sender, EventArgs e)
 {
     //Clear all fields and set everything back to default.
     CurrencyToSelector.SelectedIndex   = 0;
     CurrencyToSelector.ForeColor       = Color.Black;
     CurrencyFromSelector.SelectedIndex = 0;
     CurrencyFromSelector.ForeColor     = Color.Black;
     ConversionInput.Text = "";
     ErrorLabel.Text      = "";
     ErrorLabel.Hide();
     ResultLabel.Text = "";
 }
        private void ChangeCashDispenserStateButton_Click(object sender, EventArgs e)
        {
            // Connect with database
            try
            {
                if (this.ChangeCashDispenserValueValueTextBox.TextLength == 0)
                {
                    ErrorLabel.Show();
                    ErrorLabel.Text = "Niedozwolona Wartość Kwoty";
                    throw new Exception();
                }

                MockPhysicalMoneyRepository mockPhysicalMoneyRepository = new
                                                                          MockPhysicalMoneyRepository(SystemSettings._PlatformType);

                // Update cash dispenser state
                mockPhysicalMoneyRepository.UpdateInCurrency(
                    currencyRate: CashWithdrawalProperties.exchangeRates.PLN_exchangeRate,
                    physicalMoneyVAL: new PhysicalMoneyVAL(
                        value: decimal.Parse(this.ChangeCashDispenserValueValueTextBox.Text,
                                             CultureInfo.InvariantCulture), currency: Currency.PLN));

                // Redirect to administrator change cash dispenser state result panel
                AdministratorChangeCashDispenserStateResultPanel
                    administratorChangeCashDispenserStateResultPanel = new
                                                                       AdministratorChangeCashDispenserStateResultPanel();

                administratorChangeCashDispenserStateResultPanel.ShowDialog();

                // Update local cash dispenser state
                this.cashDispenserStateInPln =
                    mockPhysicalMoneyRepository.GetInCurrency(
                        currencyRate: CashWithdrawalProperties
                        .exchangeRates.PLN_exchangeRate, currency: Currency.PLN)._Value;

                // Show cash dispenser state after change
                this.CashDispenserStateValueLabel.Text =
                    (String.Format("{0:0.00}", this.cashDispenserStateInPln));
            }
            catch (MockPhysicalMoneyRepository_Exception mpmr_e)
            {
                this.ErrorLabel.Text = mpmr_e.What();
                this.ErrorLabel.Show();
            }
            catch (PhysicalMoneyVAL_Exception pm_e)
            {
                this.ErrorLabel.Text = pm_e.What();
                this.ErrorLabel.Show();
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #20
0
        public void RegistrarInputs()
        {
            RefreshFuncionalidadesData();

            nombreInput.DataBindings.Add(new TextBinding(this.Model, "Nombre"));
            Register(ErrorLabel.For(nombreInput, Alignment.Bottom, 2));

            this.funcionalidadesCombo.DataSource = funcionalidades;

            funcionalidadesGrid.AutoGenerateColumns = false;
            funcionalidadesGrid.DataSource          = Rol.Funcionalidades;
        }
Beispiel #21
0
        private void RegistrarInputs()
        {
            trimestreInput.DataBindings.Add(new TextBinding(this.Model, "Trimestre"));
            Register(ErrorLabel.For(trimestreInput, Alignment.Bottom, 2));


            top5Input.DataBindings.Add(new TextBinding(this.Model, "Top5De"));
            Register(ErrorLabel.For(top5Input, Alignment.Bottom, 2));


            anioInput.DataBindings.Add(new TextBinding(this.Model, "Anio"));
            Register(ErrorLabel.For(anioInput, Alignment.Bottom, 2));
        }
Beispiel #22
0
 private void LoginButton_Click(object sender, EventArgs e)
 {
     if (UsernameText.Text == "iTecCrawley" && PasswordText.Text == "admin")
     {
         Form1 form = new Payroll.Form1();
         form.Show();
         this.Hide();
     }
     else
     {
         ErrorLabel.Show();
     }
 }
Beispiel #23
0
 void ReleaseDesignerOutlets()
 {
     if (ErrorLabel != null)
     {
         ErrorLabel.Dispose();
         ErrorLabel = null;
     }
     if (TextField != null)
     {
         TextField.Dispose();
         TextField = null;
     }
 }
Beispiel #24
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     // Checks whether or not a valid name has been entered.
     if (!string.IsNullOrWhiteSpace(NameText.Text))
     {
         Response = NameText.Text;
         // Sets the DialogResult of this Dialog window to "OK", meaning the parent form of this form will know that something has occured.
         DialogResult = System.Windows.Forms.DialogResult.OK;
         // Closes the form.
         Close();
     }
     // If a valid name hasn't been entered, display an error message stating that a valid name must be entered.
     ErrorLabel.Show();
 }
Beispiel #25
0
        void ReleaseDesignerOutlets()
        {
            if (ErrorLabel != null)
            {
                ErrorLabel.Dispose();
                ErrorLabel = null;
            }

            if (LottieView != null)
            {
                LottieView.Dispose();
                LottieView = null;
            }
        }
Beispiel #26
0
        void ReleaseDesignerOutlets()
        {
            if (ActivityIndicator != null)
            {
                ActivityIndicator.Dispose();
                ActivityIndicator = null;
            }

            if (DoneCard != null)
            {
                DoneCard.Dispose();
                DoneCard = null;
            }

            if (EmailTextField != null)
            {
                EmailTextField.Dispose();
                EmailTextField = null;
            }

            if (ErrorLabel != null)
            {
                ErrorLabel.Dispose();
                ErrorLabel = null;
            }

            if (ResetPasswordButton != null)
            {
                ResetPasswordButton.Dispose();
                ResetPasswordButton = null;
            }

            if (ResetPasswordButtonBottomConstraint != null)
            {
                ResetPasswordButtonBottomConstraint.Dispose();
                ResetPasswordButtonBottomConstraint = null;
            }

            if (TopConstraint != null)
            {
                TopConstraint.Dispose();
                TopConstraint = null;
            }

            if (SuccessMessageLabel != null)
            {
                SuccessMessageLabel.Dispose();
                SuccessMessageLabel = null;
            }
        }
Beispiel #27
0
        void ReleaseDesignerOutlets()
        {
            if (EmailLabel != null)
            {
                EmailLabel.Dispose();
                EmailLabel = null;
            }

            if (ActivityIndicatorView != null)
            {
                ActivityIndicatorView.Dispose();
                ActivityIndicatorView = null;
            }

            if (BottomConstraint != null)
            {
                BottomConstraint.Dispose();
                BottomConstraint = null;
            }

            if (ErrorLabel != null)
            {
                ErrorLabel.Dispose();
                ErrorLabel = null;
            }

            if (ErrorView != null)
            {
                ErrorView.Dispose();
                ErrorView = null;
            }

            if (PasswordTextField != null)
            {
                PasswordTextField.Dispose();
                PasswordTextField = null;
            }

            if (ShowPasswordButton != null)
            {
                ShowPasswordButton.Dispose();
                ShowPasswordButton = null;
            }

            if (SignOutButton != null)
            {
                SignOutButton.Dispose();
                SignOutButton = null;
            }
        }
Beispiel #28
0
        void ReleaseDesignerOutlets()
        {
            if (ActivityIndicator != null)
            {
                ActivityIndicator.Dispose();
                ActivityIndicator = null;
            }

            if (BottomConstraint != null)
            {
                BottomConstraint.Dispose();
                BottomConstraint = null;
            }

            if (EmailTextField != null)
            {
                EmailTextField.Dispose();
                EmailTextField = null;
            }

            if (ErrorLabel != null)
            {
                ErrorLabel.Dispose();
                ErrorLabel = null;
            }

            if (ForgotPasswordButton != null)
            {
                ForgotPasswordButton.Dispose();
                ForgotPasswordButton = null;
            }

            if (PasswordManagerButton != null)
            {
                PasswordManagerButton.Dispose();
                PasswordManagerButton = null;
            }

            if (PasswordTextField != null)
            {
                PasswordTextField.Dispose();
                PasswordTextField = null;
            }

            if (ShowPasswordButton != null)
            {
                ShowPasswordButton.Dispose();
                ShowPasswordButton = null;
            }
        }
        private void RegisterButton_Click(object sender, EventArgs e)
        {
            if (IDTextField.Text != "" && NameTextField.Text != "" && UsernameTextField.Text != "" && PasswordField.Text != "" && CPasswordField.Text != "")
            {
                if (PasswordField.Text.Equals(CPasswordField.Text))
                {
                    using (SqlCommand cmd = new SqlCommand("AddAdmin_SP", con))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        cmd.Parameters.AddWithValue("@id", IDTextField.Text);
                        cmd.Parameters.AddWithValue("@name", NameTextField.Text);
                        cmd.Parameters.AddWithValue("@username", UsernameTextField.Text);
                        cmd.Parameters.AddWithValue("@password", PasswordField.Text);
                        cmd.Parameters.AddWithValue("@phone", PhoneTextField.Text);

                        con.Open();
                        try
                        {
                            cmd.ExecuteNonQuery();
                            MessageBox.Show("Successfully registered - your username is :" + UsernameTextField.Text);
                            IDTextField.Text       = "";
                            NameTextField.Text     = "";
                            UsernameTextField.Text = "";
                            PasswordField.Text     = "";
                            CPasswordField.Text    = "";
                            PhoneTextField.Text    = "";
                        }
                        catch (Exception z)
                        {
                            ErrorLabel.Text = "Error occured!";
                            ErrorLabel.Show();
                            MessageBox.Show("" + z);
                        }
                        con.Close();
                    }
                }
                else
                {
                    ErrorLabel.Text = "Passwords do not match!";
                    ErrorLabel.Show();
                }
            }
            else
            {
                ErrorLabel.Text = "Values cannot be empty!";
                ErrorLabel.Show();
            }
            GC.Collect();
        }
Beispiel #30
0
        private void ConvertButton_Click(object sender, EventArgs e)
        {
            //Make sure we can actually convert, and set the error label if not.
            if (CurrencyFromSelector.SelectedIndex == 0)
            {
                //No Currency Selected in the 'From' field.
                CurrencyFromSelector.ForeColor = Color.Red;
                ErrorLabel.Text = "Error: No currency selected to convert from.";
                ErrorLabel.Show();
            }
            else if (CurrencyToSelector.SelectedIndex == 0)
            {
                //No Currency Seleceted int the 'To' field.
                CurrencyToSelector.ForeColor = Color.Red;
                ErrorLabel.Text = "Error: No currency selected to convert to.";
                ErrorLabel.Show();
            }
            else
            {
                //Nothing wrong with the currency combo boxes, hide any error currently showing.
                ErrorLabel.Hide();

                //Put the input into a string so we can remove any currency symbols the user might of entered.
                string userInput = ConversionInput.Text;
                if (userInput.Contains('$'))
                {
                    userInput = userInput.Replace("$", "");
                }
                else if (userInput.Contains('£'))
                {
                    userInput = userInput.Replace("£", "");
                }
                else if (userInput.Contains("€"))
                {
                    userInput = userInput.Replace("€", "");
                }

                try {
                    /* Attempt to convert the string to a double. If it fails, the user has entered something other than a number.
                     * I am not producing an error for negative amounts, in case someone wants to work out their debt in another currency. ¯\_(ツ)_/¯
                     */
                    double userAmount = Double.Parse(userInput);
                    Convert(userAmount, CurrencyFromSelector.GetItemText(CurrencyFromSelector.SelectedItem), CurrencyToSelector.GetItemText(CurrencyToSelector.SelectedItem));
                } catch {
                    //Input wasn't a number, or had extra characters in it, show an error and let the user try again.
                    ErrorLabel.Text = "Error: Amount Entered was not a valid number";
                    ErrorLabel.Show();
                }
            }
        }
Beispiel #31
0
    // Use this for initialization
    void Start()
    {
        gs = GetComponent<GeneralScript>();
        error = GetComponent<ErrorLabel>();
        popin = false;
        popout = false;
        activeModule = true;
        posBaseCameraSong = camerasong.transform.position;
        startnumber = 0;
        currentstartnumber = 0;
        customSearch = false;
        packLocked = "null";

        songCubePack = new Dictionary<GameObject, string>();

        createCubeSong();

        locked = false;

        search = "";
        searchOldValue = "";
        songList = new Dictionary<string, Dictionary<Difficulty, Song>>();

        activeSongList(gs.getZonePack().getActivePack());

        if(DataManager.Instance.mousePosition != -1){
            startnumber = DataManager.Instance.mousePosition;
            currentstartnumber = startnumber;
        }
    }
    void Start()
    {
        numberPack = 0;
        nextnumberPack = 0;
        startnumber = 0;
        currentstartnumber = 0;
        timeFade = 0f;
        packs = new Dictionary<string, GameObject>();
        cubesPos = new Dictionary<GameObject, float>();
        songCubePack = new Dictionary<GameObject, string>();
        LinkCubeSong = new Dictionary<GameObject, string>();
        customSongCubePack = new Dictionary<GameObject, string>();
        customLinkCubeSong = new Dictionary<GameObject, string>();
        diffSelected = new Dictionary<Difficulty, GameObject>();
        diffActiveColor = new Dictionary<Difficulty, Color>();
        PSDiff = new Dictionary<int, ParticleSystem>();
        RayDiff = new Dictionary<int, GameObject>();
        if(!LoadManager.Instance.alreadyLoaded) ProfileManager.Instance.CreateTestProfile();
        if(!LoadManager.Instance.alreadyLoaded) TextManager.Instance.LoadTextFile();
        if(!LoadManager.Instance.alreadyLoaded) LoadManager.Instance.Loading();
        error = GetComponent<ErrorLabel>();

        actualBanner = new Texture2D(256,512);

        tex = new Dictionary<string, Texture2D>();
        tex.Add("BEGINNER", (Texture2D) Resources.Load("beginner"));
        tex.Add("EASY", (Texture2D) Resources.Load("easy"));
        tex.Add("MEDIUM", (Texture2D) Resources.Load("medium"));
        tex.Add("HARD", (Texture2D) Resources.Load("hard"));
        tex.Add("EXPERT", (Texture2D) Resources.Load("expert"));
        tex.Add("EDIT", (Texture2D) Resources.Load("edit"));
        tex.Add("graph", (Texture2D) Resources.Load("graph"));
        tex.Add("bouton", (Texture2D) Resources.Load("Button"));
        tex.Add("Option1", (Texture2D) Resources.Load("Speedmod"));
        tex.Add("Option2", (Texture2D) Resources.Load("Rate"));
        tex.Add("Option3", (Texture2D) Resources.Load("Skin"));
        tex.Add("Option4", (Texture2D) Resources.Load("HitJudge"));
        tex.Add("Option5", (Texture2D) Resources.Load("ScoreJudge"));
        tex.Add("Option6", (Texture2D) Resources.Load("LifeJudge"));
        tex.Add("Option7", (Texture2D) Resources.Load("Display"));
        tex.Add("Option8", (Texture2D) Resources.Load("Race"));
        tex.Add("Option9", (Texture2D) Resources.Load("Death"));
        tex.Add("Black", (Texture2D) Resources.Load("black"));

        tex.Add("Failed", (Texture2D) Resources.Load("Fail"));
        tex.Add("BAD", (Texture2D) Resources.Load("NoteBAD"));
        tex.Add("C", (Texture2D) Resources.Load("NoteC"));
        tex.Add("B", (Texture2D) Resources.Load("NoteB"));
        tex.Add("A", (Texture2D) Resources.Load("NoteA"));
        tex.Add("S", (Texture2D) Resources.Load("NoteS"));

        diffSelected.Add(Difficulty.BEGINNER, GameObject.Find("DifficultyB"));
        diffSelected.Add(Difficulty.EASY, GameObject.Find("DifficultyEs"));
        diffSelected.Add(Difficulty.MEDIUM, GameObject.Find("DifficultyM"));
        diffSelected.Add(Difficulty.HARD, GameObject.Find("DifficultyH"));
        diffSelected.Add(Difficulty.EXPERT, GameObject.Find("DifficultyEx"));
        diffSelected.Add(Difficulty.EDIT, GameObject.Find("DifficultyEd"));

        diffActiveColor.Add(Difficulty.BEGINNER, diffSelected[Difficulty.BEGINNER].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.EASY, diffSelected[Difficulty.EASY].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.MEDIUM, diffSelected[Difficulty.MEDIUM].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.HARD, diffSelected[Difficulty.HARD].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.EXPERT, diffSelected[Difficulty.EXPERT].transform.GetChild(0).renderer.material.GetColor("_TintColor"));
        diffActiveColor.Add(Difficulty.EDIT, diffSelected[Difficulty.EDIT].transform.GetChild(0).renderer.material.GetColor("_TintColor"));

        for(int i=0; i<6;i++){
            PSDiff.Add(i, (ParticleSystem) PSCore.transform.FindChild(""+i).particleSystem);
        }

        for(int i=0; i<6;i++){
            RayDiff.Add(i, (GameObject) RayCore.transform.FindChild(""+i).gameObject);
        }

        //To do : correct "KeyAlreadyAssign"
        var tempPos = new Dictionary<GameObject, float>();
        var tempPack = new Dictionary<string, GameObject>();
        var position = 0;
        var thePackPosition = -1;
        foreach(var el in LoadManager.Instance.ListSong().Keys){
            var thego = (GameObject) Instantiate(miniCubePack, new Vector3(0f, 13f, 20f), miniCubePack.transform.rotation);
            thego.SetActive(true);
            if(LoadManager.Instance.ListTexture().ContainsKey(el)) thego.renderer.material.mainTexture = LoadManager.Instance.ListTexture()[el];
            if(tempPack.ContainsKey(el)){
                tempPack.Add(el + "(" + tempPack.Count + ")", thego);
                if(el + "(" + tempPack.Count + ")" == DataManager.Instance.packSelected) thePackPosition = position;
            }
            else
            {
                tempPack.Add(el, thego);
                if(el == DataManager.Instance.packSelected) thePackPosition = position;
            }
            tempPos.Add(thego, 0f);
            position++;
        }

        if(DataManager.Instance.packSelected != "" && thePackPosition != -1){
            for(int i=thePackPosition;i<tempPos.Count;i++){
                cubesPos.Add(tempPos.ElementAt(i).Key, tempPos.ElementAt(i).Value);
                packs.Add(tempPack.ElementAt(i).Key, tempPack.ElementAt(i).Value);
            }
            for(int i=0;i<thePackPosition;i++){
                cubesPos.Add(tempPos.ElementAt(i).Key, tempPos.ElementAt(i).Value);
                packs.Add(tempPack.ElementAt(i).Key, tempPack.ElementAt(i).Value);
            }
        }else{
            for(int i=0;i<tempPos.Count;i++){
                cubesPos.Add(tempPos.ElementAt(i).Key, tempPos.ElementAt(i).Value);
                packs.Add(tempPack.ElementAt(i).Key, tempPack.ElementAt(i).Value);
            }
        }

        organiseCube();
        createCubeSong();
        desactiveDiff();
        activePack(packs.ElementAt(0).Key);
        plane.renderer.material.mainTexture = LoadManager.Instance.ListTexture()[packs.ElementAt(0).Key];
        diffNumber = new int[6];
        actualClip = new AudioClip();
        for(int i=0;i<6; i++){ diffNumber[i] = 0; }
        decalFade = 0f;
        decalFadeM = 0f;
        fadeAlpha = 0f;
        posLabel = 0f;
        time = 0f;
        alphaBanner = 1f;
        totalAlpha = 0f;
        alphaBlack = 0f;

        alphaSongLaunch = new float[6];
        for(int i=0;i<6; i++){ alphaSongLaunch[i] = 0f; }
        alreadyRefresh = true;
        FadeOutBanner = false;
        FadeInBanner = false;
        graph.enabled = false;
        movinOption = false;
        OptionMode = false;
        SongMode = false;
        movinSong = false;
        locked = false;
        fadedOut = false;
        displayLoading = false;

        animok = true;
        speedmodok = true;
        rateok = true;

        textButton = "Option";
        matCache = cacheOption.renderer.material;
        fadeAlphaOptionTitle = 1f;
        stateLoading = new bool[9];
        displaySelected = new bool[DataManager.Instance.aDisplay.Length];
        for(int i=0;i<stateLoading.Length-1;i++) stateLoading[i] = false;
        for(int j=0;j<DataManager.Instance.aDisplay.Length;j++) displaySelected[j] = DataManager.Instance.songSelected != null ? DataManager.Instance.displaySelected[j] : false;

        if(!String.IsNullOrEmpty(ProfileManager.Instance.currentProfile.lastSpeedmodUsed)){
            speedmodstring = ProfileManager.Instance.currentProfile.lastSpeedmodUsed;
            speedmodSelected = (float)System.Convert.ToDouble(ProfileManager.Instance.currentProfile.lastSpeedmodUsed);
        }else{
            speedmodSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.speedmodSelected : 2f;
            speedmodstring = speedmodSelected.ToString("0.00");
        }

        if(DataManager.Instance.songSelected != null){
            var bpmtotest = DataManager.Instance.songSelected.bpmToDisplay;
            if(bpmtotest.Contains("->")){
                bpmstring = (System.Convert.ToDouble(System.Convert.ToDouble(bpmtotest.Replace(">", "").Split('-')[DataManager.Instance.BPMChoiceMode])*speedmodSelected)).ToString("0");
            }else{
                bpmstring = (System.Convert.ToDouble(bpmtotest)*speedmodSelected).ToString("0");
            }
        }else{
            bpmstring = String.IsNullOrEmpty(ProfileManager.Instance.currentProfile.lastBPM) ? "300" : ProfileManager.Instance.currentProfile.lastBPM;
        }
        DataManager.Instance.BPMEntryMode = ProfileManager.Instance.currentProfile.inBPMMode;

        rateSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.rateSelected : 0f;
        scoreJudgeSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.scoreJudgeSelected : Judge.NORMAL;
        hitJudgeSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.hitJudgeSelected : Judge.NORMAL;
        lifeJudgeSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.lifeJudgeSelected : Judge.NORMAL;
        skinSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.skinSelected : 0;
        raceSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.raceSelected : 0;
        deathSelected = DataManager.Instance.songSelected != null ? DataManager.Instance.deathSelected :0;

        ratestring = rateSelected.ToString("00");

        alphaText = new float[stateLoading.Length];
        isFading = new bool[stateLoading.Length];
        alphaDisplay = new float[stateLoading.Length];
        isFadingDisplay = new bool[stateLoading.Length];
        offsetFading = new float[stateLoading.Length];
        offsetPreviousFading = new float[stateLoading.Length];
        for(int i=0;i<stateLoading.Length;i++) offsetFading[i] = 0f;
        for(int i=0;i<stateLoading.Length;i++) offsetPreviousFading[i] = 0f;
        for(int i=0;i<stateLoading.Length;i++) isFading[i] = false;
        for(int i=0;i<stateLoading.Length;i++) alphaText[i] = 1f;
        for(int i=0;i<stateLoading.Length;i++) isFadingDisplay[i] = false;
        for(int i=0;i<stateLoading.Length;i++) alphaDisplay[i] = displaySelected[i] ? 1f : 0f;

        search = "";
        searchOldValue = "";
        songList = new Dictionary<string, Dictionary<Difficulty, Song>>();

        alreadyFade = false;

        actualySelected =  DataManager.Instance.difficultySelected;
        trulySelected = DataManager.Instance.difficultySelected;
        onHoverDifficulty = Difficulty.NONE;

        if(DataManager.Instance.mousePosition != -1){
            startnumber = DataManager.Instance.mousePosition;
            currentstartnumber = startnumber;
        }

        basePosCubeBase = new Vector3(cubeBase.transform.position.x, 5f, cubeBase.transform.position.z);
        cubeBase.transform.position = new Vector3(basePosCubeBase.x, basePosCubeBase.y - (3f*startnumber), basePosCubeBase.z);

        //quickMode
        if(DataManager.Instance.quickMode){
            speedMoveOption = 0.01f;
            speedMoveSong = 0.01f;
            speedAlphaSongLaunch = 0.1f;
            speedAlphaBlack = 0.1f;
            timeOption = 0.02f;
        }
    }