Exemple #1
0
    //This function updates the text displaying the number of objects we've collected and displays our victory message if we've collected all of them.
    public static void SetText(TextName textName, string textMessage)//表示するテキストオブジェクト、表示するメッセージ
    {
        switch (textName)
        {
        case TextName.count:
            textObject = countText;
            break;

        case TextName.time:
            textObject = timeText;
            break;

        case TextName.win:
            textObject = winText;
            break;

        case TextName.lose:
            textObject = loseText;
            break;

        case TextName.gameover:
            textObject = gameoverText;
            break;
        }

        //Set the text property of our our countText object to "Count: " followed by the number stored in our count variable.
        textObject.text = textMessage;

        /*
         * //Check if we've collected all 12 pickups. If we have...
         * if (GameManager.playstate == GameManager.PlayState.Clear)
         *  //... then set the text property of our winText object to "You win!"
         *  winText.text = "You win!";
         */
    }
        private void Window_Closing(object sender, CancelEventArgs e)
        {
            TextName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            TextDescricao.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            TextVagas.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            TextBolsa.GetBindingExpression(TextBox.TextProperty).UpdateSource();

            //ListBoxDestino.GetBindingExpression(ListBox.SelectedItemProperty).UpdateSource();
            //ListBoxEntidade.GetBindingExpression(ListBox.SelectedItemProperty).UpdateSource();

            StartDate.GetBindingExpression(DatePicker.SelectedDateProperty).UpdateSource();
            EndDate.GetBindingExpression(DatePicker.SelectedDateProperty).UpdateSource();

            TextVagas.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            TextBolsa.GetBindingExpression(TextBox.TextProperty).UpdateSource();

            string message;

            if (this.DialogResult == true && FormHasErrors(out message))
            {
                // Errors still exist.
                MessageBox.Show(message);

                e.Cancel = true;
            }
        }
Exemple #3
0
        /// <summary>
        /// Fetches strings for the input <see cref="TextName"/>.
        /// </summary>
        /// <param name="text">Text file to fetch</param>
        /// <returns>Array of strings from the requested text file.</returns>
        public string[] GetStrings(TextName text)
        {
            var arc   = this[GameFile.GameText];
            var lines = Text.GetStrings(text, arc);

            return(lines);
        }
