Пример #1
0
 public PicSelect(HmiApplication app, FormParams formParams)
 {
     m_params = formParams;
     m_app = app;
     InitializeComponent();
     Utility.Translate(this);
 }
Пример #2
0
 public PicSelect(HmiApplication app, FormParams formParams)
 {
     m_params = formParams;
     m_app    = app;
     InitializeComponent();
     Utility.Translate(this);
 }
Пример #3
0
 public FontView(HmiApplication app, int fontIndex, FormParams formParams)
 {
     m_app       = app;
     m_fontIndex = fontIndex;
     m_params    = formParams;
     InitializeComponent();
     Utility.Translate(this);
 }
Пример #4
0
 public FontCreator(FormParams formParams)
 {
     m_params = formParams;
     if (!string.IsNullOrEmpty(m_params.Strings[0]))
         m_custom = true;
     InitializeComponent();
     Utility.Translate(this);
 }
Пример #5
0
 public FontView(HmiApplication app, int fontIndex, FormParams formParams)
 {
     m_app = app;
     m_fontIndex = fontIndex;
     m_params = formParams;
     InitializeComponent();
     Utility.Translate(this);
 }
Пример #6
0
 public FontCreator(FormParams formParams)
 {
     m_params = formParams;
     if (!string.IsNullOrEmpty(m_params.Strings[0]))
     {
         m_custom = true;
     }
     InitializeComponent();
     Utility.Translate(this);
 }
Пример #7
0
 private void btnPreview_Click(object sender, EventArgs e)
 {
     if (listFonts.SelectedIndex >= 0)
     {
         FormParams formParams = new FormParams();
         formParams.Strings = new string[3] {
             "", null, null
         };
         new FontView(m_app, listFonts.SelectedIndex, formParams).ShowDialog();
         if (!string.IsNullOrEmpty(formParams.Strings[1]))
         {
             RefreshFonts();
             FontUpdate(this, EventArgs.Empty);
         }
     }
 }
Пример #8
0
 public SaveOther(FormParams formParams)
 {
     m_params = formParams;
     InitializeComponent();
     Utility.Translate(this);
 }
Пример #9
0
        /// <summary>
        /// Save Other Version
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mi_SaveOther_Click(object sender, EventArgs e)
        {
            if (m_app == null
             || m_openFile == null
             || HmiOptions.RunFilePath == null
                )
            {
                MessageBox.Show("Please open or create new project.".Translate());
                return;
            }

            byte savedVerMajor = HmiOptions.VersionMajor;
            byte savedVerMinor = HmiOptions.VersionMinor;
            try
            {
                FormParams formParams = new FormParams();
                formParams.Strings = new string[1];

                Form form = new SaveOther(formParams);
                form.ShowDialog();
                if (form.DialogResult == DialogResult.OK)
                {
                    string[] version = formParams.Strings[0].Split(Utility.CHAR_DOT);
                    if (version.Length == 2)
                    {
                        HmiOptions.VersionMajor = (byte)Utility.GetInt(version[0]);
                        HmiOptions.VersionMinor = (byte)Utility.GetInt(version[1]);
                        fileOperation("saveAs", "");
                        HmiOptions.VersionMajor = savedVerMajor;
                        HmiOptions.VersionMinor = savedVerMinor;
                    }
                    else if (version.Length == 1 && version[0] == "XML")
                        fileOperation("savexml", "");
                }
            }
            catch (Exception ex)
            {
                HmiOptions.VersionMajor = savedVerMajor;
                HmiOptions.VersionMinor = savedVerMinor;
                MessageBox.Show(ex.Message);
            }
        }
Пример #10
0
        private void miFontGenerator_Click(object sender, EventArgs e)
        {
            FormParams formParams = new FormParams();
            formParams.Strings = new string[] { "" };

            new FontCreator(formParams).ShowDialog();
            if (m_app != null
             && !string.IsNullOrEmpty(formParams.Strings[0])
             && (MessageBox.Show(
                    "Add the generated font?".Translate(),
                    "Tips".Translate(),
                    MessageBoxButtons.YesNo
                    ) == DialogResult.Yes
                ))
            {
                fontAdmin.AddFont(formParams.Strings[0]);
                fontAdmin.RefreshFonts();
            }
        }
