Esempio n. 1
0
        ConvertConfig m_config = new ConvertConfig(); //当前配置方案

        #endregion Fields

        #region Constructors

        public MainForm()
        {
            InitializeComponent();

            //string src = "";
            string dps = "";

            //有命令行参数时候, 通过命令行参数赋值
            if (Program.ags != null && Program.ags.Length == 1)
            {
                if (Program.ags[0] != null && Program.ags[0] != "")
                {
                    dps = Program.ags[0];
                }
                string configPath = dps + "\\config.xml";
                if (File.Exists(configPath))
                {
                    m_config = (ConvertConfig)m_config.DeserializeXML(configPath);
                }
                else
                {
                    m_config = (ConvertConfig)m_config.DeserializeXML("config.xml");
                }
                m_config.dps = dps;
            }
            else
            {
                m_config = (ConvertConfig)m_config.DeserializeXML("config.xml");
            }

            SetConvertConfig(m_config);
            Convertor.convertEvent += new Convertor.ConvertEventHandler(OnConvertEvent);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取配置方案
        /// </summary>
        /// <returns>返回配置方案</returns>
        private ConvertConfig GetConvertConfig()
        {
            ConvertConfig config = new ConvertConfig();
            if (m_combox_format.Enabled)
            {
                switch (m_combox_format.SelectedIndex)
                {
                    case 0:
                        config.format = ConfigFormat.DM642; break;
                    case 1:
                        config.format = ConfigFormat.C54XX; break;
                }
            }

            if (m_combox_lightNum.Enabled)
            {
                switch (m_combox_lightNum.SelectedIndex)
                {
                    case 0:
                        config.lightNum = ConfigLightNum.Single; break;
                    case 1:
                        config.lightNum = ConfigLightNum.Double; break;
                    case 2:
                        config.lightNum = ConfigLightNum.Triple; break;
                }
            }

            if (m_combox_output.Enabled)
            {
                switch (m_combox_output.SelectedIndex)
                {
                    case 0:
                        config.Output = ConfigOutput.Ir; break;
                    case 1:
                        config.Output = ConfigOutput.Green; break;
                    case 2:
                        config.Output = ConfigOutput.Uv; break;
                    case 3:
                        config.Output = ConfigOutput.All; break;
                }
            }

            if (m_combox_mod.Enabled)
            {
                switch (m_combox_mod.SelectedIndex)
                {
                    case 0:
                        config.reviseMode = ConfigReviseMode.Penetrate; break;
                    case 1:
                        config.reviseMode = ConfigReviseMode.Reflect; break;
                }
            }

            if (m_combox_basicImg.Enabled)
            {
                switch (m_combox_basicImg.SelectedIndex)
                {
                    case 0:
                        config.basicImg = ConfigBasicImg.Ir; break;
                    case 1:
                        config.basicImg = ConfigBasicImg.Green; break;
                }
            }

            if (m_checkBox_irEquel.Enabled)
                config.irEqual = m_checkBox_irEquel.Checked;

            if (m_checkBox_irNeighbor.Enabled)
                config.irNeighbor = m_checkBox_irNeighbor.Checked;

            if (m_checkBox_irPrefix.Enabled)
                config.irPrefix = m_checkBox_irPrefix.Checked;

            if (m_checkBox_grEquel.Enabled)
                config.uvgrEqual = m_checkBox_grEquel.Checked;

            if (m_checkBox_grNeighbor.Enabled)
                config.uvgrNeighbor = m_checkBox_grNeighbor.Checked;

            if (m_checkBox_grPrefix.Enabled)
                config.grPrefix = m_checkBox_grPrefix.Checked;

            config.src = m_txtbox_src.Text;
            config.dps = m_txtbox_out.Text;
            return config;
        }
Esempio n. 3
0
        /// <summary>
        /// 配置界面
        /// </summary>
        /// <param name="config">配置</param>
        /// <returns></returns>
        private void SetConvertConfig(ConvertConfig config)
        {
            if (m_combox_format.Enabled)
            {
                switch (config.format)
                {
                    case ConfigFormat.DM642:
                        m_combox_format.SelectedIndex = 0; break;
                    case ConfigFormat.C54XX:
                        m_combox_format.SelectedIndex = 1; break;
                }
            }

            if (m_combox_lightNum.Enabled)
            {
                switch (config.lightNum)
                {
                    case ConfigLightNum.Single:
                        m_combox_lightNum.SelectedIndex = 0; break;
                    case ConfigLightNum.Double:
                        m_combox_lightNum.SelectedIndex = 1; break;
                    case ConfigLightNum.Triple:
                        m_combox_lightNum.SelectedIndex = 2; break;
                }
            }

            if (m_combox_output.Enabled)
            {
                switch (config.Output)
                {
                    case ConfigOutput.Ir:
                        m_combox_output.SelectedIndex = 0; break;
                    case ConfigOutput.Green:
                        m_combox_output.SelectedIndex = 1; break;
                    case ConfigOutput.Uv:
                        m_combox_output.SelectedIndex = 2; break;
                    case ConfigOutput.All:
                        {
                            config.Output = ConfigOutput.All;
                            m_combox_output.SelectedIndex = 3; break;
                        }
                }
            }

            if (m_combox_mod.Enabled)
            {
                switch (config.reviseMode)
                {
                    case ConfigReviseMode.Penetrate:
                        m_combox_mod.SelectedIndex = 0; break;
                    case ConfigReviseMode.Reflect:
                        m_combox_mod.SelectedIndex = 1; break;
                }
            }

            if (m_combox_basicImg.Enabled)
            {
                switch (config.basicImg)
                {
                    case ConfigBasicImg.Ir:
                        m_combox_basicImg.SelectedIndex = 0; break;
                    case ConfigBasicImg.Green:
                        m_combox_basicImg.SelectedIndex = 1; break;
                }
            }

            if (m_checkBox_irEquel.Enabled)
                 m_checkBox_irEquel.Checked = config.irEqual;

            if (m_checkBox_irNeighbor.Enabled)
                 m_checkBox_irNeighbor.Checked = config.irNeighbor;

            if (m_checkBox_irPrefix.Enabled)
                m_checkBox_irPrefix.Checked = config.irPrefix;

            if (m_checkBox_grEquel.Enabled)
                m_checkBox_grEquel.Checked = config.uvgrEqual;

            if (m_checkBox_grNeighbor.Enabled)
                m_checkBox_grNeighbor.Checked = config.uvgrNeighbor;

            if (m_checkBox_grPrefix.Enabled)
                m_checkBox_grPrefix.Checked = config.grPrefix;

            m_txtbox_src.Text = config.src;
            m_txtbox_out.Text = config.dps;
        }
Esempio n. 4
0
 /// <summary>
 /// 配置方案改变时候触发
 /// </summary>
 private void OnConfigChanged(object sender, EventArgs e)
 {
     m_config = GetConvertConfig();
 }
Esempio n. 5
0
 /// <summary>
 /// 单击"来源"时触发
 /// </summary>
 private void OnBtSrcClick(object sender, EventArgs e)
 {
     FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
     folderBrowser.ShowNewFolderButton = true;
     folderBrowser.SelectedPath = m_txtbox_src.Text;
     if (folderBrowser.ShowDialog() == DialogResult.OK)
     {
         m_txtbox_src.Text = folderBrowser.SelectedPath;
     }
     string configPath = m_txtbox_src.Text + "config.xml";
     if (File.Exists(configPath))
     {
         m_config = (ConvertConfig)m_config.DeserializeXML();
         m_config.src = m_txtbox_src.Text;
         SetConvertConfig(m_config);
     }
 }