Exemplo n.º 1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            bool success = false;

            using (OpenFileDialog fileDialog = new OpenFileDialog())
            {
                fileDialog.Filter           = "G510 Image|*.g510";
                fileDialog.InitialDirectory = string.IsNullOrEmpty(_lastPath) ? Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) : _lastPath;
                fileDialog.CheckFileExists  = true;
                fileDialog.Multiselect      = false;

                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    _lastPath = Path.GetDirectoryName(fileDialog.FileName);
                    success   = _core.LoadFromFile(fileDialog.FileName);
                }
            }

            if (!success)
            {
                return;
            }

            _blockUpdate = true;
            G510Data data = _core.G510Data;

            cboFont.SelectedItem = data.FontName;
            numFontSize.Value    = data.FontSize;
            numPosX.Value        = data.X;
            numPosY.Value        = data.Y;
            txtText.Text         = data.Text;
            _blockUpdate         = false;
        }
Exemplo n.º 2
0
        private void UpdateScreen(object sender, EventArgs e)
        {
            if (_blockUpdate)
            {
                return;
            }

            G510Data data = _core.G510Data;

            data.FontName = (string)cboFont.SelectedItem;
            data.FontSize = (int)numFontSize.Value;
            data.Text     = txtText.Text;
            data.X        = (int)numPosX.Value;
            data.Y        = (int)numPosY.Value;

            _core.RefreshDisplay();
        }