Пример #11
0
        private void dataGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGrid.Rows.Count != 0
             && e.RowIndex >= 0
             && dataGrid.Columns[e.ColumnIndex].Name == "colValue"
                )
            {
                string str;
                if (dataGrid.Rows[e.RowIndex].Cells["colType"].Value.ToString() == HmiAttributeType.PicId.ToString())
                {
                    FormParams formParams = new FormParams
                    {
                        Strings = new string[2]
                    };
                    string[] strArray = ((dataGrid.Rows[e.RowIndex].Cells["colValue"].Value == null)
                                        ? ""
                                        : dataGrid.Rows[e.RowIndex].Cells["colValue"].Value.ToString()
                                        ).Split(Utility.CHAR_MINUS);
                    if (strArray.Length == 2)
                        formParams.Strings[1] = strArray[1];

                    Form form = new PicSelect(m_app, formParams);
                    form.ShowDialog();
                    if (form.DialogResult == DialogResult.OK)
                    {
                        str = formParams.Strings[0];
                        dataGrid.Rows[e.RowIndex].Cells["colValue"].Value = str;
                        m_obj.SetAttrValue(dataGrid.Rows[e.RowIndex].Cells["colName"].Value.ToString(), str);
                        if (m_obj.Attributes[0].Data[0] == HmiObjType.OBJECT_TYPE_SLIDER
                         && dataGrid.Rows[e.RowIndex].Cells["colName"].Value.ToString() == "pic2"
                            )
                        {
                            if (!m_obj.SetAttrValue("wid", m_app.Pictures[Utility.GetInt(str)].W.ToString()))
                                m_obj.SetAttrValue("wid", ((m_obj.ObjInfo.Panel.EndX - m_obj.ObjInfo.Panel.X) + 1).ToString());

                            if (!m_obj.SetAttrValue("hig", m_app.Pictures[Utility.GetInt(str)].H.ToString()))
                                m_obj.SetAttrValue("hig", ((m_obj.ObjInfo.Panel.EndY - m_obj.ObjInfo.Panel.Y) + 1).ToString());

                            RefreshObject(m_app, m_page, m_obj);
                        }
                        if (dataGrid.Rows[e.RowIndex].Cells["colIsBinding"].Value != null
                         && dataGrid.Rows[e.RowIndex].Cells["colIsBinding"].Value.ToString() == "1"
                         && str != ""
                         && Utility.GetInt(str) != 0xffff
                         && Utility.GetInt(str) >= 0
                            )
                        {
                            m_obj.BindingPicXY(Utility.GetInt(str));
                            ObjectPosXY(null, null);
                        }
                        ObjectAttach(null, null);
                    }
                }
                else if (dataGrid.Rows[e.RowIndex].Cells["colType"].Value.ToString() == HmiAttributeType.Color.ToString())
                {
                    ColorDialog dialog = new ColorDialog();
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        str = Utility.Get16Color(dialog.Color).ToString();
                        dataGrid.Rows[e.RowIndex].Cells["colValue"].Value = str;
                        m_obj.SetAttrValue(dataGrid.Rows[e.RowIndex].Cells["colName"].Value.ToString(), str);
                        ObjectAttach(null, null);
                    }
                }
            }
        }
Пример #12
0
 public SaveOther(FormParams formParams)
 {
     m_params = formParams;
     InitializeComponent();
     Utility.Translate(this);
 }
Пример #13
0
        private void dataGrid_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGrid.Rows.Count != 0 &&
                e.RowIndex >= 0 &&
                dataGrid.Columns[e.ColumnIndex].Name == "colValue"
                )
            {
                string str;
                if (dataGrid.Rows[e.RowIndex].Cells["colType"].Value.ToString() == HmiAttributeType.PicId.ToString())
                {
                    FormParams formParams = new FormParams
                    {
                        Strings = new string[2]
                    };
                    string[] strArray = ((dataGrid.Rows[e.RowIndex].Cells["colValue"].Value == null)
                                                                                ? ""
                                                                                : dataGrid.Rows[e.RowIndex].Cells["colValue"].Value.ToString()
                                         ).Split(Utility.CHAR_MINUS);
                    if (strArray.Length == 2)
                    {
                        formParams.Strings[1] = strArray[1];
                    }

                    Form form = new PicSelect(m_app, formParams);
                    form.ShowDialog();
                    if (form.DialogResult == DialogResult.OK)
                    {
                        str = formParams.Strings[0];
                        dataGrid.Rows[e.RowIndex].Cells["colValue"].Value = str;
                        m_obj.SetAttrValue(dataGrid.Rows[e.RowIndex].Cells["colName"].Value.ToString(), str);
                        if (m_obj.Attributes[0].Data[0] == HmiObjType.OBJECT_TYPE_SLIDER &&
                            dataGrid.Rows[e.RowIndex].Cells["colName"].Value.ToString() == "pic2"
                            )
                        {
                            if (!m_obj.SetAttrValue("wid", m_app.Pictures[Utility.GetInt(str)].W.ToString()))
                            {
                                m_obj.SetAttrValue("wid", ((m_obj.ObjInfo.Panel.EndX - m_obj.ObjInfo.Panel.X) + 1).ToString());
                            }

                            if (!m_obj.SetAttrValue("hig", m_app.Pictures[Utility.GetInt(str)].H.ToString()))
                            {
                                m_obj.SetAttrValue("hig", ((m_obj.ObjInfo.Panel.EndY - m_obj.ObjInfo.Panel.Y) + 1).ToString());
                            }

                            RefreshObject(m_app, m_page, m_obj);
                        }
                        if (dataGrid.Rows[e.RowIndex].Cells["colIsBinding"].Value != null &&
                            dataGrid.Rows[e.RowIndex].Cells["colIsBinding"].Value.ToString() == "1" &&
                            str != "" &&
                            Utility.GetInt(str) != 0xffff &&
                            Utility.GetInt(str) >= 0
                            )
                        {
                            m_obj.BindingPicXY(Utility.GetInt(str));
                            ObjectPosXY(null, null);
                        }
                        ObjectAttach(null, null);
                    }
                }
                else if (dataGrid.Rows[e.RowIndex].Cells["colType"].Value.ToString() == HmiAttributeType.Color.ToString())
                {
                    ColorDialog dialog = new ColorDialog();
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        str = Utility.Get16Color(dialog.Color).ToString();
                        dataGrid.Rows[e.RowIndex].Cells["colValue"].Value = str;
                        m_obj.SetAttrValue(dataGrid.Rows[e.RowIndex].Cells["colName"].Value.ToString(), str);
                        ObjectAttach(null, null);
                    }
                }
            }
        }