コード例 #1
0
ファイル: FormVariable.cs プロジェクト: hebskjcc/OpenR8-1
        private void FormVariable_Load(object sender, EventArgs e)
        {
            formMain = (FormMain)this.MdiParent;
            //comboBox1.DataSource = Enum.GetValues(typeof(Data.VariableType));
            //comboBox1.DataSource = R8.typeArray;
            int variableNum = R8.GetVariableNum();

            //MessageBox.Show("variableNum = " + variableNum);
            variableNum = R8.GetVariableNum();
            StringBuilder str = new StringBuilder(R7.STRING_SIZE);

            string[] typeArray;
            if (variableNum > 0)
            {
                typeArray = new string[variableNum];
                for (int i = 0; i < variableNum; i++)
                {
                    R8.GetVariableType(str, R7.STRING_SIZE, i);
                    typeArray[i] = str.ToString();
                    // MessageBox.Show("typeArray" + i + " = " + str);
                }
                comboBox1.DataSource = typeArray;
            }
            else
            {
                //如果沒讀到,用預設值
                comboBox1.DataSource = new string[] { "int", "bool", "float", "double", "string", "image", "json" };
            }

            //20170327 Variable 沒 SN ,不顯示視窗元件。
            if (variableSn == -1 || variableSn == 0)
            {
                comboBox1.Visible     = false;
                label1.Visible        = false;
                labelValue.Visible    = false;
                label3.Visible        = false;
                label4.Visible        = false;
                labelSn.Visible       = false;
                textBoxName.Visible   = false;
                label5.Visible        = false;
                textBoxRemark.Visible = false;
                buttonDelete.Visible  = false;
            }
            else
            {
                comboBox1.Visible     = true;
                label1.Visible        = true;
                labelValue.Visible    = true;
                label3.Visible        = true;
                label4.Visible        = true;
                labelSn.Visible       = true;
                textBoxName.Visible   = true;
                label5.Visible        = true;
                textBoxRemark.Visible = true;
                buttonDelete.Visible  = true;
            }

            str_Variable = R8.TranslationString(str_Variable);
            this.Text    = str_Variable;
        }
コード例 #2
0
ファイル: R8.cs プロジェクト: hebskjcc/OpenR8-1
        public static string TranslationString_backup2(string key)
        {
            //銜接 json 版
            StringBuilder sb_key   = new StringBuilder(key);
            StringBuilder sb_value = new StringBuilder(R7.STRING_SIZE);
            int           res      = R8.TranslationString(sb_key, sb_value);

            MessageBox.Show("res = " + res + "key = " + sb_key.ToString() + " value = " + sb_value.ToString());

            //然後轉 UTF8
            //https://msdn.microsoft.com/zh-tw/library/system.text.encoding.utf8(v=vs.110).aspx
            //https://www.chilkatsoft.com/p/p_320.asp
            //Encoding enc = new UTF8Encoding(true, true);
            //System.Text.Encoding utf_8 = System.Text.Encoding.UTF8;
            byte[] byteArray = new byte[sb_value.Length * sizeof(char)];
            System.Buffer.BlockCopy(sb_value.ToString().ToCharArray(), 0, byteArray, 0, byteArray.Length);
            // string value = System.Text.Encoding.UTF8.GetString(byteArray);
            byte[] bytes        = Encoding.UTF8.GetBytes(sb_value.ToString());
            byte[] bytes_toUTF8 = Encoding.Convert(Encoding.UTF8, Encoding.Default, bytes);

            string value = Encoding.Default.GetString(bytes_toUTF8);

            // String returnValue = enc.GetString(sb_value.ToString());
            //enc.GetBytes(sb_value.ToString());
            //......轉起來中文一直變亂碼有時候還會開檔失敗- -....放棄使用 jansson 了,我直接手動轉
            return(value);
        }
コード例 #3
0
ファイル: FormVariables.cs プロジェクト: hebskjcc/OpenR8-1
        private void FormVariable_Load(object sender, EventArgs e)
        {
            formMain = (FormMain)this.MdiParent;
            FormVariables_SizeChanged(sender, e);

            str_Variables = R8.TranslationString(str_Variables);
            this.Text     = str_Variables;
        }
コード例 #4
0
        private void FormLog_Load(object sender, EventArgs e)
        {
            richTextBox1.Height = this.ClientSize.Height - 15;
            richTextBox1.Width  = this.ClientSize.Width - 15 - buttonClear.Width;
            formMain            = (FormMain)this.MdiParent;

            str_Log   = R8.TranslationString(str_Log);
            this.Text = str_Log;
        }
コード例 #5
0
ファイル: FormLibrary.cs プロジェクト: hebskjcc/OpenR8-1
        public FormLibrary()
        {
            panel2 = new R8.PanelNoScrollOnFocus();
            this.panel2.AutoScroll = true;
            this.panel2.Location   = new System.Drawing.Point(0, 50);
            this.panel2.Name       = "panel2";
            this.panel2.TabIndex   = 1;
            this.Controls.Add(this.panel2);
            InitializeComponent();

            str_Libraries = R8.TranslationString(str_Libraries);
            this.Text     = str_Libraries;
        }
コード例 #6
0
        private void FormFunctions_Load(object sender, EventArgs e)
        {
            formMain = (FormMain)this.MdiParent;
            //20170117 leo: 討論後移除 start

            /*
             * Function function = new Function("start", 0, 0);
             * formMain.r8.addFunction(function);
             * addVariableSn(function);
             * addButton("start", 0);
             */
            Program_Functions = R8.TranslationString(Program_Functions);

            this.Text = Program_Functions + "  0 of 0";

            FormFunctions_SizeChanged(sender, e);
            return;
        }
コード例 #7
0
 private void FormAbout_Load(object sender, EventArgs e)
 {
     //this.textBoxMac.Text = R8.MacAddress;
     str_AboutR8                   = R8.TranslationString(str_AboutR8);
     this.labelAboutR8.Text        = str_AboutR8;
     str_Copyright                 = R8.TranslationString(str_Copyright);
     this.labelAboutCopyright.Text = str_Copyright;
     str_Website                   = R8.TranslationString(str_Website);
     this.labelAboutWebsite.Text   = str_Website;
     str_Email = R8.TranslationString(str_Email);
     this.labelAboutEmail.Text = str_Email;
     str_label1       = R8.TranslationString(str_label1);
     this.label1.Text = str_label1;
     str_label2       = R8.TranslationString(str_label2);
     this.label2.Text = str_label2;
     str_label3       = R8.TranslationString(str_label3);
     this.label3.Text = str_label3;
     str_label4       = R8.TranslationString(str_label4);
     this.label4.Text = str_label4;
 }