/// <summary> /// 另存配置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveAsButton1_Click(object sender, EventArgs e) { try { SaveAsFileDialog1.FileName = ""; DialogResult dr = SaveAsFileDialog1.ShowDialog(); if (dr == DialogResult.OK) { File.Copy(channelConfigPathCurrent, SaveAsFileDialog1.FileName, true); //把所选层的配置文件设置为新的 channelConfigPathCurrent = SaveAsFileDialog1.FileName; //保存配置到文件 SaveChannelSetToConfigFile(channelConfigPathCurrent); //GetChannelsData(channelConfigPathCurrent, channelNames); ConfigLabel.Text = Path.GetFileName(channelConfigPathCurrent); MessageBox.Show("保存成功!"); } } catch (Exception ex) { MyLogger.LogError("保存配置文件时出错", ex); MessageBox.Show(ex.Message); } }
/// <summary> /// 按钮单击响应事件---当前通道配置文件另存为 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveAsButton1_Click(object sender, EventArgs e) { try { SaveAsFileDialog1.FileName = ""; DialogResult dr = SaveAsFileDialog1.ShowDialog(); if (dr == DialogResult.OK) { File.Copy(CommonClass.listDIC[LayerComboBox1.SelectedIndex].sConfigFilePath, SaveAsFileDialog1.FileName, true); //把所选层的配置文件设置为新的 CommonClass.listDIC[LayerComboBox1.SelectedIndex].sConfigFilePath = SaveAsFileDialog1.FileName; //保存配置到文件 SaveChannelSetToConfigFile(); //CommonClass.SaveChannelsConfig(LayerComboBox1.SelectedIndex); //CommonClass.cdp.QueryDataChannelInfoHead(CommonClass.listDIC[LayerComboBox1.SelectedIndex].sFilePath); bool bReturn = CommonClass.ReLoadChannelsConfig(SaveAsFileDialog1.FileName, LayerComboBox1.SelectedIndex); if (bReturn) { GetChannelsData(); SaveButton1.Enabled = true; } //CommonClass.listDIC[LayerComboBox1.SelectedIndex].sConfigFilePath = SaveAsFileDialog1.FileName; MessageBox.Show("保存成功!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } QuickSetMFHScrollBar_Scroll(); }