public FormCode() { InitializeComponent(); this.DialogResult = DialogResult.Cancel; mDirectoryName = MiscFunction.GetInstance().GetAssemblyPath() + Parameter.GetInstance().TemplateDirectory + "\\"; string[] directories = Directory.GetDirectories(mDirectoryName); cmbTemplate.Items.Add("(默认模板)"); foreach (string directory in directories) { string[] strings = directory.Split(new string[] { "\\" }, StringSplitOptions.None); if (strings.Length >= 2) { cmbTemplate.Items.Add(strings[strings.Length - 1]); } } if (cmbTemplate.Items.Contains(Parameter.GetInstance().DefaultTemplateName)) { cmbTemplate.SelectedItem = (Parameter.GetInstance().DefaultTemplateName); } else { cmbTemplate.SelectedIndex = 0; } }
private void LoadOptionFile() { if (!File.Exists(mConfigurationFilePath)) { CreateDefualtConfigurationFile(); } mSingletonConfiguration = (Configuration)MiscFunction.GetInstance().DeSerializeBinaryFile(mConfigurationFilePath); mSingletonConfiguration.ConfigurationFilePath = mConfigurationFilePath; }
public Configuration(bool isResetConfiguration) { mConfigurationFilePath = MiscFunction.GetInstance().GetAssemblyPath() + mConfigurationFileName; if (isResetConfiguration) { CreateDefualtConfigurationFile(); } LoadOptionFile(); }
public bool LoadUserConfigurationFile() { try { mSingletonConfiguration = (UserConfiguration)MiscFunction.GetInstance().DeSerializeBinaryFile(MiscFunction.GetInstance().GetAssemblyPath() + mConfigurationFilePath); mSingletonConfiguration.ConfigurationFilePath = mConfigurationFilePath; return(true); } catch (System.Exception ex) { CreateDefualtUserConfigurationFile(); System.Console.Out.WriteLine(ex.Message); return(false); } }
//button1,Excel测试按键 private void button1_Click(object sender, EventArgs e) { try { //Excel测试 mAccessExcel = AccessExcel.CreateInstance(); mDestinationExcelFile = MiscFunction.GetInstance().GetAssemblyPath() + Parameter.GetInstance().ReportDirectory + "\\" + "temp.xlsx"; File.Copy(mExcelModalFileName, mDestinationExcelFile, true); Application.DoEvents(); string ret = mAccessExcel.OpenExcelFile(mDestinationExcelFile); mAccessExcel.SetExcelVisible(); for (int i = 0; i < 1500; i++) { mAccessExcel.AddChipStatus(i, 1); } SaveResultToExcelFile(); } catch (System.Exception ex) { MessageBox.Show(ex.ToString()); } }
public void SaveConfigurationFile(string fileName) { MiscFunction.GetInstance().SerializeBinaryFile(fileName, FileMode.Create, this); }
public void SaveConfigurationFile() { MiscFunction.GetInstance().SerializeBinaryFile(mConfigurationFilePath, FileMode.Create, this); }