Пример #1
0
        //stuff that happens after file is selected
        private void FileSelectEdit_EditValueChanged(object sender, EventArgs e)
        {
            var edit = (sender as MRUEdit);

            if (edit == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(edit.Text) || !new FileInfo(edit.Text).Exists)
            {
                SheetSelectEdit.Properties.DataSource = null;
                SheetSelectEdit.EditValue             = null;
            }
            else
            {
                try {
                    ExcelDocument = SpreadsheetDocument.Open(edit.Text, false);

                    List <StringValue> sheets = ExcelDocument.Sheets()
                                                .Select(p => p.OXmlSheet.Name)
                                                .ToList();
                    var args = new CustomSelectSheetPropertiesArgs(sheets);
                    OnCustomSelectSheetProperties(args);
                    SheetSelectEdit.Properties.DataSource = args.Sheets;
                    if (sheets.Count == 1)
                    {
                        SheetSelectEdit.EditValue = sheets.FirstOrDefault();
                    }

                    ImportMapDescriptionEdit.Text = (new FileInfo(edit.Text)).Name;
                }
                catch {
                    CloseExcelDocumentNoThrow();
                    throw;
                }
            }

            var b = SheetSelectEdit.Properties.DataSource != null;

            SheetSelectEdit.Enabled      = b;
            welcomeWizardPage1.AllowNext = b;
        }
Пример #2
0
        protected virtual void OnCustomSelectSheetProperties(CustomSelectSheetPropertiesArgs e)
        {
            EventHandler <CustomSelectSheetPropertiesArgs> handler = CustomSelectSheetProperties;

            handler?.Invoke(this, e);
        }