public void delegaty(ToOptions e) { this.AppContext.Invoke(() => { okButton.Sensitive = false; }); SeedTableInterface.InformationMessageEventHandler handler = (string message) => { Console.WriteLine(message); this.AppContext.Invoke(() => { textBox.Insert(message + "\n", textBox.CursorPosition); }); }; SeedTableInterface.InformationMessageEvent += handler; try { SeedTableInterface.SeedToExcel(e); Status = true; } catch (SeedTableInterface.CannotContinueException) { Status = false; } finally { this.AppContext.Invoke(() => { okButton.Sensitive = true; }); SeedTableInterface.InformationMessageEvent -= handler; } }
private void YamlToExcel(string[] fileNames) { if (fileNames == null) { return; } var fileBaseNames = fileNames.Select(fileName => Path.GetFileName(fileName)); var fileDirNames = fileNames.Select(fileName => Path.GetDirectoryName(fileName)); var fileDirName = fileDirNames.First(); if (!fileDirNames.All(_fileDirName => fileDirName == _fileDirName)) { ShowMessageBox("同じフォルダにあるxlsxファイルのみにして下さい", "エラー"); return; } var setting = LoadSetting(); if (setting == null) { return; } var d = new FileSelectionDialog(); d.FileTypeMask = FileTypeMask.Directory; d.DialogStyle = DialogStyle.FullApplicationModal; d.PathMode = PathMode.Relative; d.Directory = YamlToExcelTargetFolder; d.CancelEvent += (x, y) => { d.Destroy(); }; d.OkEvent += (x, y) => { YamlToExcelTargetFolder = System.IO.Path.Combine(d.Directory, d.TextString); SaveFormValues(); var options = new ToOptions(); options.files = fileBaseNames; options.seedInput = SeedPath; options.xlsxInput = fileDirName; options.output = YamlToExcelTargetFolder; options.columnNamesRow = setting.columnNamesRow; options.dataStartRow = setting.dataStartRow; options.engine = setting.engine; options.ignoreColumns = setting.ignoreColumns; options.ignore = setting.ignore; options.only = setting.only; options.subdivide = setting.subdivide; options.mapping = setting.mapping; options.versionColumn = setting.versionColumn; options.requireVersion = setting.requireVersion; options.delete = setting.delete; options.seedExtension = setting.seedExtension; options.calcFormulas = setting.calcFormulas; d.Destroy(); var dialog = new YamlToExcelDialogX11(options); this.Layout.Children.Add(dialog); dialog.Popup(GrabOption.Exclusive); }; this.Layout.Children.Add(d); }
private void YamlToExcel(string[] fileNames) { if (fileNames == null) { return; } var fileBaseNames = fileNames.Select(fileName => Path.GetFileName(fileName)); var fileDirNames = fileNames.Select(fileName => Path.GetDirectoryName(fileName)); var fileDirName = fileDirNames.First(); if (!fileDirNames.All(_fileDirName => fileDirName == _fileDirName)) { MessageBox.Show("同じフォルダにあるxlsxファイルのみにして下さい", "エラー"); return; } var setting = LoadSetting(); if (setting == null) { return; } dataExcelFolderBrowserDialog.SelectedPath = DataExcelsDirectoryPath; if (dataExcelFolderBrowserDialog.ShowDialog() == DialogResult.OK) { DataExcelsDirectoryPath = dataExcelFolderBrowserDialog.SelectedPath; } else { return; } var options = new ToOptions(); options.files = fileBaseNames; options.seedInput = SeedPath; options.xlsxInput = fileDirName; options.output = DataExcelsDirectoryPath; options.columnNamesRow = setting.columnNamesRow; options.dataStartRow = setting.dataStartRow; options.engine = setting.engine; options.ignoreColumns = setting.ignoreColumns; options.ignore = setting.ignore; options.only = setting.only; options.subdivide = setting.subdivide; options.mapping = setting.mapping; options.versionColumn = setting.versionColumn; options.requireVersion = setting.requireVersion; options.delete = setting.delete; options.seedExtension = options.seedExtension; options.calcFormulas = setting.calcFormulas; var dialog = new YamlToExcelDialog(options); dialog.ShowDialog(); }
public YamlToExcelDialogX11(ToOptions options) : base() { Options = options; this.AllowAutoManage = false; this.DeleteResponse = DeleteResponse.DoNothing; this.CreatePopupChildEvent += (x, y) => { Sinatra(); new Task(() => { delegaty(options); }).Start(); }; }
protected virtual ToOptions BuildToOptions(IEnumerable <string> files, string seedInput, string xlsxInput, string output, bool calcFormulas = true) { var options = new ToOptions(); options.files = files; options.engine = CommonOptions.Engine.EPPlus; options.calcFormulas = calcFormulas; options.xlsxInput = xlsxInput; options.seedInput = seedInput; options.output = output; OptionsList.Add(options); return(options); }
private void settingButton_Click(object sender, EventArgs e) { var setting = LoadSetting(false); if (setting == null) { setting = new ToOptions(); } var settingReadOnly = SettingReadOnly(); var dialog = new SettingDialogX11(setting, !settingReadOnly, new SettingHandler(this)); this.Layout.Children.Add(dialog); dialog.Popup(GrabOption.Exclusive); }
public SettingDialogX11(ToOptions options, bool changeable, SeedTableX11.SettingHandler handler) : base() { this.Width = 700; this.Height = 600; Options = options; XHandler = handler; Changable = changeable; this.AllowAutoManage = false; this.AllowShellResize = true; this.Title = "Settings"; this.CreatePopupChildEvent += (x, y) => { Sinatra(); }; this.PopdownEvent += (x, p) => { this.Destroy(); }; }
private void SaveSetting(ToOptions options) { // 使わないパス情報は空にして出力しないようにする options.output = null; options.seedInput = null; options.xlsxInput = null; var builder = new SerializerBuilder(); builder.WithNamingConvention(new HyphenatedNamingConvention()); var serializer = builder.Build(); var yaml = serializer.Serialize(options); if (SettingPath == null || SettingPath.Length == 0) { SettingPath = Path.Combine(Application.StartupPath, DefaultSettingFile); } File.WriteAllText(SettingPath, yaml); }
public SettingDialog(ToOptions options, bool changeable = true) { InitializeComponent(); foreach (Control controll in Controls) { controll.Enabled = changeable; } var toOptionsStringListDataSource = new ToOptionsStringListDataSource(options); subdivideTextBox.DataBindings.Add("Text", toOptionsStringListDataSource, "subdivide", true, DataSourceUpdateMode.OnPropertyChanged); onlyTextBox.DataBindings.Add("Text", toOptionsStringListDataSource, "only", true, DataSourceUpdateMode.OnPropertyChanged); ignoreTextBox.DataBindings.Add("Text", toOptionsStringListDataSource, "ignore", true, DataSourceUpdateMode.OnPropertyChanged); mappingTextBox.DataBindings.Add("Text", toOptionsStringListDataSource, "mapping", true, DataSourceUpdateMode.OnPropertyChanged); ignoreColumnsTextBox.DataBindings.Add("Text", toOptionsStringListDataSource, "ignoreColumns", true, DataSourceUpdateMode.OnPropertyChanged); yamlColumnsTextBox.DataBindings.Add("Text", toOptionsStringListDataSource, "yamlColumns", true, DataSourceUpdateMode.OnPropertyChanged); engineComboBox.DataSource = Enum.GetValues(typeof(ToOptions.Engine)); toOptionsBindingSource.DataSource = options; }
internal void SaveSetting(ToOptions options) { // 使わないパス情報は空にして出力しないようにする options.output = null; options.seedInput = null; options.xlsxInput = null; var builder = new SerializerBuilder(); builder.WithNamingConvention(new HyphenatedNamingConvention()); var serializer = builder.Build(); var yaml = serializer.Serialize(options); if (SettingPath == null || SettingPath.Length == 0) { // TODO: もう少しエレガントな方法は無いものか SettingPath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), DefaultSettingFile); } File.WriteAllText(SettingPath, yaml); }
public YamlToExcelDialog(ToOptions options) : base() { InitializeComponent(); Options = options; }
protected void Prepare(ToOptions options) { SeedTableInterface.SeedToExcel(options); }
public ToOptionsStringListDataSource(ToOptions options) { Options = options; }
public void Save(ToOptions opt) { x11.SaveSetting(opt); }