private bool UseTableNameCommandEnabled(Object o) { bool result = false; if (o != null) { WorksheetItemType selectedItem = (WorksheetItemType)((ObservableCollection <object>)o).FirstOrDefault(); result = selectedItem != null; } return(result); }
private void UseTableNameProc(object o) { if (o == null) { return; } WorksheetItemType selectedItem = (WorksheetItemType)((ObservableCollection <object>)o).FirstOrDefault(); if (selectedItem == null) { return; } string s = selectedItem.WorksheetNameForQuery; Model.BaseModel.SqlQuery += s; }
private void RunAnalyticsProc(object o) { try { using (new WaitCursor()) { using (ExcelCore excelIn = new ExcelCore(Model.BaseModel.ExcelFileName, AppDataCore.Settings.AceVersion, Model.BaseModel.HDR)) { List <string> worksheets = excelIn.GetWorksheets(); Model.WorksheetItems.Clear(); foreach (String name in worksheets) { WorksheetItemType worksheetItem = new WorksheetItemType(); worksheetItem.WorksheetName = name; ExcelObject.Worksheet worksheet = excelIn.GetWorksheet(name); worksheetItem.RowCount = excelIn.GetCountOfRows(worksheet); worksheetItem.ColCount = excelIn.GetCountOfCols(worksheet); Model.WorksheetItems.Add(worksheetItem); } } } } catch (Exception ex) { WindowsUI.RunWindowDialog(() => { MessageBox.Show( String.Format(StringsFunctions.ResourceString("resErrorDuringOpening"), Model.BaseModel.ExcelFileName) + Environment.NewLine + Environment.NewLine + ex.Message, StringsFunctions.ResourceString("resError"), MessageBoxButton.OK, MessageBoxImage.Hand ); } ); } }