예제 #1
0
        public override string ToString()
        {
            string id = "ID:" + PID + "\r\n";

            string current = "电流值:" + CurrentVal.ToString() + "\r\n";

            string pass = "******" + Pass.ToString() + "\r\n";

            return(id + current + pass);
        }
예제 #2
0
파일: EditItemForm.cs 프로젝트: uvbs/OpenAo
        private void SaveParameter()
        {
            if (CurrentColIdx == 1)
            {
                string val = CurrentVal.ToString();

                var key = Info.DesParameterMap.First(x => x.Value == val).Key;
                dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex].Cells[0].Value = key;

                Owner.UpdateSelected("DestParameter" + (CurrentRowIdx + 1), key);
            }

            if (CurrentColIdx == 2)
            {
                var val = float.Parse(CurrentVal.ToString());

                Owner.UpdateSelected("ParameterValue" + (CurrentRowIdx + 1), val);
            }
        }
예제 #3
0
        public void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e)
        {
            string temp = "";

            // Cycle through switch statement to avoid rare key value (e.g. 1 key = Number1 but need 1)
            // This also makes it alphanumeric only which is what is needed
            switch (e.Key)
            {
            // Letters
            case Key.A:
            case Key.B:
            case Key.C:
            case Key.D:
            case Key.E:
            case Key.F:
            case Key.G:
            case Key.H:
            case Key.I:
            case Key.J:
            case Key.K:
            case Key.L:
            case Key.M:
            case Key.N:
            case Key.O:
            case Key.P:
            case Key.Q:
            case Key.R:
            case Key.S:
            case Key.T:
            case Key.U:
            case Key.V:
            case Key.W:
            case Key.X:
            case Key.Y:
            case Key.Z:
                if (Input < 3)
                {
                    if (e.Shift)
                    {
                        temp += e.Key.ToString();
                    }
                    else
                    {
                        temp += e.Key.ToString().ToLower();
                    }
                }
                break;

            // Numbers
            case Key.Number0:
                temp += "0";
                break;

            case Key.Number1:
                temp += "1";
                break;

            case Key.Number2:
                temp += "2";
                break;

            case Key.Number3:
                temp += "3";
                break;

            case Key.Number4:
                temp += "4";
                break;

            case Key.Number5:
                temp += "5";
                break;

            case Key.Number6:
                temp += "6";
                break;

            case Key.Number7:
                temp += "7";
                break;

            case Key.Number8:
                temp += "8";
                break;

            case Key.Number9:
                temp += "9";
                break;

            // Format related keys
            case Key.BackSpace:
                if (CurrentVal.Length <= 0)
                {
                    break;
                }
                CurrentVal = CurrentVal.Substring(0, CurrentVal.Length - 1);
                break;

            case Key.Period:
                temp += ".";
                break;

            // Functions
            case Key.Enter:
                Input++;
                if (Input == 0 || Input > 2)
                {
                    CurrentVal = "0";
                }
                else
                {
                    CurrentVal = "";
                }
                break;

            case Key.Space:
                if (Input >= InputTotal)
                {
                    CompileInputs();
                }
                break;
            }

            CurrentVal += temp;
        }