Exemple #4
0
        internal string[] GetStrings(TextName file, IFileContainer textFile, bool remap = false)
        {
            if (Cache.TryGetValue(file, out var container))
            {
                return(container);
            }

            var info = References.FirstOrDefault(f => f.Name == file);

            if (info == null)
            {
                throw new ArgumentException($"Unknown {nameof(TextName)} provided.", file.ToString());
            }

            byte[] data;
            string path = info.FileName;

            if (!string.IsNullOrWhiteSpace(path) && textFile is FolderContainer c)
            {
                data = c.GetFileData(info.FileName);
            }
            else
            {
                data = textFile[info.Index];
            }

            var lines = GetStrings(data, remap);

            Cache.Add(file, lines);
            return(lines);
        }
    private void SetSettings()
    {
        //Номер уровня - мод+уровень
        int getLevel = BaseProfile.Instance.GetLevels(int.Parse(BaseProfile.Instance.CurrentMode.ToString() + NumberLevel));

        if (getLevel == 0)             //Уровень не открыт
        {
            Lock.SetActive(true);      //Открыть замок
            Record.SetActive(false);   //Скрыть рекорд
            TextName.SetActive(false); //Скрыть номер уровня
            for (int i = 0; i < Stars.Length; i++)
            {
                Stars[i].SetActive(false);                  //Скрыть звезды
            }
        }
        else//Уровень открыт
        {
            gameObject.GetComponent <Button>().onClick.AddListener(Click);

            Lock.SetActive(false);                                            //Скрыть замок
            Record.SetActive(isVisibleRecord);                                //Если уровень isVisibleRecord

            int numberStar = BaseProfile.Instance.GetLevelStars(NumberLevel); //Проверяем сколько звезд у уровня
            if (isVisibleStars)
            {
                for (int i = 0; i < Stars.Length; i++)
                {
                    Stars[i].GetComponent <Image>().sprite = numberStar > i ? StarsOn : StarsOff;
                }
            }
        }
    }
 public void Clear()
 {
     TextName.Clear();
     NumBag.Value     = 0;
     NumYellow.Value  = 0;
     NumEternal.Value = 0;
     NumMythic.Value  = 0;
 }
 private void BtnUserAdd_Click(object sender, EventArgs e)
 {
     Person p = new Person(TextName.Text, TextVorname.Text, TextEmail.Text);
     TextName.Clear();
     TextVorname.Clear();
     TextVorname.Clear();
     TextEmail.Clear();
     xmldata.persons.Add(p);
     personBindingSource.Add(p);
 }
 //对话框载入
 private void EmployeeForm_Load(object sender, EventArgs e)
 {
     if (!newDepartment)
     {
         TextName.Text = m_Department.name;
         TextNote.Text = m_Department.note;
         TextName.SelectAll();
         TextName.Focus();
     }
 }
        private void btnJoin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TextName.Text) || string.IsNullOrEmpty(TextEmail.Text) || string.IsNullOrEmpty(TextPassword.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "All field should be filled up.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                TextName.Focus();
                return;
            }
            else
            {
                if (UserServices.DuplicateMail(TextEmail.Text))
                {
                    MetroFramework.MetroMessageBox.Show(this, "Mail Already Existed.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                User u = new User();

                if (TextName.Text.Length <= 50 && TextEmail.Text.Length <= 50 && TextPassword.Text.Length <= 50)
                {
                    u.name = TextName.Text;

                    if (IsValidEmail(TextEmail.Text))
                    {
                        u.email = TextEmail.Text;
                    }
                    else
                    {
                        MetroFramework.MetroMessageBox.Show(this, "Invalid mail.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    u.password = TextPassword.Text;
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Name, Password or Email is Too Big.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                if (pictureBox.Image != null)
                {
                    u.picture = imageToByteArray(pictureBox.Image);
                }

                else
                {
                    u.picture = null;
                }

                UserServices.Insert(u);
                MetroFramework.MetroMessageBox.Show(this, "Joined successfully.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Hide();
            }
        }
Exemple #10
0
 private void AddButton(object sender, RoutedEventArgs e)
 {
     ProgramPersons.Add(new Person());
     PeopleList.SelectedIndex = ProgramPersons.Count - 1;
     TextName.Text            = "Name";
     TextSalary.Text          = "0";
     TextAge.Text             = "0";
     TextName.SelectAll();
     TextSalary.SelectAll();
     TextAge.SelectAll();
     TextName.Focus();
 }
    static public string getText(TextName textName)
    {
        if (textName == TextName.TakeController)
        {
            return("Wait for the experimenter to give you the controller.\n\nWhen it is done, press the button A.");
        }
        if (textName == TextName.PD_Explanation)
        {
            return("Please put your index immobile on the table in front of you.\n\n After pressing A, a moving panel will appear, displace it with the joystick to align it with your index extremity and press A.");
        }
        if (textName == TextName.Over)
        {
            return("The experiment is Over, thank you for your participation.");
        }
        if (textName == TextName.Break)
        {
            return("You can take a short break.\n" +
                   "Put the controller on the blue circle, then you can remove the headset.");
        }
        if (textName == TextName.VisuoMotor)
        {
            return("The next samples will be under \"Visuo-motor condition\". \n\nYou will only have the right to move your hands, please don't bring your hands close to each other.");
        }
        if (textName == TextName.SelfTouch)
        {
            return("The next samples will be under \"Self-touch condition\". \n\nDuring those samples, a path will be indicated on your left hand, please follow this path with your right index.");
        }
        if (textName == TextName.Task0 || textName == TextName.Task1 || textName == TextName.Task2 || textName == TextName.Task3)
        {
            int transformation = int.Parse(textName.ToString()[4].ToString());

            return("Your left hand will be embodied into a " + transformationName[transformation] + ".\n\n Please put the controller on the blue circle and wait the embodiement start.");
        }
        if (textName == TextName.TaskVM)
        {
            return("You can move your hands freely, please refrain from bringging your hands close to each other.");
        }
        if (textName == TextName.TaskST)
        {
            return("Please follow the path indicated on your left hand with your right index.\n\nWhen the path is completed, spread your hands to reveal the next one.");
        }
        ;

        return("");
    }
Exemple #12
0
        private void New()
        {
            if (string.IsNullOrEmpty(TextName.Text))
            {
                MessageBox.Show("请输入温度类型名称");
                TextName.Focus();
                return;
            }

            Temperature = new Sys_Temperature()
            {
                IsSystem   = (Yqun.Common.ContextCache.ApplicationContext.Current.IsAdministrator && CheckIsSystem.Checked) ? 1 : 0,
                Name       = TextName.Text,
                CreateBy   = Yqun.Common.ContextCache.ApplicationContext.Current.UserName,
                CreateTime = DateTime.Now.ToString("yyyy-MM-dd hh:MM:ss"),
            };

            if (Yqun.Common.ContextCache.ApplicationContext.Current.IsAdministrator)
            {
                if (string.IsNullOrEmpty(TestRoomCode))
                {
                    Temperature.TestRoomCode = "0000000000000000";
                }
                else
                {
                    Temperature.TestRoomCode = TestRoomCode;
                }
            }
            else
            {
                Temperature.TestRoomCode = Yqun.Common.ContextCache.ApplicationContext.Current.InTestRoom.Code;
            }

            var result = TemperatureHelperClient.NewTemperature(Temperature);

            if (string.IsNullOrEmpty(result))
            {
                MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show(result, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #13
0
 private async void ButtonEdit_Clicked(object sender, EventArgs e)
 {
     FieldsAreReadOnly = false;
     OnPropertyChanged("FieldsAreReadOnly");
     TextName.Focus();
     ButtonEdit.IsVisible   = false;
     ButtonSave.IsVisible   = true;
     ButtonCancel.IsVisible = true;
     Status.IsEnabled       = true;
     Createdby.IsVisible    = false;
     Createdon.IsVisible    = false;
     Modifiedby.IsVisible   = false;
     Modifiedon.IsVisible   = false;
     LCreatedby.IsVisible   = false;
     LCreatedon.IsVisible   = false;
     LModifiedby.IsVisible  = false;
     LModifiedon.IsVisible  = false;
 }
        //确定
        private void okBtn_Click(object sender, EventArgs e)
        {
            if (TextName.Text.Trim() == "")
            {
                BathClass.printErrorMsg("需要输入部门名称");
                TextName.SelectAll();
                TextName.Focus();
                return;
            }

            m_Department.name = TextName.Text.Trim();

            if (TextNote.Text.Trim() != "")
            {
                m_Department.note = TextNote.Text.Trim();
            }

            if (newDepartment)
            {
                if (db.Department.FirstOrDefault(x => x.name == TextName.Text) != null)
                {
                    BathClass.printErrorMsg("已经存在此名称的部门");
                    TextName.SelectAll();
                    TextName.Focus();
                    return;
                }

                db.Department.InsertOnSubmit(m_Department);
                db.SubmitChanges();

                m_form.createTree();
                m_Department  = new Department();
                TextName.Text = "";
                TextNote.Text = "";
                TextName.Focus();
            }
            else
            {
                db.SubmitChanges();
                this.DialogResult = DialogResult.OK;
            }
        }
Exemple #15
0
        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar > 95 && e.KeyChar < 124)
            {
                //only display lowercase letters of the alphabet
            }
            else//entered a number or character that isnt in the alphabet
            {
                MessageBox.Show("Please enter letters only", "Error");
                e.Handled = true;
                TextName.Focus();//Focus on name textbox
            }

            if (e.KeyChar > 12 && e.KeyChar < 14)//Enter key pressed
            {
                MessageBox.Show("Please enter your lives now between 1 and 5");
                TextName.Enabled = false; //deny access to name textbox
                LblLives.Focus();         //Focus on lives textbox
            }
        }
        public AddressPageObject fillForm(string clientType, string promoCode, string name, string email, string birthDate, string gender, string maritalStatus)
        {
            TextName.SendKeys(name);
            TextEmail.SendKeys(email);

            if (clientType == "Person")
            {
                RadioClientType.FindElement(By.XPath("//label[text()=" + "'" + clientType + "']")).Click();
                TextPromoCode.SendKeys(promoCode);
                TextBirthDate.SendKeys(birthDate);
                SelectGender.SendKeys(gender);
                SelectGender.FindElement(By.XPath("//select/option[text()=" + "'" + maritalStatus + "'" + "]")).Click();
                BtnNext.Click();
                return(new AddressPageObject(driver));
            }
            RadioClientType.FindElement(By.XPath("//label[text()=" + "'" + clientType + "']")).Click();
            TextPromoCode.SendKeys(promoCode);
            BtnNext.Click();
            return(new AddressPageObject(driver));
        }
Exemple #17
0
        private void Modify()
        {
            if (string.IsNullOrEmpty(TextName.Text))
            {
                MessageBox.Show("请输入温度类型名称");
                TextName.Focus();
                return;
            }

            Temperature.Name = TextName.Text;
            var result = TemperatureHelperClient.RenameTemperature(Convert.ToString(Temperature.ID), Temperature.Name);

            if (string.IsNullOrEmpty(result))
            {
                MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show(result, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #18
0
 internal static bool setText(TextName file, string[] strings)
 {
     Config.GameTextStrings[Config.getGameText(file).Index] = strings;
     return true;
 }
Exemple #19
0
 // Text Requests
 internal static string[] getText(TextName file)
 {
     return Config.GameTextStrings[Config.getGameText(file).Index];
 }
Exemple #20
0
 private void TextName_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     TextName.Clear();
 }
Exemple #21
0
 public TextReference getGameText(TextName name)
 {
     return GameText.FirstOrDefault(f => f.Name == name);
 }
Exemple #22
0
 public bool setText(TextName file, string[] strings)
 {
     GameTextStrings[getGameText(file).Index] = strings;
     return(true);
 }
Exemple #23
0
 public string[] getText(TextName file)
 {
     return((string[])GameTextStrings[getGameText(file).Index].Clone());
 }
Exemple #24
0
 private void Form1_Load(object sender, EventArgs e)
 {
     MessageBox.Show("Use the arrow keys to move your vehicle. \n Don't get hit by the tyres! \n Every oil can you collect scores a point! \n If a tyre hits your vehicle a life is lost!", "Game Instructions");
     TextName.Focus();
 }
Exemple #25
0
        private void ButtonLogin_Click(object sender, EventArgs e)
        {
            if (TextName.Text.Trim() == "" && TextPassword.Text.Trim() == "")
            {
                labelNameNull.Text     = "账号不能为空";
                labelPasswordNull.Text = "密码不能为空";
                TextName.Focus();
            }
            else if (TextName.Text.Trim() == "")
            {
                labelNameNull.Text     = "账号不能为空";
                labelPasswordNull.Text = "      ";
                TextName.Focus();
            }
            else if (TextPassword.Text.Trim() == "")
            {
                labelNameNull.Text     = "      ";
                labelPasswordNull.Text = "密码不能为空";
                TextPassword.Focus();
            }
            else
            {
                labelNameNull.Text     = "      ";
                labelPasswordNull.Text = "      ";

                string identify = ComboBox.SelectedItem.ToString();
                switch (identify)
                {
                case "总管理员":
                {
                    if (TextName.Text.Trim() != "admin" && TextPassword.Text.Trim() != PublicValue.ADMINPASWRD)
                    {
                        labelNameNull.Text     = "账号输入错误";
                        labelPasswordNull.Text = "密码输入错误";
                        TextName.Focus();
                    }
                    else if (TextName.Text.Trim() != "admin")
                    {
                        labelNameNull.Text     = "账号输入错误";
                        labelPasswordNull.Text = "      ";
                        TextName.Focus();
                    }
                    else if (TextPassword.Text.Trim() != PublicValue.ADMINPASWRD)
                    {
                        labelNameNull.Text     = "      ";
                        labelPasswordNull.Text = "密码输入错误";
                        TextName.Focus();
                    }
                    else
                    {
                        MessageBox.Show("登录成功!", "提示");
                        this.Hide();
                        Admin admin = new Admin();
                        admin.Show();
                    }

                    break;
                }

                case "公寓管理员":
                {
                    int             flag          = 0;
                    MySQLConnection SQLconnection = new MySQLConnection(new MySQLConnectionString
                                                                            ("localhost", "DormitoryManage", "root", "123456").AsString);
                    string SQLstr = "SELECT managerNumber, managerPassword FROM manager_info";
                    SQLconnection.Open();
                    MySQLCommand    SQLcommand = new MySQLCommand(SQLstr, SQLconnection);
                    MySQLDataReader SQLreader  = (MySQLDataReader)SQLcommand.ExecuteReader();
                    while (SQLreader.Read())
                    {
                        string tempa = SQLreader["managerNumber"].ToString();
                        string tempb = SQLreader["managerPassword"].ToString();
                        if (TextName.Text.Trim() != tempa && TextPassword.Text.Trim() != tempb)
                        {
                            flag = 0;
                        }
                        else if (TextName.Text.Trim() != tempa)
                        {
                            flag = 1;
                        }
                        else if (TextPassword.Text.Trim() != tempb)
                        {
                            flag = 2;
                        }
                        else
                        {
                            flag = 3;
                            break;
                        }
                    }
                    SQLconnection.Close();

                    if (flag == 0)
                    {
                        labelNameNull.Text     = "账号输入错误";
                        labelPasswordNull.Text = "密码输入错误";
                        TextName.Focus();
                    }
                    else if (flag == 1)
                    {
                        labelNameNull.Text     = "账号输入错误";
                        labelPasswordNull.Text = "      ";
                        TextName.Focus();
                    }
                    else if (flag == 2)
                    {
                        labelNameNull.Text     = "      ";
                        labelPasswordNull.Text = "密码输入错误";
                        TextName.Focus();
                    }
                    else if (flag == 3)
                    {
                        MessageBox.Show("登录成功!", "提示");
                        PublicValue.MAGNUM = TextName.Text;
                        this.Hide();
                        ManagerHost managerhost = new ManagerHost();
                        managerhost.Show();
                    }
                    break;
                }

                case "学生":
                {
                    int             flag          = 0;
                    MySQLConnection SQLconnection = new MySQLConnection(new MySQLConnectionString
                                                                            ("localhost", "DormitoryManage", "root", "123456").AsString);
                    string SQLstr = "SELECT studentNumber, studentPassword FROM student_info";
                    SQLconnection.Open();
                    MySQLCommand SQLcommand1 = new MySQLCommand("SET NAMES GB2312", SQLconnection);
                    SQLcommand1.ExecuteNonQuery();
                    MySQLCommand    SQLcommand2 = new MySQLCommand(SQLstr, SQLconnection);
                    MySQLDataReader SQLreader   = (MySQLDataReader)SQLcommand2.ExecuteReader();
                    while (SQLreader.Read())
                    {
                        string tempa = SQLreader["studentNumber"].ToString();
                        string tempb = SQLreader["studentPassword"].ToString();
                        if (TextName.Text.Trim() != tempa && TextPassword.Text.Trim() != tempb)
                        {
                            flag = 0;
                        }
                        else if (TextName.Text.Trim() != tempa)
                        {
                            flag = 1;
                        }
                        else if (TextPassword.Text.Trim() != tempb)
                        {
                            flag = 2;
                        }
                        else
                        {
                            flag = 3;
                            break;
                        }
                    }
                    SQLconnection.Close();

                    if (flag == 0)
                    {
                        labelNameNull.Text     = "账号输入错误";
                        labelPasswordNull.Text = "密码输入错误";
                        TextName.Focus();
                    }
                    else if (flag == 1)
                    {
                        labelNameNull.Text     = "账号输入错误";
                        labelPasswordNull.Text = "      ";
                        TextName.Focus();
                    }
                    else if (flag == 2)
                    {
                        labelNameNull.Text     = "      ";
                        labelPasswordNull.Text = "密码输入错误";
                        TextName.Focus();
                    }
                    else if (flag == 3)
                    {
                        MessageBox.Show("登录成功!", "提示");
                        PublicValue.STUNUM = TextName.Text;
                        this.Hide();
                        StudentHost studenthost = new StudentHost();
                        studenthost.Show();
                    }
                    break;
                }
                }
            }
        }
Exemple #26
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     TextName.Focus();
 }
Exemple #27
0
 public TextData getTextData(TextName file) => new TextData(getText(file));
Exemple #28
0
 private TextReference(int index, TextName name)
 {
     Index = index;
     Name = name;
 }
Exemple #29
0
 private void ButtonCancel_Click(object sender, EventArgs e)
 {
     TextName.Clear();
     TextPassword.Clear();
     TextName.Focus();
 }
Exemple #30
0
 public TextData GetTextData(TextName file) => new(GetText(file));
 public void CustomerBilling(string Vname, string Vaddress)
 {
     TextName.SendKeys(Vname);
     TextAddress.SendKeys(Vaddress);
 }
Exemple #32
0
 private TextReference getGameText(TextName name)
 {
     return(GameText.FirstOrDefault(f => f.Name == name));
 }
Exemple #33
0
 private TextReference(int index, TextName name)
 {
     Index = index;
     Name  = name;
 }
 public void preencherName(String name)
 {
     TextName.SendKeys(name);
 }